public void GetValue() { SetupWithOverrides(); Expect(config.GetValue("key"), EqualTo("value")); Expect(config.GetValue("key2"), EqualTo("value2")); Expect(config.GetValue("key3"), EqualTo("value3")); Expect(config.GetValue("complex key"), EqualTo("complex value")); Expect(config.GetValue("case insensitive key"), EqualTo("Case Sensitive Value")); Expect(config.GetValue("key to be overriden"), EqualTo("overriden value")); }
private void MainForm_Load(object sender, System.EventArgs e) { HideHostWindow(); var assemblyDir = Path.GetDirectoryName(this.GetType().Assembly.Location); if (assemblyDir == null) { throw new NullReferenceException("assemblyDir is null"); } string configFileName = "debug.cfg"; #if WA3STABLE configFileName = "wa3-stable.cfg"; #endif #if WALITESTABLE configFileName = "walite-stable.cfg"; #endif var settingsFile = Path.Combine(assemblyDir, configFileName); IConfig localSettings = new FileSimpleConfig(settingsFile); this.Text = localSettings.GetValue("AppName") + " Launcher"; var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var rootDir = Path.Combine(localAppData, "AldursLab", localSettings.GetValue("AldursLabDirName")); var config = new ControllerConfig() { RootDirFullPath = rootDir, WebServiceRootUrl = localSettings.GetValue("WebServiceRootUrl"), WurmAssistantExeFileName = localSettings.GetValue("WurmAssistantExeFileName") }; IDebug debug = new TextDebug(Path.Combine(config.RootDirFullPath, "Launcher", "debug.txt")); debug.Clear(); var controller = new LaunchController(this, config, debug); controller.Execute(); }
public void ReadsOverridesFromDifferentLocation() { using (DirectoryHandle tempDir1 = TempDirectoriesFactory.CreateEmpty()) { using (DirectoryHandle tempDir2 = TempDirectoriesFactory.CreateEmpty()) { var localCfgPath = Path.Combine(tempDir1.AbsolutePath, "config.cfg"); var localCfgUsrPath = Path.Combine(tempDir2.AbsolutePath, "config.cfg.usr"); File.WriteAllText(localCfgPath, SampleConfig); File.WriteAllText(localCfgUsrPath, OverrideConfig); FileSimpleConfig localConfig = new FileSimpleConfig(localCfgPath, localCfgUsrPath); Expect(localConfig.HasValue("key to be overriden")); Expect(localConfig.GetValue("key to be overriden"), EqualTo("overriden value")); } } }