public LaunchController(IGuiHost host, ControllerConfig config, [NotNull] IDebug debug) { if (host == null) throw new ArgumentNullException("host"); this.host = host; if (config == null) throw new ArgumentNullException("config"); if (debug == null) throw new ArgumentNullException("debug"); this.config = config; this.debug = debug; var updaterGui = new UpdaterGui(host, debug); host.SetContent(updaterGui); gui = updaterGui; }
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(); }