Example #1
0
        static void Main(string[] args)
        {
            PRoConApplication application = null;

            if (PRoConApplication.IsProcessOpen() == false)
            {
                try {
                    application = new PRoConApplication(true, args);

                    // Note: The license states usage data must be enabled for procon.console.exe support
                    application.OptionsSettings.AllowAnonymousUsageData = true;

                    System.Console.WriteLine("Procon Frostbite");
                    System.Console.WriteLine("================");
                    System.Console.WriteLine("By executing this application you agree to the license available at:");
                    System.Console.WriteLine("\thttp://myrcon.com/licenses/myrcon.pdf");
                    System.Console.WriteLine("If you do not agree you must immediately exit this application.");
                    System.Console.WriteLine("================");
                    System.Console.WriteLine("This is a cut down version of PRoCon.exe to be used by GSPs and PRoCon Hosts.");
                    System.Console.WriteLine("Executing this file is the same as \"PRoCon.exe -console 1\"");
                    System.Console.WriteLine("No output is given.  This is as cut down as we're gunno get..");
                    System.Console.WriteLine("\nExecuting procon...");
                    application.Execute();

                    GC.Collect();
                    System.Console.WriteLine("Running... (Press any key to shutdown)");
                    System.Console.ReadKey();
                }
                catch (Exception e) {
                    FrostbiteConnection.LogError("PRoCon.Console.exe", "", e);
                }
                finally {
                    if (application != null)
                    {
                        application.Shutdown();
                    }
                }
            }
            else
            {
                // Possible prevention of a cpu consumption bug I can see at the time of writing.
                // TCAdmin: Start procon.exe
                // procon.exe has an update to install
                // procon.exe loads proconupdater.exe
                // procon.exe unloads
                // proconupdater.exe begins update
                // TCAdmin detects procon.exe shutdown - attempts to reload
                System.Console.WriteLine("Already running - shutting down");
                Thread.Sleep(50);
            }
        }
Example #2
0
 protected override void OnStart(string[] args)
 {
     //Setting the Evironment back to the Basedirectory
     //because Windows changes it to c://windows/system32 when running as service.
     Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
     System.Console.WriteLine(Environment.CurrentDirectory);
     if (PRoConApplication.IsProcessOpen() == false)
     {
         try
         {
             application = new PRoConApplication(true, args);
             // Note: The license states usage data must be enabled for procon.console.exe support
             application.OptionsSettings.AllowAnonymousUsageData = true;
             application.Execute();
             GC.Collect();
         }
         catch (Exception e)
         {
             FrostbiteConnection.LogError("PRoCon.Service.exe", "", e);
         }
     }
 }
