Exemplo n.º 1
0
 static void WriteHistory(string key, IEnumerable <string> history)
 => Preferences.Set(key, string.Join("|", history), sharedName);
Exemplo n.º 2
0
        static VersionTracking()
        {
            IsFirstLaunchEver = !Preferences.ContainsKey(versionsKey, sharedName) || !Preferences.ContainsKey(buildsKey, sharedName);
            if (IsFirstLaunchEver)
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, new List <string>() },
                    { buildsKey, new List <string>() }
                };
            }
            else
            {
                versionTrail = new Dictionary <string, List <string> >
                {
                    { versionsKey, ReadHistory(versionsKey).ToList() },
                    { buildsKey, ReadHistory(buildsKey).ToList() }
                };
            }

            IsFirstLaunchForCurrentVersion = !versionTrail[versionsKey].Contains(CurrentVersion);
            if (IsFirstLaunchForCurrentVersion)
            {
                versionTrail[versionsKey].Add(CurrentVersion);
            }

            IsFirstLaunchForCurrentBuild = !versionTrail[buildsKey].Contains(CurrentBuild);
            if (IsFirstLaunchForCurrentBuild)
            {
                versionTrail[buildsKey].Add(CurrentBuild);
            }

            if (IsFirstLaunchForCurrentVersion || IsFirstLaunchForCurrentBuild)
            {
                WriteHistory(versionsKey, versionTrail[versionsKey]);
                WriteHistory(buildsKey, versionTrail[buildsKey]);
            }
        }
Exemplo n.º 3
0
 static string[] ReadHistory(string key)
 => Preferences.Get(key, null, sharedName)?.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];