Ejemplo n.º 1
0
 protected override void OnStop()
 {
     if (application != null)
     {
         application.Shutdown();
     }
 }
Ejemplo n.º 2
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);

                    // 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);
            }

        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            PRoConApplication application = null;

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

                    System.Console.WriteLine("PRoCon Frostbite");
                    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);
            }
        }
Ejemplo n.º 5
0
        /*
         * public static void BeginUpdateProcess() {
         *
         *  // Check if the autoupdater needs updating.. if not then we'll forget about it.
         *
         *  string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates");
         *
         *  if (Directory.Exists(strUpdatesFolder) == true) {
         *
         *      int iDeleteChecker = 0;
         *
         *      string strCurrentProconUpdaterPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe");
         *      // Overwrite proconupdater.exe
         *
         *      if (File.Exists(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe")) == true) {
         *
         *          do {
         *              try {
         *                  File.Copy(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"), strCurrentProconUpdaterPath, true);
         *
         *                  File.Delete(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"));
         *              }
         *              catch (Exception) { }
         *
         *              Thread.Sleep(100);
         *              iDeleteChecker++;
         *          } while (File.Exists(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe")) == true && iDeleteChecker < 10);
         *      }
         *
         *      if (File.Exists(strCurrentProconUpdaterPath) == true) {
         *
         *          if (AutoUpdater.m_strArgs.Length == 0) {
         *              System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
         *          }
         *          else {
         *              System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", AutoUpdater.m_strArgs));
         *          }
         *
         *          Application.Exit();
         *      }
         *  }
         * }
         */

        public static void BeginUpdateProcess(PRoConApplication praApplication)
        {
            // Check if the autoupdater needs updating.. if not then we'll forget about it.

            string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates");

            if (Directory.Exists(strUpdatesFolder) == true)
            {
                AssemblyName proconUpdaterAssemblyName           = null;
                AssemblyName proconUpdaterUpdatesDirAssemblyName = null;

                if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe")) == true)
                {
                    proconUpdaterAssemblyName = AssemblyName.GetAssemblyName(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe"));
                }
                if (File.Exists(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates"), "PRoConUpdater.exe")) == true)
                {
                    proconUpdaterUpdatesDirAssemblyName = AssemblyName.GetAssemblyName(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates"), "PRoConUpdater.exe"));
                }

                // If the old updater is.. old =)
                if ((proconUpdaterAssemblyName == null && proconUpdaterUpdatesDirAssemblyName != null) || (proconUpdaterAssemblyName != null && proconUpdaterUpdatesDirAssemblyName != null && proconUpdaterUpdatesDirAssemblyName.Version.CompareTo(proconUpdaterAssemblyName.Version) > 0))
                {
                    //int iDeleteChecker = 0;

                    string strCurrentProconUpdaterPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe");
                    // Overwrite proconupdater.exe

                    //do {
                    //    //if (iDeleteChecker > 0) {
                    //    //    MessageBox.Show("Please close the PRoConUpdater to continue the update process..");
                    //    //}

                    //    try {
                    //        //File.Delete(strCurrentProconUpdaterPath);
                    //    }
                    //    catch (Exception) { }

                    //    Thread.Sleep(100);
                    //    iDeleteChecker++;
                    //} while (File.Exists(strCurrentProconUpdaterPath) == true && iDeleteChecker < 5);

                    try {
                        try {
                            File.Copy(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"), strCurrentProconUpdaterPath, true);
                            File.Delete(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"));
                        }
                        catch (Exception) {
                        }

                        if (Arguments != null && Arguments.Length == 0)
                        {
                            Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                        }
                        else
                        {
                            Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", Arguments));
                        }

                        if (praApplication != null)
                        {
                            praApplication.Shutdown();
                        }

                        System.Windows.Forms.Application.Exit();
                    }
                    catch (Exception) {
                    }
                }
                else
                {
                    // Same or newer version, we're running with the same autoupdater.exe
                    if (Arguments != null && Arguments.Length == 0)
                    {
                        Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                    }
                    else
                    {
                        Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", Arguments));
                    }

                    if (praApplication != null)
                    {
                        praApplication.Shutdown();
                    }

                    //System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                    System.Windows.Forms.Application.Exit();
                }
            }
        }
Ejemplo n.º 6
0
        /*
        public static void BeginUpdateProcess() {

            // Check if the autoupdater needs updating.. if not then we'll forget about it.

            string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates");

            if (Directory.Exists(strUpdatesFolder) == true) {

                int iDeleteChecker = 0;

                string strCurrentProconUpdaterPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe");
                // Overwrite proconupdater.exe

                if (File.Exists(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe")) == true) {

                    do {
                        try {
                            File.Copy(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"), strCurrentProconUpdaterPath, true);

                            File.Delete(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"));
                        }
                        catch (Exception) { }

                        Thread.Sleep(100);
                        iDeleteChecker++;
                    } while (File.Exists(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe")) == true && iDeleteChecker < 10);
                }

                if (File.Exists(strCurrentProconUpdaterPath) == true) {

                    if (AutoUpdater.m_strArgs.Length == 0) {
                        System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                    }
                    else {
                        System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", AutoUpdater.m_strArgs));
                    }

                    Application.Exit();
                }
            }
        }
        */

        public static void BeginUpdateProcess(PRoConApplication praApplication) {

            // Check if the autoupdater needs updating.. if not then we'll forget about it.

            string strUpdatesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates");

            if (Directory.Exists(strUpdatesFolder) == true) {
                AssemblyName proconUpdaterAssemblyName = null;
                AssemblyName proconUpdaterUpdatesDirAssemblyName = null;

                if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe")) == true) {
                    proconUpdaterAssemblyName = AssemblyName.GetAssemblyName(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe"));
                }
                if (File.Exists(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates"), "PRoConUpdater.exe")) == true) {
                    proconUpdaterUpdatesDirAssemblyName = AssemblyName.GetAssemblyName(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates"), "PRoConUpdater.exe"));
                }

                // If the old updater is.. old =)
                if ((proconUpdaterAssemblyName == null && proconUpdaterUpdatesDirAssemblyName != null) || (proconUpdaterAssemblyName != null && proconUpdaterUpdatesDirAssemblyName != null && proconUpdaterUpdatesDirAssemblyName.Version.CompareTo(proconUpdaterAssemblyName.Version) > 0)) {
                    //int iDeleteChecker = 0;

                    string strCurrentProconUpdaterPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PRoConUpdater.exe");
                    // Overwrite proconupdater.exe

                    //do {
                    //    //if (iDeleteChecker > 0) {
                    //    //    MessageBox.Show("Please close the PRoConUpdater to continue the update process..");
                    //    //}

                    //    try {
                    //        //File.Delete(strCurrentProconUpdaterPath);
                    //    }
                    //    catch (Exception) { }

                    //    Thread.Sleep(100);
                    //    iDeleteChecker++;
                    //} while (File.Exists(strCurrentProconUpdaterPath) == true && iDeleteChecker < 5);

                    try {
                        try {
                            File.Copy(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"), strCurrentProconUpdaterPath, true);
                            File.Delete(Path.Combine(strUpdatesFolder, "PRoConUpdater.exe"));
                        }
                        catch (Exception) { }

                        if (AutoUpdater.m_strArgs != null && AutoUpdater.m_strArgs.Length == 0) {
                            System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                        }
                        else {
                            System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", AutoUpdater.m_strArgs));
                        }

                        if (praApplication != null) {
                            praApplication.Shutdown();
                        }

                        Application.Exit();
                    }
                    catch (Exception) { }

                }
                else {
                    // Same or newer version, we're running with the same autoupdater.exe
                    if (AutoUpdater.m_strArgs != null && AutoUpdater.m_strArgs.Length == 0) {
                        System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                    }
                    else {
                        System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe", String.Join(" ", AutoUpdater.m_strArgs));
                    }

                    if (praApplication != null) {
                        praApplication.Shutdown();
                    }

                    //System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "PRoConUpdater.exe");
                    Application.Exit();
                }
            }
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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 for mono");
                    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 ctrl-c to shutdown)");
					
					UnixSignal [] signals = new UnixSignal[] { 
						new UnixSignal(Signum.SIGINT), 
						new UnixSignal(Signum.SIGTERM), 
					};
			
					// Wait for a unix signal
                    for (bool exit = false; !exit; )
                    {
                        try
                        {

                            int id = UnixSignal.WaitAny(signals);

                            if (id >= 0 && id < signals.Length)
                            {
                                if (signals[id].IsSet) exit = true;
                            }
                        }
                        catch (Exception e)
                        {
                            FrostbiteConnection.LogError("PRoCon.Console.exe", "", e);
                        }
                    }
                }
                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);
            }

        }