Example #3
0
        protected override void OnStart(string[] args)
        {
            //Setting the Evironment back to the Basedirectory
            //because Windows changes it to c://windows/system32 when running as service.
            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            System.Console.WriteLine(Environment.CurrentDirectory);

            int iValue;

            if (args != null && args.Length >= 2)
            {
                for (int i = 0; i < args.Length; i = i + 2)
                {
                    if (String.Compare("-use_core", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue > 0)
                    {
                        System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)iValue;
                    }
                }
            }

            if (PRoConApplication.IsProcessOpen() == false)
            {
                try
                {
                    application = new PRoConApplication(true, args);
                    // Note: The license states usage data must be enabled for procon.console.exe support
                    //application.OptionsSettings.AllowAnonymousUsageData = true;
                    application.Execute();
                    GC.Collect();
                }
                catch (Exception e)
                {
                    FrostbiteConnection.LogError("PRoCon.Service.exe", "", e);
                }
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            Program.Args = args;

            bool dotNetCheck = CheckNetVersion("3.5");

            if (PRoConApplication.IsProcessOpen() == false && dotNetCheck == true)
            {
                if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates")) == true)
                {
                    AutoUpdater.Arguments = args;
                    AutoUpdater.BeginUpdateProcess(null);
                }
                else
                {
                    try
                    {
                        bool isBasicConsole = false;
                        bool isGspUpdater   = false;

                        if (args != null && args.Length >= 2)
                        {
                            for (int i = 0; i < args.Length; i = i + 2)
                            {
                                int value;

                                if (String.Compare("-console", args[i], System.StringComparison.OrdinalIgnoreCase) == 0 && int.TryParse(args[i + 1], out value) == true && value == 1)
                                {
                                    isBasicConsole = true;
                                }
                                if (String.Compare("-gspupdater", args[i], System.StringComparison.OrdinalIgnoreCase) == 0 && int.TryParse(args[i + 1], out value) == true && value == 1)
                                {
                                    isGspUpdater = true;
                                }
                                if (String.Compare("-use_core", args[i], System.StringComparison.OrdinalIgnoreCase) == 0 && int.TryParse(args[i + 1], out value) == true && value > 0)
                                {
                                    System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)value;
                                }
                            }
                        }

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        if (isGspUpdater == true)
                        {
                            Application.Run(new GspUpdater());
                        }
                        else
                        {
                            if (isBasicConsole == true)
                            {
                                BasicConsole basicWindow = new BasicConsole();
                                basicWindow.WindowLoaded += new BasicConsole.WindowLoadedHandler(procon_WindowLoaded);

                                Application.Run(basicWindow);
                            }
                            else
                            {
                                frmMain mainWindow = new frmMain(args);
                                mainWindow.WindowLoaded += new frmMain.WindowLoadedHandler(procon_WindowLoaded);
                                Application.Run(mainWindow);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        FrostbiteConnection.LogError("Application error", String.Empty, e);
                        MessageBox.Show("Procon ran into a critical error, but hopefully it logged that error in DEBUG.txt. Please post this to the forums at https://myrcon.net/");
                    }
                    finally
                    {
                        if (Program.ProconApplication != null)
                        {
                            Program.ProconApplication.Shutdown();
                        }
                    }
                }
            }
            else
            {
                // Possible prevention of a cpu consumption bug I can see at the time of writing.
                // TCAdmin: Start procon.exe
                // procon.exe has an update to install
                // procon.exe loads proconupdater.exe
                // procon.exe unloads
                // proconupdater.exe begins update
                // TCAdmin detects procon.exe shutdown - attempts to reload
                Thread.Sleep(50);
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            int iValue;

            if (args != null && args.Length >= 2)
            {
                for (int i = 0; i < args.Length; i = i + 2)
                {
                    if (String.Compare("-use_core", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue > 0)
                    {
                        System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)iValue;
                    }
                }
            }

            PRoConApplication application = null;

            if (PRoConApplication.IsProcessOpen() == false)
            {
                try
                {
                    application = new PRoConApplication(true, args);

                    System.Console.WriteLine("Procon Frostbite");
                    System.Console.WriteLine("================");
                    System.Console.WriteLine("By executing this application you agree to the license available at:");
                    System.Console.WriteLine("\thttps://myrcon.net/licenses/myrcon.pdf");
                    System.Console.WriteLine("If you do not agree you must immediately exit this application.");
                    System.Console.WriteLine("================");
                    System.Console.WriteLine("This is a cut down version of PRoCon.exe to be used by GSPs and PRoCon Hosts.");
                    System.Console.WriteLine("Executing this file is the same as \"PRoCon.exe -console 1\"");
                    System.Console.WriteLine("No output is given.  This is as cut down as we're gunno get..");
                    System.Console.WriteLine("\nExecuting procon...");
                    application.Execute();

                    GC.Collect();
                    System.Console.WriteLine("Running... (Press any key to shutdown)");
                    System.Console.ReadKey();
                }
                catch (Exception e)
                {
                    FrostbiteConnection.LogError("PRoCon.Console.exe", "", e);
                }
                finally
                {
                    if (application != null)
                    {
                        application.Shutdown();
                    }
                }
            }
            else
            {
                // Possible prevention of a cpu consumption bug I can see at the time of writing.
                // TCAdmin: Start procon.exe
                // procon.exe has an update to install
                // procon.exe loads proconupdater.exe
                // procon.exe unloads
                // proconupdater.exe begins update
                // TCAdmin detects procon.exe shutdown - attempts to reload
                System.Console.WriteLine("Already running - shutting down");
                Thread.Sleep(50);
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            Program.m_Args = args;

            if (PRoConApplication.IsProcessOpen() == false)
            {
                if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates")) == true)
                {
                    AutoUpdater.m_strArgs = args;
                    AutoUpdater.BeginUpdateProcess(null);
                }
                else
                {
                    //PRoConApplication paProcon = null;

                    try {
                        bool blBasicConsole = false;
                        bool blGspUpdater   = false;

                        int iValue;
                        if (args != null && args.Length >= 2)
                        {
                            for (int i = 0; i < args.Length; i = i + 2)
                            {
                                if (String.Compare("-console", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue == 1)
                                {
                                    blBasicConsole = true;
                                }
                                if (String.Compare("-gspupdater", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue == 1)
                                {
                                    blGspUpdater = true;
                                }
                            }
                        }

                        //Thread.Sleep(5000);
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        if (blGspUpdater == true)
                        {
                            Application.Run(new GspUpdater());
                        }
                        else
                        {
                            if (blBasicConsole == true)
                            {
                                BasicConsole basicWindow = new BasicConsole();
                                basicWindow.WindowLoaded += new BasicConsole.WindowLoadedHandler(procon_WindowLoaded);

                                Application.Run(basicWindow);
                            }
                            else
                            {
                                frmMain mainWindow = new frmMain(args);
                                mainWindow.WindowLoaded += new frmMain.WindowLoadedHandler(procon_WindowLoaded);
                                Application.Run(mainWindow);
                            }
                        }
                    }
                    catch (Exception e) {
                        FrostbiteConnection.LogError("Application error", String.Empty, e);
                        MessageBox.Show("PRoCon ran into a critical error, but hopefully it logged that error in DEBUG.txt.  Please post/pm/email this to phogue at www.phogue.net.");
                    }
                    finally {
                        if (Program.m_application != null)
                        {
                            Program.m_application.Shutdown();
                        }
                    }
                }
            }
            else
            {
                // Possible prevention of a cpu consumption bug I can see at the time of writing.
                // TCAdmin: Start procon.exe
                // procon.exe has an update to install
                // procon.exe loads proconupdater.exe
                // procon.exe unloads
                // proconupdater.exe begins update
                // TCAdmin detects procon.exe shutdown - attempts to reload
                Thread.Sleep(50);
            }
        }