Example #1
0
        public bool IsCheckedNewVersion(VersionInfoConsumer versionInfoConsumer)
        {
            IEnumerable <VersionInfoConsumer> LocallyCheckVersions = GetLocallyCheckedVersions();

            //if (LocallyCheckVersions == null &&
            //    versionInfoConsumer.ReleaseDate >= DateTime.Now.AddDays(-1 * _newReleasesPastDaysCount))
            //    return false;
            if (LocallyCheckVersions == null)
            {
                if (versionInfoConsumer.ReleaseDate >= DateTime.Now.AddDays(-1 * _newReleasesPastDaysCount))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return
                    (LocallyCheckVersions.Contains(versionInfoConsumer, new VersionComparer()) ||
                     versionInfoConsumer.ReleaseDate < DateTime.Now.AddDays(-1 * _newReleasesPastDaysCount));
            }
        }
Example #2
0
        public void AddLocallyCheckedVersion(VersionInfoConsumer checkedVersionInfo)
        {
            IEnumerable <VersionInfoConsumer> LocallyCheckedVersions = GetLocallyCheckedVersions();
            List <VersionInfoConsumer>        LocallyCheckedVersionsList;

            LocallyCheckedVersionsList =
                LocallyCheckedVersions == null ?
                new List <VersionInfoConsumer>() : LocallyCheckedVersions.ToList();

            if (!LocallyCheckedVersionsList.Contains(checkedVersionInfo, new VersionComparer()))
            {
                LocallyCheckedVersionsList.Add(checkedVersionInfo);

                using (IsolatedStorageFile StorFile = IsolatedStorageFile.GetUserStoreForApplication())
                    using (IsolatedStorageFileStream StorFs = new IsolatedStorageFileStream(_isolatedStorageFileName, FileMode.Create, StorFile))
                        using (StreamWriter sr = new StreamWriter(StorFs))
                        {
                            string JsonData = JsonConvert.SerializeObject(LocallyCheckedVersionsList);
                            sr.Write(JsonData);
                        }
            }
        }