public DebugPlugin() { debug_actions = new DebugPluginActionGroup(this); debug_window = new DebugWindow(this); }
/// <summary> /// Creates a new RunManager instance /// </summary> /// <param name="args">Commandline parameters</param> public RunManager(string[] args) { _doRun = true; InstallMultiplexer(); #if DEBUG ShowConsole(); Thread.CurrentThread.Name = "Main"; ThreadHelper.Track(Thread.CurrentThread); #endif _opts = new Opts(); _files = new FileManager(this); var test = _files.GetDir(""); _commands = new Commands.Executor(this); _abortOnExit = new ManualResetEvent(false); _notifyHandlers = new List<ValueChangedHandler>(); foreach (var arg in args) { switch(arg.Substring(0,1)) { case "-": var argparts = arg.Substring(1).Split(new[] {"="}, StringSplitOptions.None); switch ( argparts[0].ToLower() ) { case "runmode": #region RunmodeSelector RunMode runMode = RunMode.Play; if (argparts.Length < 2) { Console.WriteLine("[Warning] No runmode supplied!"); break; } switch (argparts[1]) { case "select": var selectForm = new Form(); selectForm.Text = "Select Runmode"; selectForm.FormBorderStyle = FormBorderStyle.FixedToolWindow; selectForm.Size = new Size(330, 75); selectForm.StartPosition = FormStartPosition.CenterScreen; selectForm.Controls.Add(new Button() { Text = "Game", Location = new Point(5, 3), Size = new Size(75, 44) }); selectForm.Controls.Add(new Button() { Text = "Editor", Location = new Point(84, 3), Size = new Size(75, 44) }); selectForm.Controls.Add(new Button() { Text = "Server", Location = new Point(163, 3), Size = new Size(75, 44) }); selectForm.Controls.Add(new Button() { Text = "Collab Server", Location = new Point(242, 3), Size = new Size(75, 44) }); selectForm.Controls[0].Click += delegate { runMode = RunMode.Play; selectForm.Close(); }; selectForm.Controls[1].Click += delegate { runMode = RunMode.Edit; selectForm.Close(); }; selectForm.Controls[2].Click += delegate { runMode = RunMode.GameServer; selectForm.Close(); }; selectForm.Controls[3].Click += delegate { runMode = RunMode.CollabServer; selectForm.Close(); }; selectForm.Show(); selectForm.Focus(); Application.Run(selectForm); break; case "game": runMode = RunMode.Play; break; case "gameserver": runMode = RunMode.ServerPlay; break; case "edit": case "editor": runMode = RunMode.Edit; break; case "server": runMode = RunMode.GameServer; break; case "collabserver": case "editserver": runMode = RunMode.CollabServer; break; case "aioserver": runMode = RunMode.AIOServer; break; default: Console.WriteLine("[Warning] Unknown runMode: '"+argparts[0]+"'"); break; } Opts.Set("sys_runMode", runMode); #endregion break; case "console": #region ConsoleSection #if !DEBUG ShowConsole(); #else Console.WriteLine("[Info] Commandline-parameter '-console' given, ignoring..."); #endif #endregion break; } break; case "+": if (arg.Length < 2) continue; _commands.Parse(arg.Substring(1)); break; } } ((Options.Options)_opts).LockDownReadonly(); _views = new List<Base.Abstract.View>(); #if DEBUG ThreadHelper.Start(delegate { var dbgWnd = new DebugWindow(this); Application.Run(dbgWnd); }, "Dbg_Wnd"); #endif Console.ForegroundColor = _opts.Get<ConsoleColor>("gui_consoleColor"); _notifyHandlers.Add(_opts.RegisterChangeNotification("gui_consoleColor", delegate(string key, object value) { Console.ForegroundColor = (ConsoleColor)value; })); }