//=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public WildcardReferencesConfigDlg(SandcastleProject currentProject, string currentConfig)
        {
            InitializeComponent();
            project = currentProject;

            lnkProjectSite.Links[0].LinkData = "https://GitHub.com/EWSoftware/SHFB";
            lbReferences.DisplayMember = lbReferences.ValueMember = "ListDescription";

            items = new WildcardReferenceSettingsCollection();

            // Load the current settings
            config = XElement.Parse(currentConfig);

            if(!config.IsEmpty)
                items.FromXml(project, config);

            if(items.Count == 0)
                pgProps.Enabled = btnDelete.Enabled = false;
            else
            {
                // Binding the collection to the list box caused some odd problems with the property grid so
                // we'll add the items to the list box directly.
                foreach(WildcardReferenceSettings rl in items)
                    lbReferences.Items.Add(rl);

                lbReferences.SelectedIndex = 0;
            }
        }
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        public LaunchMSHelpViewerDlg(SandcastleProject currentProject)
        {
            InitializeComponent();

            project = currentProject;

            // Make sure we start out in the project's output folder in case the output folder
            // is relative to it.
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(project.Filename)));

            helpFilePath = project.OutputPath;
            msHelpViewer = Settings.Default.MSHelpViewerPath;

            if(String.IsNullOrEmpty(helpFilePath))
                helpFilePath = Directory.GetCurrentDirectory();
            else
                helpFilePath = Path.GetFullPath(helpFilePath);

            helpFilePath += project.HtmlHelpName + ".mshc";
            setupFile = Path.ChangeExtension(helpFilePath, ".msha");

            // If an external viewer is not defined, we'll launch it via the ms-xhelp protocol
            if(msHelpViewer.Length == 0 || !File.Exists(msHelpViewer))
                msHelpViewer = "ms-xhelp:///?method=page&id=-1&topicversion=100&product=vs&productversion=100&locale=" +
                    project.Language.Name;

            actionThread = new BackgroundWorker { WorkerReportsProgress = true };
            actionThread.DoWork += actionThread_DoWork;
            actionThread.ProgressChanged += actionThread_ProgressChanged;
            actionThread.RunWorkerCompleted += actionThread_RunWorkerCompleted;
        }
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public BindingRedirectResolverConfigDlg(SandcastleProject currentProject,
          string currentConfig)
        {
            XPathNavigator navigator, root;

            InitializeComponent();
            project = currentProject;

            lnkCodePlexSHFB.Links[0].LinkData = "http://SHFB.CodePlex.com";

            items = new BindingRedirectSettingsCollection();

            // Load the current settings
            config = new XmlDocument();
            config.LoadXml(currentConfig);
            navigator = config.CreateNavigator();

            root = navigator.SelectSingleNode("configuration");

            if(!root.IsEmptyElement)
                items.FromXml(project, root);

            if(items.Count == 0)
                pgProps.Enabled = btnDelete.Enabled = false;
            else
            {
                // Binding the collection to the list box caused some
                // odd problems with the property grid so we'll add the
                // items to the list box directly.
                foreach(BindingRedirectSettings brs in items)
                    lbRedirects.Items.Add(brs);

                lbRedirects.SelectedIndex = 0;
            }
        }
        /// <inheritdoc/>
        public String ConfigurePlugIn(SandcastleProject project, String currentConfig)
        {
            MessageBox.Show("This plug-in has no configurable settings", "Build Process Plug-In",
                MessageBoxButtons.OK, MessageBoxIcon.Information);

            return currentConfig;
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            MessageBox.Show("This plug-in has no configurable settings", "Lightweight Website Style Plug-In",
                MessageBoxButtons.OK, MessageBoxIcon.Information);

            return currentConfig;
        }
 //=====================================================================
 /// <summary>
 /// Internal constructor
 /// </summary>
 /// <param name="itemName">The namespace's name</param>
 /// <param name="documented">The flag indicating whether or not the
 /// namespace is to be documented.</param>
 /// <param name="summaryText">The summary text</param>
 /// <param name="project">The owning project</param>
 internal NamespaceSummaryItem(string itemName, bool documented,
   string summaryText, SandcastleProject project)
     : base(project)
 {
     name = itemName;
     summary = summaryText;
     isDocumented = documented;
 }
