当前位置: 首页>>代码示例>>C#>>正文


C# Command.ContainsCommandArg方法代码示例

本文整理汇总了C#中Command.ContainsCommandArg方法的典型用法代码示例。如果您正苦于以下问题:C# Command.ContainsCommandArg方法的具体用法?C# Command.ContainsCommandArg怎么用?C# Command.ContainsCommandArg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Command的用法示例。


在下文中一共展示了Command.ContainsCommandArg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunProperMode

        public static void RunProperMode(Command command)
        {
            if (command.ContainsCommandArg("/Uninstall")) { // Are we in uninstall-mode?
                UninstallHelper uninstallHelper = new UninstallHelper();
                uninstallHelper.RunUninstall();
            } else if (command.ContainsCommandArg("-silentinstall")) {
                Globals.InPortableMode = command["-portable"].ToBool();
                Globals.IsSilentInstall = true;
                NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "www.pmuniverse.net-installer", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);
                pipeClient.Connect();
                Pipes.StreamString clientStream = new Pipes.StreamString(pipeClient);
                Globals.SilentInstallCommunicationPipeStream = clientStream;
                Globals.SilentInstallCommunicationPipe = pipeClient;
                installWaitEvent = new ManualResetEvent(false);
                Installer installer = new Installer(command);
                installer.InstallComplete += new EventHandler(installer_InstallComplete);
                installer.Install(clientStream);

                installWaitEvent.WaitOne();

                clientStream.WriteString("[InstallComplete]");

                pipeClient.WaitForPipeDrain();
                pipeClient.Close();

                System.Environment.Exit(0);
            } else {
                // There are no special command line arguments, run the installer in install mode
                // Let's check if we elevated ourselves
                if (!Globals.CommandLine.ContainsCommandArg("/skipwelcome") || !VistaSecurity.IsAdmin()) {
                    // Show the welcome page
                    PageManager.ActivePage = new Pages.pgeWelcome();
                } else {
                    // Show the license page
                    PageManager.ActivePage = new Pages.pgeLicense();
                }
            }
        }
开发者ID:ChaotixBluix,项目名称:Installer,代码行数:38,代码来源:MaintenanceHelper.cs

示例2: RunMaintenanceMode

        static void RunMaintenanceMode(Command command)
        {
            if (command.ContainsCommandArg("-installskin")) {
                // We are trying to install a new skin
                string skinPackagePath = command["-installskin"];
                if (!string.IsNullOrEmpty(skinPackagePath) && File.Exists(skinPackagePath)) {
                    bool installed = Skins.SkinManager.InstallSkin(skinPackagePath);
                    if (installed) {
                        System.Windows.Forms.MessageBox.Show("The skin has been installed!", "Installation completed!");
                    } else {
                        System.Windows.Forms.MessageBox.Show("The selected file is not a valid skin package.", "Invalid Package");
                    }
                }
            } else if (command.ContainsCommandArg("-createfileassociations")) {
                // Create associations for the skin loader
                RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey(".pmuskn");
                RegKey.SetValue("", "PMU.Skin.Loader");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMU.Skin.Loader");
                RegKey.SetValue("", "Pokémon Mystery Universe Skin Package");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMU.Skin.Loader" + "\\DefaultIcon");
                RegKey.SetValue("", @"C:\Program Files\Pokemon Mystery Universe\Client\pmuicon.ico" + "," + "0");
                RegKey.Close();

                RegKey = Registry.ClassesRoot.CreateSubKey("PMU.Skin.Loader" + "\\" + "Shell" + "\\" + "Open");
                RegKey = RegKey.CreateSubKey("Command");
                RegKey.SetValue("", "\"" + PMU.Core.Environment.StartupPath + "\" -installskin \"%1\"");
                RegKey.Close();
            }
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:33,代码来源:Loader.cs

示例3: IsRunningUnderMaintenanceMode

        static bool IsRunningUnderMaintenanceMode(Command command)
        {
            if (command.ContainsCommandArg("-installskin")) {
                return true;
            } else if (command.ContainsCommandArg("-createfileassociations")) {
                return true;
            }

            return false;
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:10,代码来源:Loader.cs


注:本文中的Command.ContainsCommandArg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。