示例#1
0
 public void KillOrigin()
 {
     OriginClose(this, new OriginCloseEventArgs(this.restartOrigin));
     ProcessTools.KillProcess(this.originProcess, true, false);
     ProcessTools.KillProcess("sonarhost", false, false);
     this.closedSafely = true;
 }
示例#2
0
        private static void AddSteam()
        {
            WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            bool             hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);

            if (!hasAdministrativeRight)
            {
                // relaunch the application with admin rights
                string           fileName    = Assembly.GetExecutingAssembly().Location;
                ProcessStartInfo processInfo = new ProcessStartInfo();
                processInfo.Arguments = "addsteam";
                processInfo.Verb      = "runas";
                processInfo.FileName  = fileName;

                try
                {
                    Process.Start(processInfo);
                }
                catch (Win32Exception)
                {
                    // This will be thrown if the user cancels the prompt
                }

                return;
            }
            string quote = "\"";
            string space = " ";

            // Process.Start("taskkill", "/im steam.exe /f").WaitForExit();

            if (ProcessTools.IsProcessRunning("steam"))
            {
                MessageBox.Show("Please close Steam before continuing");
            }
            if (ProcessTools.IsProcessRunning("steam"))
            {
                bool result = MessageBoxUtils.ShowChoiceDialog("Force close Steam? (Not recommended, close Steam manually if possible)", "Close Steam before adding shortcuts to Steam", "Force Close Steam", "I will close Steam manually");
                switch (result)
                {
                case true:
                    ProcessTools.KillProcess("steam", true, false);
                    break;

                case false:
                    ProcessTools.KillProcess("steam", true, true);     //CloseMainWindow shouldn't close steam, use as a lazy shortcut to process.Wait()
                    break;
                }
            }
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Medal of Honor Warfighter" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.MOHW.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 3" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF3.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 4" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF4.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield Hardline Beta" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BFH.exe") + quote).WaitForExit();
        }
示例#3
0
        public void StartOrigin()
        {
            this.originPath = GetOriginPath();
            if (this.originPath == null)
            {
                return;
            }
            var originProcessInfo = new ProcessStartInfo(this.originPath, this.commandLineOptions);

            if (OriginRunning())  //We must relaunch Origin as a child process for Steam to properly apply the overlay hook.
            {
                ProcessTools.KillProcess("Origin", true, false);
                this.restartOrigin = true;
            }
            this.originProcess = Process.Start(originProcessInfo);
            this.ListenForUnexpectedClose();
        }
示例#4
0
 public void EndProcess()
 {
     ProcessTools.KillProcess(processName);
 }