Battlelogium.Installer.InstallerCommon.KillBattlelogium C# (CSharp) Method

KillBattlelogium() public static method

public static KillBattlelogium ( ) : void
return void
        public static void KillBattlelogium()
        {
            Process.Start(new ProcessStartInfo()
            {
                FileName = "taskkill",
                Arguments = "/im Battlelogium.UI.BF3.exe /f",
                CreateNoWindow = true,
                WindowStyle = ProcessWindowStyle.Hidden
            }).WaitForExit();
            Process.Start(new ProcessStartInfo()
            {
                FileName = "taskkill",
                Arguments = "/im Battlelogium.UI.BF4.exe /f",
                CreateNoWindow = true,
                WindowStyle = ProcessWindowStyle.Hidden
            }).WaitForExit();
            Process.Start(new ProcessStartInfo()
            {
                FileName = "taskkill",
                Arguments = "/im Battlelogium.UI.BFH.exe /f",
                CreateNoWindow = true,
                WindowStyle = ProcessWindowStyle.Hidden
            }).WaitForExit();
            Process.Start(new ProcessStartInfo()
            {
                FileName = "taskkill",
                Arguments = "/im Battlelogium.UI.MOHW.exe /f",
                CreateNoWindow = true,
                WindowStyle = ProcessWindowStyle.Hidden
            }).WaitForExit();
        }

Usage Example

示例#1
0
        private async void Application_Startup(object sender, StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += (s, unhandledevent) =>
            {
                this.Shutdown(1);
            };
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length == 1)
            {
                new UIInstaller().Show();
                return;
            }
            if (args[1] == "update")
            {
                if (args.Length == 2)
                {
                    MessageBox.Show("No update path provided");
                    this.Shutdown();
                }

                InstallerCommon.KillBattlelogium();
                string path = args[2];
                string url  = await InstallerCommon.GetDownload("battlelogium");

                var updater = new BattlelogiumInstaller(url, path);
                updater.BeginUpdate();
                return;
            }
            if (args[1] == "uninstall")
            {
                if (File.Exists("filelist"))
                {
                    InstallerCommon.KillBattlelogium();
                    new UIUninstaller().Show();
                    return;
                }
                MessageBox.Show("filelist not found, Uninstall is unable to continue");
                this.Shutdown();
                return;
            }
            return;
        }