Skip to content

Commit

Permalink
colbylwilliams#5 fix serialization exception for WinRT apps
Browse files Browse the repository at this point in the history
  • Loading branch information
raver99 committed Mar 31, 2017
1 parent f87f326 commit 1afc546
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public void Track()

var oldBuildList = AppSettings[xamBuildsKey] as List<string>;
#else
var oldVersionList = AppSettings.Values[xamVersionsKey] as List<string>;
var oldVersionList = deserializeStringToList(AppSettings.Values[xamVersionsKey] as string);

var oldBuildList = AppSettings.Values[xamBuildsKey] as List<string>;
var oldBuildList = deserializeStringToList(AppSettings.Values[xamBuildsKey] as string);
#endif

versionTrail = new Dictionary<string, List<string>> {
Expand Down Expand Up @@ -143,8 +143,8 @@ public void Track()
AppSettings.CreateContainer(xamBuildsKey, ApplicationDataCreateDisposition.Always);
}

AppSettings.Values[xamVersionsKey] = versionTrail[xamVersionsKey];
AppSettings.Values[xamBuildsKey] = versionTrail[xamBuildsKey];
AppSettings.Values[xamVersionsKey] = serializeList(versionTrail[xamVersionsKey].ToList());
AppSettings.Values[xamBuildsKey] = serializeList(versionTrail[xamBuildsKey].ToList());
#endif
}
}
Expand Down Expand Up @@ -297,6 +297,15 @@ public void OnFirstLaunchOfBuild(string build, Action block)
if (FirstLaunchForBuild(build)) block?.Invoke();
}

private string serializeList(List<string> list)
{
return string.Join(",", list.ToArray());
}

private List<string> deserializeStringToList(string listAsString)
{
return listAsString.Split(',').ToList();
}

public override string ToString()
{
Expand Down

0 comments on commit 1afc546

Please sign in to comment.