Exemplo n.º 7
0
        //=====================================================================

        /// <summary>
        /// Load the conceptual content information and preview the topics
        /// </summary>
        /// <param name="project">The current project</param>
        /// <param name="topicToPreview">The filename of the topic to show as the starting topic or null for the
        /// first topic.</param>
        public void PreviewTopic(SandcastleProject project, string topicToPreview)
        {
            if(project == null || ucTopicPreviewer.CurrentProject == null ||
              ucTopicPreviewer.CurrentProject.Filename != project.Filename)
                ucTopicPreviewer.CurrentProject = project;

            ucTopicPreviewer.Refresh(false);
            ucTopicPreviewer.FindAndDisplay(topicToPreview);
        }
Exemplo n.º 8
0
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the plug-in perform its own
        /// configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file builder project</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            // TODO: Add and invoke a configuration dialog if you need one.  You will also need to set the
            // IsConfigurable property to true on the class's export attribute.
            MessageBox.Show("This plug-in has no configurable settings", "Build Process Plug-In",
                MessageBoxButtons.OK, MessageBoxIcon.Information);

            return currentConfig;
        }
Exemplo n.º 9
0
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the plug-in perform its own
        /// configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file builder project.</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            using(BibliographySupportConfigDlg dlg = new BibliographySupportConfigDlg(currentConfig))
            {
                if(dlg.ShowDialog() == DialogResult.OK)
                    currentConfig = dlg.Configuration;
            }

            return currentConfig;
        }
 /// <summary>
 /// This method is used by the Sandcastle Help File Builder to let the
 /// plug-in perform its own configuration.
 /// </summary>
 /// <param name="project">A reference to the active project</param>
 /// <param name="currentConfig">The current configuration XML fragment</param>
 /// <returns>A string containing the new configuration XML fragment</returns>
 /// <remarks>The configuration data will be stored in the help file
 /// builder project.</remarks>
 public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
 {
     using (var dialog = new SettingsForm(currentConfig))
     {
         var result = dialog.ShowDialog();
         if (result == DialogResult.OK)
             return dialog.Config;
     }
     return currentConfig;
 }
Exemplo n.º 11
0
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the
        /// plug-in perform its own configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file
        /// builder project.</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            var configuration = XsdPlugInConfiguration.FromXml(project, currentConfig);

            using (var dlg = new XsdConfigurationForm(configuration))
            {
                return (dlg.ShowDialog() == DialogResult.OK)
                        ? XsdPlugInConfiguration.ToXml(dlg.NewConfiguration)
                        : currentConfig;
            }
        }
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration XML fragment</param>
        public BindingRedirectResolverConfigDlg(SandcastleProject currentProject, string currentConfig)
        {
            XPathNavigator navigator, root;
            string useGac;
            bool value;

            InitializeComponent();
            project = currentProject;

            lnkProjectSite.Links[0].LinkData = "https://GitHub.com/EWSoftware/SHFB";

            items = new BindingRedirectSettingsCollection();

            // Load the current settings
            config = new XmlDocument();
            config.LoadXml(currentConfig);
            navigator = config.CreateNavigator();

            root = navigator.SelectSingleNode("configuration");

            useGac = root.GetAttribute("useGAC", String.Empty);

            if(Boolean.TryParse(useGac, out value))
                chkUseGAC.Checked = value;

            if(!root.IsEmptyElement)
                items.FromXml(project, root);

            if(items.Count == 0)
                pgProps.Enabled = btnDelete.Enabled = false;
            else
            {
                // Binding the collection to the list box caused some odd problems with the property grid so
                // we'll add the items to the list box directly.
                foreach(BindingRedirectSettings brs in items)
                    lbRedirects.Items.Add(brs);

                lbRedirects.SelectedIndex = 0;
            }

            foreach(XPathNavigator nav in root.Select("ignoreIfUnresolved/assemblyIdentity/@name"))
                lbIgnoreIfUnresolved.Items.Add(nav.Value);

            if(lbIgnoreIfUnresolved.Items.Count == 0)
            {
                lbIgnoreIfUnresolved.Items.Add("BusinessObjects.Licensing.KeycodeDecoder");
                lbIgnoreIfUnresolved.Items.Add("Microsoft.VisualStudio.TestTools.UITest.Playback");
            }

            lbIgnoreIfUnresolved.SelectedIndex = 0;
        }
