private void SaveCompatibleVersions() { CompatibleKspVersionsDto compatibleKspVersionsDto = new CompatibleKspVersionsDto(); compatibleKspVersionsDto.VersionOfKspWhenWritten = Version().ToString(); compatibleKspVersionsDto.CompatibleKspVersions = _compatibleVersions.Select(v => v.ToString()).ToList(); String json = JsonConvert.SerializeObject(compatibleKspVersionsDto); File.WriteAllText(CompatibleKspVersionsFile(), json); this.VersionOfKspWhenCompatibleVersionsWereStored = Version(); }
private void LoadCompatibleVersions() { String path = CompatibleKspVersionsFile(); if (File.Exists(path)) { string json = File.ReadAllText(path); CompatibleKspVersionsDto compatibleKspVersionsDto = JsonConvert.DeserializeObject <CompatibleKspVersionsDto>(json); _compatibleVersions = compatibleKspVersionsDto.CompatibleKspVersions.Select(v => KspVersion.Parse(v)).ToList(); this.VersionOfKspWhenCompatibleVersionsWereStored = KspVersion.Parse(compatibleKspVersionsDto.VersionOfKspWhenWritten); } }
private void LoadCompatibleVersions() { String path = CompatibleKspVersionsFile(); if (File.Exists(path)) { string json = File.ReadAllText(path); CompatibleKspVersionsDto compatibleKspVersionsDto = JsonConvert.DeserializeObject <CompatibleKspVersionsDto>(json); _compatibleVersions = compatibleKspVersionsDto.CompatibleKspVersions.Select(v => KspVersion.Parse(v)).ToList(); // Get version without throwing exceptions for null KspVersion mainVer = null; KspVersion.TryParse(compatibleKspVersionsDto.VersionOfKspWhenWritten, out mainVer); this.VersionOfKspWhenCompatibleVersionsWereStored = mainVer; } }