static void Proc(string command, string fileName, Action callback, string argument)
        {
            string path = GetPathFromRegistry("ProcPath");

            if (path == null)
            {
                using (var dlg = new ToolNotFoundDialog(StringParser.Parse("${res:AddIns.Git.TortoiseGitRequired}"), "http://code.google.com/p/tortoisegit/")) {
                    dlg.ShowDialog(WorkbenchSingleton.MainWin32Window);
                }
            }
            else
            {
                try {
                    StringBuilder arguments = new StringBuilder();
                    arguments.Append("/command:");
                    arguments.Append(command);
                    if (fileName != null)
                    {
                        arguments.Append(" /notempfile ");
                        arguments.Append(" /path:\"");
                        arguments.Append(fileName);
                        arguments.Append('"');
                    }
                    if (argument != null)
                    {
                        arguments.Append(' ');
                        arguments.Append(argument);
                    }
                    Process p = new Process();
                    p.StartInfo.FileName  = path;
                    p.StartInfo.Arguments = arguments.ToString();
                    //p.StartInfo.RedirectStandardError = true;
                    //p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.UseShellExecute = false;
                    p.EnableRaisingEvents       = true;
                    p.Exited += delegate {
                        p.Dispose();
                        if (callback != null)
                        {
                            ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall(callback);
                        }
                    };
//					p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) {
//						SvnClient.Instance.SvnCategory.AppendText(e.Data);
//					};
//					p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) {
//						SvnClient.Instance.SvnCategory.AppendText(e.Data);
//					};
                    p.Start();
                } catch (Exception ex) {
                    MessageService.ShowError(ex.Message);
                }
            }
        }
 public override void Run()
 {
     if (!ProfileList.IsPortableLibraryInstalled())
     {
         using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(CouldNotFindToolsDescription, DownloadUrl)) {
             // our message is long, so make the window bigger than usual
             dlg.Width  += 70;
             dlg.Height += 70;
             dlg.ShowDialog();
         }
     }
 }
Exemple #3
0
 public override void Run()
 {
     if (!ProfileList.IsPortableLibraryInstalled())
     {
         using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(
                    StringParser.Parse(
                        "${res:PortableLibrary.CouldNotFindTools}" + Environment.NewLine + Environment.NewLine +
                        "${res:PortableLibrary.ToolsInstallationHelp}"),
                    "http://go.microsoft.com/fwlink/?LinkId=210823"
                    )) {
             // our message is long, so make the window bigger than usual
             dlg.Width  += 70;
             dlg.Height += 70;
             dlg.ShowDialog();
         }
     }
 }
        public override void Run()
        {
            CompilableProject project = ProjectService.CurrentProject as CompilableProject;

            if (project == null)
            {
                return;
            }
            string sandcastleHelpFileBuilderPath = FindSHFB();

            if (sandcastleHelpFileBuilderPath == null || !File.Exists(sandcastleHelpFileBuilderPath))
            {
                using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(
                           StringParser.Parse("${res:ProjectComponent.ContextMenu.GenerateDocumentation.SHFBNotFound}"),
                           "http://www.codeplex.com/SHFB/", null))
                {
                    dlg.ShowDialog(SD.WinForms.MainWin32Window);
                }
                return;
            }

            string assembly   = project.OutputAssemblyFullPath;
            string xmlDocFile = project.DocumentationFileFullPath;

            if (xmlDocFile == null)
            {
                MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.NeedToEditBuildOptions}");
                return;
            }
            if (!File.Exists(assembly))
            {
                MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled}");
                return;
            }
            if (!File.Exists(xmlDocFile))
            {
                MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled2}");
                return;
            }
            string sandcastleHelpFileBuilderProjectFile = Path.ChangeExtension(project.FileName, ".shfbproj");

            if (!File.Exists(sandcastleHelpFileBuilderProjectFile))
            {
                using (XmlTextWriter w = new XmlTextWriter(sandcastleHelpFileBuilderProjectFile, Encoding.UTF8)) {
                    w.Formatting = Formatting.Indented;
                    const string ns = "http://schemas.microsoft.com/developer/msbuild/2003";
                    w.WriteStartElement("Project", ns);
                    w.WriteAttributeString("DefaultTargets", "Build");
                    w.WriteAttributeString("ToolsVersion", "3.5");

                    w.WriteStartElement("PropertyGroup", ns);
                    w.WriteComment("The configuration and platform will be used to determine which\n" +
                                   "assemblies to include from solution and project documentation\n" +
                                   "sources");
                    w.WriteStartElement("Configuration", ns);
                    w.WriteAttributeString("Condition", " '$(Configuration)' == '' ");
                    w.WriteValue("Debug");
                    w.WriteEndElement();                      // </Configuration>

                    w.WriteStartElement("Platform", ns);
                    w.WriteAttributeString("Condition", " '$(Platform)' == '' ");
                    w.WriteValue("AnyCPU");
                    w.WriteEndElement();                      // </AnyCPU>

                    w.WriteElementString("SchemaVersion", ns, "2.0");
                    w.WriteElementString("ProjectGuid", ns, Guid.NewGuid().ToString("B"));
                    w.WriteElementString("SHFBSchemaVersion", ns, "1.8.0.3");

                    w.WriteElementString("AssemblyName", ns, "Documentation");
                    w.WriteElementString("RootNamespace", ns, "Documentation");
                    w.WriteElementString("Name", ns, "Documentation");

                    w.WriteElementString("OutputPath", ns, @".\Help\");
                    w.WriteElementString("HtmlHelpName", ns, "Documentation");

                    w.WriteStartElement("DocumentationSources", ns);
                    w.WriteStartElement("DocumentationSource", "");
                    w.WriteAttributeString("sourceFile", FileUtility.GetRelativePath(Path.GetDirectoryName(sandcastleHelpFileBuilderProjectFile), project.FileName));
                    w.WriteEndElement();                     // </DocumentationSource>
                    w.WriteEndElement();                     // </DocumentationSources>

                    w.WriteEndElement();                     // </PropertyGrup>

                    w.WriteComment("There are no properties for these groups.  AnyCPU needs to appear in\n" +
                                   "order for Visual Studio to perform the build.  The others are optional\n" +
                                   "common platform types that may appear.");
                    string[] confPlatList =
                    {
                        "Debug|AnyCPU", "Release|AnyCPU", "Debug|x86", "Release|x86", "Debug|x64", "Release|x64", "Debug|Win32", "Release|Win32"
                    };
                    foreach (string confPlat in confPlatList)
                    {
                        w.WriteStartElement("PropertyGroup", ns);
                        w.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == '" + confPlat + "' ");
                        w.WriteEndElement();                         // </PropertyGrup>
                    }

                    w.WriteComment("Import the SHFB build targets");
                    w.WriteStartElement("Import", ns);
                    w.WriteAttributeString("Project", @"$(SHFBROOT)\SandcastleHelpFileBuilder.targets");
                    w.WriteEndElement();                     // </Import>

                    w.WriteEndElement();                     // </Project>
                }
            }

            ProcessStartInfo psi = new ProcessStartInfo(sandcastleHelpFileBuilderPath, '"' + sandcastleHelpFileBuilderProjectFile + '"');

            psi.WorkingDirectory = Path.GetDirectoryName(sandcastleHelpFileBuilderPath);
            psi.UseShellExecute  = false;
            Process.Start(psi);
        }
 public override void ShowDialog()
 {
     using (var dlg = new ToolNotFoundDialog(this.Description, this.LinkTarget, this.Icon)) {
         dlg.ShowDialog();
     }
 }