Exemplo n.º 13
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public VersionBuilderConfigDlg(SandcastleProject currentProject, string currentConfig)
        {
            XPathNavigator navigator, root, node;
            string ripOldApis;

            InitializeComponent();
            project = currentProject;

            lnkProjectSite.Links[0].LinkData = "https://GitHub.com/EWSoftware/SHFB";
            lbVersionInfo.DisplayMember = lbVersionInfo.ValueMember = "ListDescription";

            items = new VersionSettingsCollection();

            // Load the current settings
            config = new XmlDocument();
            config.LoadXml(currentConfig);
            navigator = config.CreateNavigator();

            root = navigator.SelectSingleNode("configuration");

            if(!root.IsEmptyElement)
            {
                node = root.SelectSingleNode("currentProject");

                if(node != null)
                {
                    txtLabel.Text = node.GetAttribute("label", String.Empty);
                    txtVersion.Text = node.GetAttribute("version", String.Empty);
                    ripOldApis = node.GetAttribute("ripOldApis", String.Empty);

                    // This wasn't in earlier versions
                    if(!String.IsNullOrEmpty(ripOldApis))
                        chkRipOldAPIs.Checked = Convert.ToBoolean(ripOldApis, CultureInfo.InvariantCulture);
                }

                items.FromXml(currentProject, root);
            }

            if(items.Count == 0)
                pgProps.Enabled = btnDelete.Enabled = false;
            else
            {
                // Binding the collection to the list box caused some
                // odd problems with the property grid so we'll add the
                // items to the list box directly.
                foreach(VersionSettings vs in items)
                    lbVersionInfo.Items.Add(vs);

                lbVersionInfo.SelectedIndex = 0;
            }
        }
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public AdditionalReferenceLinksConfigDlg(SandcastleProject currentProject,
          string currentConfig)
        {
            XPathNavigator navigator, root;

            InitializeComponent();
            project = currentProject;

            lnkCodePlexSHFB.Links[0].LinkData = "http://SHFB.CodePlex.com";
            lbReferences.DisplayMember = lbReferences.ValueMember =
                "ListDescription";

            items = new ReferenceLinkSettingsCollection();

            // Load the current settings
            config = new XmlDocument();
            config.LoadXml(currentConfig);
            navigator = config.CreateNavigator();

            root = navigator.SelectSingleNode("configuration");

            if(root.IsEmptyElement)
                return;

            items.FromXml(project, root);

            if(items.Count == 0)
                pgProps.Enabled = btnDelete.Enabled = false;
            else
            {
                // Binding the collection to the list box caused some
                // odd problems with the property grid so we'll add the
                // items to the list box directly.
                foreach(ReferenceLinkSettings rl in items)
                    lbReferences.Items.Add(rl);

                lbReferences.SelectedIndex = 0;
            }
        }
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the
        /// plug-in perform its own configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file
        /// builder project.</remarks>
        public string ConfigurePlugIn(SandcastleProject project,
          string currentConfig)
        {
            using(XPathReflectionFileFilterConfigDlg dlg =
              new XPathReflectionFileFilterConfigDlg(currentConfig))
            {
                if(dlg.ShowDialog() == DialogResult.OK)
                    currentConfig = dlg.Configuration;
            }

            return currentConfig;
        }
