コード例 #1
0
ファイル: CustomAction.cs プロジェクト: kiwipiet/CleanProject
        public static ActionResult AddCleanProjectTool(Session session)
        {
            session.Log("Begin AddCleanProjectTool");

            // Read HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\External Tools
            var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\External Tools", true);
            if (key != null)
            {
                // The number has the value for the next tool
                // If there are 5 tools, the number will be 6
                var numTools = (int) key.GetValue("ToolNumKeys", 0);

                var tool = new ExternalTool
                {
                    Args = "/D:$(SolutionDir) /Z /R",
                    Command = Path.Combine(session["INSTALLLOCATION"], "CleanProject.exe"),
                    Directory = string.Empty,
                    Opt = 24,
                    SourceKey = string.Empty,
                    Title = "Clean, Remove Source Bindings and Zip Solution"
                };
                ExternalTool.Write(key, numTools, tool);

                // Setup for the next tool
                key.SetValue("ToolNumKeys", numTools + 1);
            }
            session.Log("End AddCleanProjectTool");
            return ActionResult.Success;
        }
コード例 #2
0
        public static ActionResult AddCleanProjectTool(Session session)
        {
            session.Log("Begin AddCleanProjectTool");

            // Read HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\External Tools
            var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\External Tools", true);

            if (key != null)
            {
                // The number has the value for the next tool
                // If there are 5 tools, the number will be 6
                var numTools = (int)key.GetValue("ToolNumKeys", 0);

                var tool = new ExternalTool
                {
                    Args      = "/D:$(SolutionDir) /Z /R",
                    Command   = Path.Combine(session["INSTALLLOCATION"], "CleanProject.exe"),
                    Directory = string.Empty,
                    Opt       = 24,
                    SourceKey = string.Empty,
                    Title     = "Clean, Remove Source Bindings and Zip Solution"
                };
                ExternalTool.Write(key, numTools, tool);

                // Setup for the next tool
                key.SetValue("ToolNumKeys", numTools + 1);
            }
            session.Log("End AddCleanProjectTool");
            return(ActionResult.Success);
        }
コード例 #3
0
 internal static void Write(RegistryKey key, int num, ExternalTool et)
 {
     key.SetValue(ToolTitle(num), et.Title);
     key.SetValue(ToolSourceKey(num), CleanProjectSig);
     key.SetValue(ToolDir(num), et.Directory);
     key.SetValue(ToolCmd(num), et.Command);
     key.SetValue(ToolArg(num), et.Args);
     key.SetValue(ToolOpt(num), et.Opt, RegistryValueKind.DWord);
 }
コード例 #4
0
        internal static ExternalTool Read(RegistryKey key, int num)
        {
            var et = new ExternalTool
            {
                Title     = (string)key.GetValue(ToolTitle(num)),
                SourceKey = (string)key.GetValue(ToolSourceKey(num)),
                Directory = (string)key.GetValue(ToolDir(num)),
                Command   = (string)key.GetValue(ToolCmd(num)),
                Args      = (string)key.GetValue(ToolArg(num))
            };

            return(et);
        }
コード例 #5
0
        public static ActionResult RemoveCleanProjectTool(Session session)
        {
            session.Log("Begin RemoveCleanProjectTool");

            // Read HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\External Tools
            var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\External Tools", true);

            if (key != null)
            {
                // The number has the value for the next tool
                // If there are 5 tools, the number will be 6
                ExternalTool.Remove(key, (int)key.GetValue("ToolNumKeys", 0));
            }
            session.Log("End RemoveCleanProjectTool");
            return(ActionResult.Success);
        }
コード例 #6
0
ファイル: CustomAction.cs プロジェクト: kiwipiet/CleanProject
 internal static void Write(RegistryKey key, int num, ExternalTool et)
 {
     key.SetValue(ToolTitle(num), et.Title);
     key.SetValue(ToolSourceKey(num), CleanProjectSig);
     key.SetValue(ToolDir(num), et.Directory);
     key.SetValue(ToolCmd(num), et.Command);
     key.SetValue(ToolArg(num), et.Args);
     key.SetValue(ToolOpt(num), et.Opt, RegistryValueKind.DWord);
 }
コード例 #7
0
ファイル: CustomAction.cs プロジェクト: kiwipiet/CleanProject
        internal static ExternalTool Read(RegistryKey key, int num)
        {
            var et = new ExternalTool
            {
                Title = (string) key.GetValue(ToolTitle(num)),
                SourceKey = (string) key.GetValue(ToolSourceKey(num)),
                Directory = (string) key.GetValue(ToolDir(num)),
                Command = (string) key.GetValue(ToolCmd(num)),
                Args = (string) key.GetValue(ToolArg(num))
            };

            return et;
        }