示例#1
0
文件: KSP.cs 项目: alibode/CKAN
        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();
        }
示例#2
0
文件: KSP.cs 项目: alibode/CKAN
        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);
            }
        }
示例#3
0
文件: KSP.cs 项目: justvova34/CKAN
        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;
            }
        }