Exemplo n.º 16
0
        /// <summary>
        /// View the last build HTML Help 1 file, MS Help 2 file, or website Index.html page
        /// </summary>
        /// <param name="project">The project to use or null to use the current project</param>
        /// <param name="commandId">The ID of the command that invoked the request which determines the help
        /// file format launched.</param>
        private void ViewBuiltHelpFile(SandcastleProject project, uint commandId)
        {
            string outputPath, help2Viewer = null;

            if(project == null)
            {
                project = CurrentSandcastleProject;

                if(project == null)
                    return;
            }

            var options = this.GeneralOptions;

            if(options != null)
                help2Viewer = options.HxsViewerPath;

            // Make sure we start out in the project's output folder in case the output folder is relative to it
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(project.Filename)));
            outputPath = project.OutputPath;

            if(String.IsNullOrEmpty(outputPath))
                outputPath = Directory.GetCurrentDirectory();
            else
                outputPath = Path.GetFullPath(outputPath);

            if(commandId == PkgCmdIDList.ViewHtmlHelp)
                outputPath += project.HtmlHelpName + ".chm";
            else
                if(commandId == PkgCmdIDList.ViewHxSHelp)
                {
                    outputPath += project.HtmlHelpName + ".hxs";

                    if(String.IsNullOrEmpty(help2Viewer) || !File.Exists(help2Viewer))
                    {
                        Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_WARNING, "MS Help 2 files must be registered in a " +
                            "collection to be viewed or you can use a standalone viewer.  Use Tools | Options | Sandcastle " +
                            "Help File Builder to define a standalone viewer.  See Links to Resources in the help file if " +
                            "you need one.");
                        return;
                    }
                }
                else
                    if(commandId == PkgCmdIDList.ViewDocxHelp)
                        outputPath += project.HtmlHelpName + ".docx";
                    else
                        outputPath += "Index.html";

            // If there are substitution tags present, have a go at resolving them
            if(outputPath.IndexOf("{@", StringComparison.Ordinal) != -1)
            {
                try
                {
                    var bp = new SandcastleBuilder.Utils.BuildEngine.BuildProcess(project);
                    outputPath = bp.TransformText(outputPath);
                }
                catch
                {
                    // Ignore errors
                    Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_WARNING, "The help filename appears to " +
                        "contain substitution tags but they could not be resolved to determine the actual " +
                        "file to open for viewing.  Building website output and viewing it can be used to " +
                        "work around this issue.");
                    return;
                }
            }

            if(!File.Exists(outputPath))
            {
                Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_INFO, "A copy of the help file does not appear " +
                    "to exist yet.  It may need to be built.");
                return;
            }

            try
            {
                if(outputPath.EndsWith(".hxs", StringComparison.OrdinalIgnoreCase))
                    System.Diagnostics.Process.Start(help2Viewer, outputPath);
                else
                    if(outputPath.EndsWith(".chm", StringComparison.OrdinalIgnoreCase) ||
                      outputPath.EndsWith(".docx", StringComparison.OrdinalIgnoreCase))
                        System.Diagnostics.Process.Start(outputPath);
                    else
                        Utility.OpenUrl(outputPath);
            }
            catch(Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_CRITICAL, "Unable to open help file '{0}'\r\n" +
                    "Reason: {1}", outputPath, ex.Message);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Close the current project
        /// </summary>
        /// <returns>True if the project was closed, false if not</returns>
        private bool CloseProject()
        {
            BaseContentEditor content;
            IDockContent[] contents;

            if(projectExplorer.AskToSaveProject())
            {
                miClearOutput_Click(this, EventArgs.Empty);
                this.KillWebServer();

                // Dispose of the preview window as it doesn't make much sense to save its state
                if(previewWindow != null)
                {
                    previewWindow.Dispose();
                    previewWindow = null;
                }

                if(outputWindow != null)
                {
                    outputWindow.ResetLogViewer();
                    outputWindow.LogFile = null;
                }

                if(entityReferencesWindow != null)
                    entityReferencesWindow.CurrentProject = null;

                if(projectExplorer.CurrentProject != null && Settings.Default.PerUserProjectState)
                {
                    // If hidden, unhide it so that DockPanel can write to it.  We'll hide it again afterwards.
                    bool isHidden = (File.Exists(projectExplorer.CurrentProject.Filename + WindowStateSuffix) &&
                      (File.GetAttributes(projectExplorer.CurrentProject.Filename +
                        WindowStateSuffix) & FileAttributes.Hidden) != 0);

                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;

                        if(isHidden)
                            File.SetAttributes(projectExplorer.CurrentProject.Filename + WindowStateSuffix,
                                FileAttributes.Normal);

                        dockPanel.SaveAsXml(projectExplorer.CurrentProject.Filename + WindowStateSuffix);

                        if(isHidden)
                            File.SetAttributes(projectExplorer.CurrentProject.Filename + WindowStateSuffix,
                                FileAttributes.Hidden);
                    }
                    finally
                    {
                        Cursor.Current = Cursors.Default;
                    }
                }

                // Close all content editors
                contents = new IDockContent[dockPanel.Contents.Count];
                dockPanel.Contents.CopyTo(contents, 0);

                foreach(IDockContent dockContent in contents)
                {
                    content = dockContent as BaseContentEditor;

                    // If one can't close, don't close the project
                    if(content != null && !content.CanClose)
                    {
                        projectExplorer.Activate();
                        return false;
                    }

                    if(dockContent.DockHandler.HideOnClose)
                        dockContent.DockHandler.Hide();
                    else
                        dockContent.DockHandler.Close();
                }

                if(project != null)
                    project.Dispose();

                project = projectExplorer.CurrentProject = projectProperties.CurrentProject = null;
                this.UpdateFilenameInfo();

                miDocumentation.Visible = miCloseProject.Enabled = miClose.Enabled = miCloseAll.Enabled =
                    miCloseAllButCurrent.Enabled = miSave.Enabled = miSaveAs.Enabled = miSaveAll.Enabled =
                    tsbSave.Enabled = tsbSaveAll.Enabled = miProjectExplorer.Visible =
                    miExplorerSeparator.Visible = tsbBuildProject.Enabled = tsbViewHelpFile.Enabled =
                    miPreviewTopic.Enabled = tsbPreviewTopic.Enabled = false;

                return true;
            }

            return false;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Create a new project instance and connect it to the UI
        /// </summary>
        /// <param name="projectName">The project filename</param>
        /// <param name="mustExist">True if it must exist or false if it is a new, unnamed project</param>
        private void CreateProject(string projectName, bool mustExist)
        {
            List<string> values;

            project = new SandcastleProject(projectName, mustExist, false);

            projectExplorer.CurrentProject = projectProperties.CurrentProject = project;

            if(entityReferencesWindow != null)
                entityReferencesWindow.CurrentProject = project;

            this.UpdateFilenameInfo();

            // Get the configuration and platform values
            values = project.MSBuildProject.ConditionedProperties["Configuration"];

            tcbConfig.Items.Clear();

            foreach(string value in values)
                tcbConfig.Items.Add(value);

            if(tcbConfig.Items.Count == 0)
            {
                tcbConfig.Items.Add("Debug");
                tcbConfig.Items.Add("Release");
            }

            values = project.MSBuildProject.ConditionedProperties["Platform"];

            tcbPlatform.Items.Clear();

            foreach(string value in values)
                tcbPlatform.Items.Add(value);

            if(tcbPlatform.Items.Count == 0)
                tcbPlatform.Items.Add("AnyCPU");

            if(tcbConfig.Items.Contains(Settings.Default.LastConfig))
                tcbConfig.SelectedItem = Settings.Default.LastConfig;
            else
                tcbConfig.SelectedIndex = 0;

            if(tcbPlatform.Items.Contains(Settings.Default.LastPlatform))
                tcbPlatform.SelectedItem = Settings.Default.LastPlatform;
            else
                tcbPlatform.SelectedIndex = 0;

            miDocumentation.Visible = miCloseProject.Enabled = miClose.Enabled = miSave.Enabled =
                miSaveAs.Enabled = tsbSave.Enabled = tsbSaveAll.Enabled = miSaveAll.Enabled =
                miProjectExplorer.Visible = miExplorerSeparator.Visible = tsbBuildProject.Enabled =
                tsbViewHelpFile.Enabled = miPreviewTopic.Enabled = tsbPreviewTopic.Enabled = true;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(project.Filename)));

            if(Settings.Default.PerUserProjectState && File.Exists(project.Filename + WindowStateSuffix))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    dockPanel.SuspendLayout(true);

                    projectExplorer.DockPanel = null;
                    projectProperties.DockPanel = null;

                    if(outputWindow != null)
                        outputWindow.DockPanel = null;

                    if(entityReferencesWindow != null)
                        entityReferencesWindow.DockPanel = null;

                    if(previewWindow != null)
                    {
                        previewWindow.Dispose();
                        previewWindow = null;
                    }

                    dockPanel.LoadFromXml(project.Filename + WindowStateSuffix, DeserializeState);
                }
                catch(InvalidOperationException )
                {
                    // Ignore errors if the content settings don't load
                    miViewProjectExplorer_Click(this, EventArgs.Empty);
                    miViewProjectProperties_Click(this, EventArgs.Empty);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                    dockPanel.ResumeLayout(true, true);
                }
            }
            else
            {
                miViewProjectExplorer_Click(this, EventArgs.Empty);
                miViewProjectProperties_Click(this, EventArgs.Empty);
            }
        }
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the plug-in perform its own
        /// configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file builder project</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            using(CompletionNotificationConfigDlg dlg = new CompletionNotificationConfigDlg(currentConfig))
            {
                if(dlg.ShowDialog() == DialogResult.OK)
                    currentConfig = dlg.Configuration;
            }

            return currentConfig;
        }
