Пример #1
0
        private void SetDefaultValues()
        {
            m_Settings = new ProgramSettings.ProgramSettings()
            {
                AdminEmail            = "*****@*****.**",
                BaseUltimaDownloadUri = "http://ultima-dm.pl/dmr.zip",
                FacebookLink          = "https://www.facebook.com/Dream-Masters-Revolution-141490746505209/",
                ServerInformationUri  = "http://ultima-dm.pl/server.json",
                ShardName             = "Dream Masters: Revolution",
                Version     = 2,
                WebsiteLink = "http://ultima-dm.pl",
                WindowTitle = $"UOLoader for Dream Masters: Revolution",
                UltimaPath  = RegistryChecker.RegistryChecker.GetUoPath()
            };

            // Not using WriteSettings in order to be able to throw exceptions. May not be the cleanest way of doing things.
            var jsonContents = JsonConvert.SerializeObject(m_Settings);

            try {
                File.WriteAllText(m_ConfigFile, jsonContents);
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Пример #2
0
        private void LoadValuesFromConfig()
        {
            var jsonContents = File.ReadAllText(m_ConfigFile);

            if (String.IsNullOrEmpty(jsonContents))
            {
                SetDefaultValues();
                return;
            }

            m_Settings = JsonConvert.DeserializeObject <ProgramSettings.ProgramSettings>(jsonContents);
        }