/// <summary> Формирование списка отображаемых данных оприложении</summary><param name="versionsSort"></param> public List <DisplayApplication> GetApplications(List <AppVersion> versionsSort) { List <DisplayApplication> Applications = new List <DisplayApplication>(); foreach (var(version, versionDB) in from AppVersion ver in versionsSort let version = Src_meta.Find(ver) let versionDB = Discription.GetAppVersion(ver.VersionName) select(version, versionDB)) { if (version.VersionNumber == versionDB.VersionNumber) { DisplayApplication application = new DisplayApplication(); application.ApplicationName = version.VersionName; application.ApplicationNumber = version.VersionNumber.ToString(); application.Discription = Discription.GetDiscription(version.VersionName, version.VersionNumber.ToString()); application.FlagUpdate = "Установленна актуальная версия"; Applications.Add(application); } else { DisplayApplication application = new DisplayApplication(); application.ApplicationName = version.VersionName; application.ApplicationNumber = version.VersionNumber.ToString(); application.Discription = Discription.GetDiscription(version.VersionName, version.VersionNumber.ToString()); application.FlagUpdate = "Доступно обновление"; Applications.Add(application); } } return(Applications); }
///<summary>Список последних версий</summary> public List <AppVersion> GetVersionFileSystem() { IList <AppVersion> versions = Src_meta.FindAll(); List <AppVersion> versionsSort = new List <AppVersion>(); string[] VersionsApps = (from v in versions select v.VersionName.ToString()).Distinct().ToArray(); versionsSort.AddRange(from string v1 in VersionsApps select Src_meta.FindLast(v1)); return(versionsSort); }
///<summary>Добавление приложения</summary> public ServiceResult AddAplication(string appName, IApplicationVersionBuilder application) { AppVersion srcV = application.Build(); AppVersion Version = Src_meta.FindLast(appName); AppVersion newVersion = new AppVersion(srcV.VersionName, new VersionNumber(srcV.VersionNumber.Number, Version.VersionNumber.VersionBuildNumber + 1), srcV.Files); if (Version.VersionNumber < newVersion.VersionNumber) { IDictionary <FileOfVersion, byte[]> fileContents = application.FindFileOfVersionsWithData(); ServiceResult service = new ServiceResult(Dst_content.Save(newVersion, fileContents)); Dst_meta.SaveApplication(newVersion); return(service); } else { ServiceResult service = new ServiceResult(false); return(service); } }