static public void StartConfig() { //Debug.Assert(false); try { SplashScreen.ShowSplash(); string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1 && (args[1].ToLower() == "/u" || args[1].ToLower() == "-u")) { //forced uninstall if (Environment.GetEnvironmentVariable("CSSCRIPT_DIR") == null) { MessageBox.Show("Cannot perform uninstall operation.\nCS-Script is not currently installed.", "CS-Script Configuration"); } else { CSScriptInstaller.UnInstall(); } } else { string rootDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); #if DEBUG if (Environment.GetEnvironmentVariable("CSSCRIPT_DIR") != null) { rootDir = Environment.GetEnvironmentVariable("CSSCRIPT_DIR"); } #endif string csws = Path.Combine(rootDir, "csws.exe"); string configScript = Path.Combine(rootDir, @"lib\config.cs"); args = new string[2]; args[0] = "/dbg"; args[1] = configScript; AppDomain.CurrentDomain.ExecuteAssembly(Path.Combine(rootDir, @"csws.exe"), args); //Cannot use process as it will start CLR specified in csws.exe.config //but it is required to start ConfigConsole under the highest CLR available //Process.Start(csws, "\"" + configScript + "\""); } } catch (UnauthorizedAccessException e) { MessageBox.Show(e.Message, "CS-Script Configuration"); } catch (Exception e) { MessageBox.Show(e.ToString(), "CS-Script Configuration"); } }
static void Main(string[] args) { Execution.DesignMode = false; Execution.LaunchStart = DateTime.Now; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SplashScreen.ShowSplash(Properties.Resources.Splash1, new Rectangle(495, 115, 275, 80)); CheckAlreadyLaunched(); DebugChecks(); Update(); CheckIP(); SplashScreen.SetMessage("Initialisation\nConnexions...", Color.Black); SplashScreen.SetImage(Properties.Resources.Splash1); ThreadManager.Init(); Connections.Init(); SplashScreen.SetMessage("Initialisation\nConfig...", Color.Black); SplashScreen.SetImage(Properties.Resources.Splash2); Config.Load(); SplashScreen.SetMessage("Initialisation\nDevices...", Color.Black); SplashScreen.SetImage(Properties.Resources.Splash3); AllDevices.Init(); Actionneur.Init(); SuiviBalise.Init(); SplashScreen.SetMessage("Initialisation\nRobot...", Color.Black); Robots.Init(); Recalibration.Init(); SplashScreen.SetMessage("Initialisation\nPlateau...", Color.Black); Dessinateur.Init(); GameBoard.Init(); SplashScreen.SetMessage("Initialisation\nLogs...", Color.Black); SplashScreen.SetImage(Properties.Resources.Splash4); Logs.Logs.Init(); SplashScreen.SetMessage("Initialisation\nInterface...", Color.Black); SplashScreen.SetImage(Properties.Resources.Splash5); Application.Run(new FenGoBot(args)); }