Exemplo n.º 20
0
        /// <summary>
        /// The environment calls this to set the currently selected project that the property page should show.
        /// </summary>
        /// <param name="currentProject">The current help file builder project</param>
        public void SetProject(SandcastleProject currentProject)
        {
            if(this.CurrentProject != currentProject)
            {
                this.CurrentProject = currentProject;

                if(!this.IsDisposed)
                {
                    if(this.CurrentProject != null)
                    {
                        this.Initialize();
                        this.BindProperties(this.Controls);
                    }

                    this.IsDirty = false;
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Remove the item from the project
        /// </summary>
        public void RemoveFromProjectFile()
        {
            projectFile.MSBuildProject.RemoveItem(item);
            projectFile.MSBuildProject.ReevaluateIfNecessary();

            projectFile = null;
            item = null;
        }
Exemplo n.º 22
0
        //=====================================================================

        /// <summary>
        /// This constructor is used to wrap an existing project item
        /// </summary>
        /// <param name="project">The project that owns the item</param>
        /// <param name="existingItem">The existing item</param>
        /// <overloads>There are two overloads for the constructor</overloads>
        protected ProjectElement(SandcastleProject project, ProjectItem existingItem)
        {
            if(project == null)
                throw new ArgumentNullException("project");

            if(existingItem == null)
                throw new ArgumentNullException("existingItem");

            projectFile = project;
            item = existingItem;
        }
Exemplo n.º 23
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="helpViewerPath">The path to the MS Help Viewer</param>
        public LaunchMSHelpViewerDlg(SandcastleProject currentProject, string helpViewerPath)
        {
            InitializeComponent();

            project = currentProject;

            // Make sure we start out in the project's output folder in case the output folder
            // is relative to it.
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(project.Filename)));

            helpFilePath = project.OutputPath;
            msHelpViewer = helpViewerPath;

            if(String.IsNullOrEmpty(helpFilePath))
                helpFilePath = Directory.GetCurrentDirectory();
            else
                helpFilePath = Path.GetFullPath(helpFilePath);

            helpFilePath += project.HtmlHelpName + ".mshc";
            setupFile = Path.ChangeExtension(helpFilePath, ".msha");

            // If an external viewer is not defined, we'll launch it via the standard help viewer or the
            // ms-xhelp protocol.
            if(String.IsNullOrWhiteSpace(msHelpViewer) || !File.Exists(msHelpViewer))
                msHelpViewer = null;

            actionThread = new BackgroundWorker { WorkerReportsProgress = true };
            actionThread.DoWork += actionThread_DoWork;
            actionThread.ProgressChanged += actionThread_ProgressChanged;
            actionThread.RunWorkerCompleted += actionThread_RunWorkerCompleted;

            cboHelpViewerVersion.SelectedIndex = lastVersionSelected;
        }
Exemplo n.º 24
0
        /// <summary>
        /// This constructor is used to create a new item and add it to the project
        /// </summary>
        /// <param name="project">The project that will own the item</param>
        /// <param name="itemType">The type of item to create</param>
        /// <param name="itemPath">The path to the item</param>
        internal FileItem(SandcastleProject project, string itemType, string itemPath) :
          base(project, itemType, itemPath)
        {
            buildAction = (BuildAction)Enum.Parse(typeof(BuildAction), this.ItemType, true);
            includePath = new FilePath(this.Include, this.Project);
            includePath.PersistablePathChanging += includePath_PersistablePathChanging;

            this.Include = includePath.PersistablePath;
        }
Exemplo n.º 25
0
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the
        /// plug-in perform its own configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file
        /// builder project.</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            MessageBox.Show("This plug-in has no configurable settings",
                "Table of Contents Exclusion Plug-In", MessageBoxButtons.OK,
                MessageBoxIcon.Information);

            return currentConfig;
        }
