cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-4850) Write the device UUID only when it does not exist
Date Wed, 18 Sep 2013 20:09:52 GMT

    [ https://issues.apache.org/jira/browse/CB-4850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13771178#comment-13771178
] 

ASF subversion and git services commented on CB-4850:
-----------------------------------------------------

Commit ab7871466c26701bea7bcc19c9d8670c3e0f7f47 in branch refs/heads/master from [~purplecabbage]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git;h=ab78714 ]

[CB-4850] only write device guid if it does not exist

                
> Write the device UUID only when it does not exist
> -------------------------------------------------
>
>                 Key: CB-4850
>                 URL: https://issues.apache.org/jira/browse/CB-4850
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: WP8
>    Affects Versions: 3.0.0
>         Environment: Any
>            Reporter: Jonathan Naguin
>            Assignee: Jesse MacFadyen
>            Priority: Minor
>
> Currently, the device UUID is writen back to the IsolatedStorageFile in every run even
when it is not necessary. 
> On CordovaView.xaml.cs:
> {code}
> string deviceUUID = "";
> using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
> {
>     try
>     {
>         IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream("DeviceID.txt",
FileMode.Open, FileAccess.Read, appStorage);
>         using (StreamReader reader = new StreamReader(fileStream))
>         {
>             deviceUUID = reader.ReadLine();
>         }
>     }
>     catch (Exception /*ex*/)
>     {
>         deviceUUID = Guid.NewGuid().ToString();
>     }
>     Debug.WriteLine("Updating IsolatedStorage for APP:DeviceID :: " + deviceUUID);
>     IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Create,
FileAccess.Write, appStorage);
>     using (StreamWriter writeFile = new StreamWriter(file))
>     {
>         writeFile.WriteLine(deviceUUID);
>         writeFile.Close();
>     }
> }
> {code}
> The writing code should be moved into the catch after creating a new one as:
> {code}
> catch (Exception /*ex*/)
>     {
>         deviceUUID = Guid.NewGuid().ToString();
>         IsolatedStorageFileStream file = new IsolatedStorageFileStream("DeviceID.txt",
FileMode.Create, FileAccess.Write, appStorage);
>         using (StreamWriter writeFile = new StreamWriter(file))
>         {
>             writeFile.WriteLine(deviceUUID);
>             writeFile.Close();
>         }
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message