public void WriteReadSystemConfig() { string path = Path.Combine(TestFolder, "SystemConfig.xml"); // Write ---------------------------------------------------------- { ISharedDictionary dic = SharedDictionary.Create(null); IConfigManagerExtended config = ConfigurationManager.Create(dic); Assert.That(config.ConfigManager.SystemConfiguration != null); config.HostSystemConfig["key1"] = "value1"; config.HostSystemConfig["key2"] = "value2"; config.HostSystemConfig["key3"] = "value3"; config.HostSystemConfig["{12A9FCC0-ECDC-4049-8DBF-8961E49A9EDE}"] = true; Assert.That(config.IsSystemConfigDirty); Assert.That(config.IsUserConfigDirty, Is.False); using (Stream wrt = new FileStream(path, FileMode.Create)) using (IStructuredWriter sw = SimpleStructuredWriter.CreateWriter(wrt, null)) { config.SaveSystemConfig(sw); } } TestBase.DumpFileToConsole(path); // Read ------------------------------------------------------------ { ISharedDictionary dic = SharedDictionary.Create(null); IConfigManagerExtended config = new ConfigManagerImpl(dic); using (Stream str = new FileStream(path, FileMode.Open)) using (IStructuredReader sr = SimpleStructuredReader.CreateReader(str, null)) { config.LoadSystemConfig(sr); } Assert.That(config.HostSystemConfig["key1"], Is.EqualTo("value1")); Assert.That(config.HostSystemConfig["key2"], Is.EqualTo("value2")); Assert.That(config.HostSystemConfig["key3"], Is.EqualTo("value3")); Assert.That(config.HostSystemConfig["{12A9FCC0-ECDC-4049-8DBF-8961E49A9EDE}"], Is.EqualTo(true)); } }
private RemoteConfigProvider() { configManager = new ConfigManagerImpl("gamesim", "", "RemoteConfigGS.json", "RemoteConfigHeadersGS.json"); }