Exemplo n.º 26
0
        //=====================================================================

        /// <summary>
        /// This constructor is used to wrap an existing reference
        /// </summary>
        /// <param name="project">The project that owns the reference</param>
        /// <param name="existingItem">The existing reference</param>
        /// <overloads>There are two overloads for the constructor</overloads>
        internal ProjectReferenceItem(SandcastleProject project, ProjectItem existingItem) : base(project, existingItem)
        {
            projectPath = new FilePath(this.Include, this.Project);
            projectPath.PersistablePathChanging += projectPath_PersistablePathChanging;
            this.GetProjectMetadata(false);
            this.Include = projectPath.PersistablePath;
        }
Exemplo n.º 27
0
        /// <summary>
        /// This constructor is used to create a new build item and add it to the project
        /// </summary>
        /// <param name="project">The project that will own the item</param>
        /// <param name="itemType">The type of build item to create</param>
        /// <param name="itemPath">The path to the item.  This can be relative or absolute and may contain
        /// variable references.</param>
        protected ProjectElement(SandcastleProject project, string itemType, string itemPath)
        {
            if(project == null)
                throw new ArgumentNullException("project");

            if(String.IsNullOrEmpty(itemPath))
                throw new ArgumentException("Cannot be null or empty", "itemPath");

            if(String.IsNullOrEmpty(itemType))
                throw new ArgumentException("Cannot be null or empty", "itemType");

            projectFile = project;

            if(itemType == Utils.BuildAction.Folder.ToString() && itemPath[itemPath.Length - 1] != '\\')
                itemPath += @"\";

            item = project.MSBuildProject.AddItem(itemType, itemPath)[0];
            projectFile.MSBuildProject.ReevaluateIfNecessary();
        }
