Пример #1
0
        public ModuleVersionModel GetVersion(NewestVersionDownloader downloader)
        {
            var moduleVersion = DeserializeModuleVersions()
                                .SingleOrDefault(v => v.ModuleName == downloader.GetType().FullName);

            Version version;

            return(moduleVersion != null && Version.TryParse(moduleVersion.Version, out version) ? moduleVersion : null);
        }
Пример #2
0
        public void UpdateVersion(NewestVersionDownloader downloader, Version version)
        {
            var downloaderTypeName = downloader.GetType().FullName;

            var moduleVersions = DeserializeModuleVersions();
            var moduleVersion  = moduleVersions
                                 .SingleOrDefault(v => v.ModuleName == downloaderTypeName);

            if (moduleVersion != null)
            {
                moduleVersions.Remove(moduleVersion);
            }

            moduleVersion = new ModuleVersionModel
            {
                ModuleName = downloaderTypeName,
                Version    = version.ToString()
            };
            moduleVersions.Add(moduleVersion);

            SerializeModuleVersions(moduleVersions);
        }