public static List <InstallationDataModel> GetInstalledVersions(string installPath) { var installs = ChecksumTool.GetInstallationsAtPath(installPath); List <InstallationDataModel> installedVersions = new List <InstallationDataModel>(); for (int i = 0; i < installs.Count; i++) { var tempVersionInfo = installs.ElementAt(i); string path = SanitizePath(installPath + "\\" + tempVersionInfo.Key); //Get data from the VersionFile InstallationDataModel tempModel = InstallationDataModel.GetModelFromFile(path); if (tempModel == null) { tempModel = new InstallationDataModel(); Console.WriteLine(ConsoleExtension.AddTimestamp("NO VersionInfo FOUND!!")); } tempModel.InstallPath = path; tempModel.Files.Clear(); tempModel.MissingFiles.Clear(); //tempModel.VersionName = tempVersionInfo.Key; foreach (var item in tempVersionInfo.Value) { tempModel.Files.Add(new FileModel() { FileChecksum = item.Value, FilePath = item.Key }); } tempModel.InstallationChecksum = GetCombinedChecksum(tempModel.Files); tempModel.SaveToFile(); installedVersions.Add(tempModel); } return(installedVersions); }
public static InstallationDataModel GetInstalledVersion(string installPath) { var install = GetInstallationAtPath(installPath); var tempVersionInfo = install.ElementAt(0); string path = SanitizePath(installPath); //Get data from the VersionFile InstallationDataModel tempModel = InstallationDataModel.GetModelFromFile(path); if (tempModel == null) { tempModel = new InstallationDataModel(); Console.WriteLine(ConsoleExtension.AddTimestamp("NO VersionInfo FOUND!!")); } tempModel.InstallPath = installPath; tempModel.InstallPath = path; tempModel.Files.Clear(); tempModel.MissingFiles.Clear(); foreach (var item in tempVersionInfo.Value) { tempModel.Files.Add(new FileModel() { FileChecksum = item.Value, FilePath = item.Key }); } tempModel.InstallationChecksum = GetCombinedChecksum(tempModel.Files); tempModel.SaveToFile(); return(tempModel); }