Exemplo n.º 28
0
 /// <summary>
 /// This constructor is used to create a new reference and add it to the project
 /// </summary>
 /// <param name="project">The project that will own the reference</param>
 /// <param name="itemType">The type of reference to create</param>
 /// <param name="itemPath">The path to the reference</param>
 internal ProjectReferenceItem(SandcastleProject project, string itemType, string itemPath) :
   base(project, itemType, itemPath)
 {
     projectPath = new FilePath(this.Include, this.Project);
     projectPath.PersistablePathChanging += projectPath_PersistablePathChanging;
     this.GetProjectMetadata(false);
     this.Include = projectPath.PersistablePath;
 }
        /// <summary>
        /// View the last built help output
        /// </summary>
        /// <param name="project">The project to use or null to use the current project</param>
        /// <param name="commandId">The ID of the command that invoked the request which determines the help
        /// file format launched.  Zero is used for markdown content since there is no viewer for it.</param>
        private static void ViewBuiltHelpFile(SandcastleProject project, uint commandId)
        {
            string outputPath;

            if(project == null)
            {
                project = CurrentSandcastleProject;

                if(project == null)
                    return;
            }

            // Make sure we start out in the project's output folder in case the output folder is relative to it
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(project.Filename)));
            outputPath = project.OutputPath;

            if(String.IsNullOrEmpty(outputPath))
                outputPath = Directory.GetCurrentDirectory();
            else
                outputPath = Path.GetFullPath(outputPath);

            if(commandId == PkgCmdIDList.ViewHtmlHelp)
                outputPath += project.HtmlHelpName + ".chm";
            else
                if(commandId == PkgCmdIDList.ViewDocxHelp)
                    outputPath += project.HtmlHelpName + ".docx";
                else
                    if(commandId == 0)
                        outputPath += "_Sidebar.md";
                    else
                        outputPath += "Index.html";

            // If there are substitution tags present, have a go at resolving them
            if(outputPath.IndexOf("{@", StringComparison.Ordinal) != -1)
            {
                try
                {
                    var bp = new SandcastleBuilder.Utils.BuildEngine.BuildProcess(project);
                    outputPath = bp.SubstitutionTags.TransformText(outputPath);
                }
                catch
                {
                    // Ignore errors
                    Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_WARNING, "The help filename appears to " +
                        "contain substitution tags but they could not be resolved to determine the actual " +
                        "file to open for viewing.  Building website output and viewing it can be used to " +
                        "work around this issue.");
                    return;
                }
            }

            if(!File.Exists(outputPath))
            {
                Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_INFO, "A copy of the help file does not appear " +
                    "to exist yet.  It may need to be built.");
                return;
            }

            try
            {
                if(outputPath.EndsWith(".chm", StringComparison.OrdinalIgnoreCase) ||
                    outputPath.EndsWith(".docx", StringComparison.OrdinalIgnoreCase))
                    System.Diagnostics.Process.Start(outputPath);
                else
                    if(outputPath.EndsWith(".md", StringComparison.OrdinalIgnoreCase))
                    {
                        var dte = Utility.GetServiceFromPackage<DTE, SDTE>(true);

                        if(dte != null)
                        {
                            var doc = dte.ItemOperations.OpenFile(outputPath, EnvDTE.Constants.vsViewKindPrimary);

                            if(doc != null)
                                doc.Activate();
                        }
                    }
                    else
                        Utility.OpenUrl(outputPath);
            }
            catch(Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                Utility.ShowMessageBox(OLEMSGICON.OLEMSGICON_CRITICAL, "Unable to open help file '{0}'\r\n" +
                    "Reason: {1}", outputPath, ex.Message);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// This method is used by the Sandcastle Help File Builder to let the plug-in perform its own
        /// configuration.
        /// </summary>
        /// <param name="project">A reference to the active project</param>
        /// <param name="currentConfig">The current configuration XML fragment</param>
        /// <returns>A string containing the new configuration XML fragment</returns>
        /// <remarks>The configuration data will be stored in the help file builder project</remarks>
        public string ConfigurePlugIn(SandcastleProject project, string currentConfig)
        {
            using(MemberIdFixUpPlugInConfigDlg dlg = new MemberIdFixUpPlugInConfigDlg(currentConfig))
            {
                if(dlg.ShowDialog() == DialogResult.OK)
                    currentConfig = dlg.Configuration;
            }

            return currentConfig;
        }