public CMD(EnvDTE.Command cmd)
 {
     GLOBAL.Dispatcher.VerifyAccess();
     GUID = cmd.Guid;
     ID   = cmd.ID;
 }
Esempio n. 2
0
 public CommandNodeFactory(Command command)
 {
     _command = command;
 }
 private void StartDefaultDebugger()
 {
     if (defaultDebugStart == null) {
         try {
             defaultDebugStart = applicationObject.Commands.Item("Debug.Start");
         } catch { }
     }
     if (defaultDebugStart != null && defaultDebugStart.IsAvailable)
         applicationObject.ExecuteCommand(defaultDebugStart.Name);
 }
 public CommandExecuteEventArg(string guid, int id, object customIn, object customOut, ref bool cancelDefault, EnvDTE.Command command)
 {
     this.Guid         = guid;
     this.ID           = id;
     this.CustomIn     = customIn;
     this.CustomOut    = customOut;
     this.ShouldCancel = cancelDefault;
     this.Command      = command;
 }
 public CommandExecuteEventArg(string guid, int id, object customIn, object customOut, EnvDTE.Command command)
 {
     this.Guid      = guid;
     this.ID        = id;
     this.CustomIn  = customIn;
     this.CustomOut = customOut;
     this.Command   = command;
 }
Esempio n. 6
0
        public static void Main()
        {
            string  outputFile = @"D:\shortcuts.txt";
            Process proc;

#if VSを起動してアタッチ
            string vs2017 = @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe";
            var    proc   = Process.Start(vs2017);
            proc.WaitForInputIdle();
            while (string.IsNullOrEmpty(proc.MainWindowTitle))
            {
                Thread.Sleep(10);
                proc = Process.GetProcessById(proc.Id);
            }
#else
            // 現在デバッグ実行している VS にアタッチ
            proc = Process.GetProcessesByName("devenv").FirstOrDefault();
#endif
            WindowsAppFriend app = new WindowsAppFriend(proc);
            app.LoadAssembly(typeof(Program).Assembly);

            // https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.package.getglobalservice
            AppVar obj = app.Type().Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(EnvDTE._DTE));

            using (var sw = File.CreateText(outputFile))
            {
                sw.WriteLine("Guid\tID\tName\tLocalizedName\t#\tShortcut");
                Console.Clear();

                // https://docs.microsoft.com/en-us/dotnet/api/envdte80.dte2
                // https://docs.microsoft.com/en-us/dotnet/api/envdte80.dte2.commands
                EnvDTE80.DTE2   dte2     = obj.Pin <EnvDTE80.DTE2>();
                EnvDTE.Commands commands = dte2.Commands;

                int count = commands.Count;
                for (int i = 1; i <= count; i++)
                {
                    Console.SetCursorPosition(0, 0);
                    Console.Write($"進捗 {i,7:N0} / {count,-7:N0}");

                    // https://docs.microsoft.com/en-us/dotnet/api/envdte.commands.item
                    // https://docs.microsoft.com/en-us/dotnet/api/envdte.command
                    EnvDTE.Command cmd = commands.Item(i, -1);

                    if (string.IsNullOrEmpty(cmd.Name))
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(cmd.LocalizedName))
                    {
                        continue;
                    }

                    // https://docs.microsoft.com/en-us/dotnet/api/envdte.command.bindings
                    int b = 0;
                    foreach (string bind in cmd.Bindings)
                    {
                        sw.WriteLine($"{cmd.Guid}\t{cmd.ID}\t{cmd.Name}\t{cmd.LocalizedName}\t{++b}\t{bind}");
                    }
                }
            }
            Console.WriteLine("列挙完了");
            Process.Start(outputFile);
        }
Esempio n. 7
0
 public Command(EnvDTE.Command cmd)
 {
     _DteCommand = cmd;
 }