Exemplo n.º 1
0
        public static void RunContextMenuIntegration(string option)
        {
            switch (option)
            {
            case OPT_ADD:
                string fullPath = RuntimeInfo.ExeLocation;

                if (!RuntimeInfo.IsExeInAppFolder)
                {
                    bool v = CliOutput.ReadConfirm("Could not find exe in system path. Add now?");

                    if (v)
                    {
                        RuntimeInfo.Setup();
                        return;
                    }
                }

                // Add command
                string[] commandCode =
                {
                    "@echo off",
                    String.Format("reg.exe add {0} /ve /d \"{1} \"\"%%1\"\"\" /f >nul",
                                  RuntimeInfo.REG_SHELL_CMD, fullPath)
                };

                Cli.CreateRunBatchFile("add_to_menu.bat", commandCode);


                // Add icon
                string[] iconCode =
                {
                    "@echo off",
                    String.Format("reg.exe add {0} /v Icon /d \"{1}\" /f >nul",RuntimeInfo.REG_SHELL, fullPath)
                };

                Cli.CreateRunBatchFile("add_icon_to_menu.bat", iconCode);
                break;

            case OPT_REM:
                // reg delete HKEY_CLASSES_ROOT\*\shell\SmartImage

                // const string DEL = @"reg delete HKEY_CLASSES_ROOT\*\shell\SmartImage";

                string[] code =
                {
                    "@echo off",
                    String.Format(@"reg.exe delete {0} /f >nul", RuntimeInfo.REG_SHELL)
                };

                Cli.CreateRunBatchFile("rem_from_menu.bat", code);
                break;
            }
        }
Exemplo n.º 2
0
            public static void Remove()
            {
                // reg delete HKEY_CLASSES_ROOT\*\shell\SmartImage

                // const string DEL = @"reg delete HKEY_CLASSES_ROOT\*\shell\SmartImage";

                string[] code =
                {
                    "@echo off",
                    String.Format(@"reg.exe delete {0} /f >nul", RuntimeInfo.REG_SHELL)
                };

                Cli.CreateRunBatchFile("rem_from_menu.bat", code);
            }
Exemplo n.º 3
0
            public static void Add()
            {
                string fullPath = RuntimeInfo.ExeLocation;

                if (!RuntimeInfo.IsExeInAppFolder)
                {
                    bool v = CliOutput.ReadConfirm("Could not find exe in system path. Add now?");

                    if (v)
                    {
                        PathCommand.Add();
                        return;
                    }

                    if (fullPath == null)
                    {
                        throw new ApplicationException();
                    }
                }


                // Add command
                string[] commandCode =
                {
                    "@echo off",
                    String.Format("reg.exe add {0} /ve /d \"{1} \"\"%%1\"\"\" /f >nul",RuntimeInfo.REG_SHELL_CMD,
                                  fullPath)
                };

                Cli.CreateRunBatchFile("add_to_menu.bat", commandCode);


                // Add icon
                string[] iconCode =
                {
                    "@echo off",
                    String.Format("reg.exe add {0} /v Icon /d \"{1}\" /f >nul",RuntimeInfo.REG_SHELL,  fullPath),
                };

                Cli.CreateRunBatchFile("add_icon_to_menu.bat", iconCode);
            }