/// <summary> /// Add a new help file builder project to the version settings. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddFile_Click(object sender, EventArgs e) { VersionSettings newItem; int idx = 0; using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = "Select the help file builder project(s)"; dlg.Filter = "Sandcastle Help File Builder Project Files (*.shfbproj)|*.shfbproj|All Files (*.*)|*.*"; dlg.InitialDirectory = Directory.GetCurrentDirectory(); dlg.DefaultExt = "shfbproj"; dlg.Multiselect = true; // If selected, add the file(s) if (dlg.ShowDialog() == DialogResult.OK) { foreach (string file in dlg.FileNames) { newItem = new VersionSettings(); newItem.HelpFileProject = new FilePath(file, project); // It will end up on the last one added idx = lbVersionInfo.Items.Add(newItem); } pgProps.Enabled = btnDelete.Enabled = true; lbVersionInfo.SelectedIndex = idx; } } }
/// <summary> /// Update the property grid with the selected item /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void lbVersionInfo_SelectedIndexChanged(object sender, EventArgs e) { if (lbVersionInfo.SelectedItem != null) { VersionSettings vs = (VersionSettings)lbVersionInfo.SelectedItem; pgProps.SelectedObject = vs; } else { pgProps.SelectedObject = null; } pgProps.Refresh(); }
//===================================================================== /// <summary> /// Create a version settings instance from an XPath navigator /// containing the settings. /// </summary> /// <param name="pathProvider">The base path provider object</param> /// <param name="navigator">The XPath navigator from which to /// obtain the settings.</param> /// <returns>A <see cref="VersionSettings"/> object containing the /// settings from the XPath navigator.</returns> /// <remarks>It should contain an element called <c>version</c> /// with three attributes (<c>label</c>, <c>version</c> and /// <c>helpFileProject</c>).</remarks> public static VersionSettings FromXPathNavigator( IBasePathProvider pathProvider, XPathNavigator navigator) { VersionSettings vs = new VersionSettings(); if (navigator != null) { vs.FrameworkLabel = navigator.GetAttribute("label", String.Empty).Trim(); vs.Version = navigator.GetAttribute("version", String.Empty).Trim(); vs.HelpFileProject = new FilePath(navigator.GetAttribute( "helpFileProject", String.Empty).Trim(), pathProvider); } return(vs); }
//===================================================================== /// <summary> /// Create a version settings instance from an XPath navigator /// containing the settings. /// </summary> /// <param name="pathProvider">The base path provider object</param> /// <param name="navigator">The XPath navigator from which to /// obtain the settings.</param> /// <returns>A <see cref="VersionSettings"/> object containing the /// settings from the XPath navigator.</returns> /// <remarks>It should contain an element called <c>version</c> /// with four attributes (<c>label</c>, <c>version</c>, /// <c>ripOldApis</c>, and <c>helpFileProject</c>).</remarks> public static VersionSettings FromXPathNavigator( IBasePathProvider pathProvider, XPathNavigator navigator) { VersionSettings vs = new VersionSettings(); if (navigator != null) { vs.FrameworkLabel = navigator.GetAttribute("label", String.Empty).Trim(); vs.Version = navigator.GetAttribute("version", String.Empty).Trim(); string ripOldApis = navigator.GetAttribute("ripOldApis", String.Empty); vs.RipOldApis = !String.IsNullOrEmpty(ripOldApis) && Convert.ToBoolean(ripOldApis); vs.HelpFileProject = new FilePath(navigator.GetAttribute( "helpFileProject", String.Empty).Trim(), pathProvider); } return(vs); }
//===================================================================== /// <summary> /// Create a version settings instance from an XPath navigator /// containing the settings. /// </summary> /// <param name="pathProvider">The base path provider object</param> /// <param name="navigator">The XPath navigator from which to /// obtain the settings.</param> /// <returns>A <see cref="VersionSettings"/> object containing the /// settings from the XPath navigator.</returns> /// <remarks>It should contain an element called <c>version</c> /// with three attributes (<c>label</c>, <c>version</c> and /// <c>helpFileProject</c>).</remarks> public static VersionSettings FromXPathNavigator( IBasePathProvider pathProvider, XPathNavigator navigator) { VersionSettings vs = new VersionSettings(); if(navigator != null) { vs.FrameworkLabel = navigator.GetAttribute("label", String.Empty).Trim(); vs.Version = navigator.GetAttribute("version", String.Empty).Trim(); vs.HelpFileProject = new FilePath(navigator.GetAttribute( "helpFileProject", String.Empty).Trim(), pathProvider); } return vs; }
/// <summary> /// This method is used to initialize the plug-in at the start of the build process /// </summary> /// <param name="buildProcess">A reference to the current build process</param> /// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param> /// <exception cref="BuilderException">This is thrown if the plug-in configuration is not valid</exception> public void Initialize(BuildProcess buildProcess, XPathNavigator configuration) { XPathNavigator root, node; string ripOld; builder = buildProcess; allVersions = new VersionSettingsCollection(); uniqueLabels = new List <string>(); var metadata = (HelpFileBuilderPlugInExportAttribute)this.GetType().GetCustomAttributes( typeof(HelpFileBuilderPlugInExportAttribute), false).First(); builder.ReportProgress("{0} Version {1}\r\n{2}", metadata.Id, metadata.Version, metadata.Copyright); root = configuration.SelectSingleNode("configuration"); if (root.IsEmptyElement) { throw new BuilderException("VBP0001", "The Version Builder plug-in has not been configured yet"); } // Add an element for the current project. This one won't have a project to build. currentVersion = new VersionSettings(); allVersions.Add(currentVersion); node = root.SelectSingleNode("currentProject"); if (node != null) { currentVersion.FrameworkLabel = node.GetAttribute("label", String.Empty).Trim(); currentVersion.Version = node.GetAttribute("version", String.Empty).Trim(); ripOld = node.GetAttribute("ripOldApis", String.Empty); // This wasn't in older versions if (!String.IsNullOrEmpty(ripOld)) { ripOldApis = Convert.ToBoolean(ripOld, CultureInfo.InvariantCulture); } } allVersions.FromXml(builder.CurrentProject, root); // An empty label messes up the HTML so use a single space if it's blank if (String.IsNullOrEmpty(currentVersion.FrameworkLabel)) { currentVersion.FrameworkLabel = " "; } if (node == null) { throw new BuilderException("VBP0002", "A version value is required for the Version Builder plug-in"); } if (allVersions.Count == 1) { builder.ReportProgress("No other version information was supplied. Only version information " + "for the documented assemblies will be included."); } foreach (VersionSettings vs in allVersions) { if (!uniqueLabels.Contains(vs.FrameworkLabel)) { uniqueLabels.Add(vs.FrameworkLabel); } } uniqueLabels.Sort(); }
//===================================================================== /// <summary> /// Create a version settings instance from an XPath navigator /// containing the settings. /// </summary> /// <param name="pathProvider">The base path provider object</param> /// <param name="navigator">The XPath navigator from which to /// obtain the settings.</param> /// <returns>A <see cref="VersionSettings"/> object containing the /// settings from the XPath navigator.</returns> /// <remarks>It should contain an element called <c>version</c> /// with four attributes (<c>label</c>, <c>version</c>, /// <c>ripOldApis</c>, and <c>helpFileProject</c>).</remarks> public static VersionSettings FromXPathNavigator( IBasePathProvider pathProvider, XPathNavigator navigator) { VersionSettings vs = new VersionSettings(); if(navigator != null) { vs.FrameworkLabel = navigator.GetAttribute("label", String.Empty).Trim(); vs.Version = navigator.GetAttribute("version", String.Empty).Trim(); string ripOldApis = navigator.GetAttribute("ripOldApis", String.Empty); vs.RipOldApis = !String.IsNullOrEmpty(ripOldApis) && Convert.ToBoolean(ripOldApis); vs.HelpFileProject = new FilePath(navigator.GetAttribute( "helpFileProject", String.Empty).Trim(), pathProvider); } return vs; }
/// <summary> /// This method is used to initialize the plug-in at the start of the /// build process. /// </summary> /// <param name="buildProcess">A reference to the current build /// process.</param> /// <param name="configuration">The configuration data that the plug-in /// should use to initialize itself.</param> /// <exception cref="BuilderException">This is thrown if the plug-in /// configuration is not valid.</exception> public void Initialize(BuildProcess buildProcess, XPathNavigator configuration) { XPathNavigator root, node; string ripOld; builder = buildProcess; allVersions = new VersionSettingsCollection(); uniqueLabels = new List <string>(); builder.ReportProgress("{0} Version {1}\r\n{2}", this.Name, this.Version, this.Copyright); root = configuration.SelectSingleNode("configuration"); if (root.IsEmptyElement) { throw new BuilderException("VBP0002", "The Version Builder plug-in has not been configured yet"); } // Add an element for the current project. This one won't have // a project to build. currentVersion = new VersionSettings(); allVersions.Add(currentVersion); node = root.SelectSingleNode("currentProject"); if (node != null) { currentVersion.FrameworkLabel = node.GetAttribute("label", String.Empty).Trim(); currentVersion.Version = node.GetAttribute("version", String.Empty).Trim(); ripOld = node.GetAttribute("ripOldApis", String.Empty); // This wasn't in older versions if (!String.IsNullOrEmpty(ripOld)) { ripOldApis = Convert.ToBoolean(ripOld, CultureInfo.InvariantCulture); } } allVersions.FromXml(builder.CurrentProject, root); // An empty label messes up the HTML so use a single space // if it's blank. if (String.IsNullOrEmpty(currentVersion.FrameworkLabel)) { currentVersion.FrameworkLabel = " "; } if (node == null || allVersions.Count == 1) { throw new BuilderException("VBP0003", "A version value and at least one prior version " + "are required for the Version Builder plug-in."); } foreach (VersionSettings vs in allVersions) { if (!uniqueLabels.Contains(vs.FrameworkLabel)) { uniqueLabels.Add(vs.FrameworkLabel); } } uniqueLabels.Sort(); }
/// <summary> /// Add a new help file builder project to the version settings. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddFile_Click(object sender, EventArgs e) { VersionSettings newItem; int idx = 0; using(OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = "Select the help file builder project(s)"; dlg.Filter = "Sandcastle Help File Builder Project Files (*.shfbproj)|*.shfbproj|All Files (*.*)|*.*"; dlg.InitialDirectory = Directory.GetCurrentDirectory(); dlg.DefaultExt = "shfbproj"; dlg.Multiselect = true; // If selected, add the file(s) if(dlg.ShowDialog() == DialogResult.OK) { foreach(string file in dlg.FileNames) { newItem = new VersionSettings(); newItem.HelpFileProject = new FilePath(file, project); // It will end up on the last one added idx = lbVersionInfo.Items.Add(newItem); } pgProps.Enabled = btnDelete.Enabled = true; lbVersionInfo.SelectedIndex = idx; } } }
/// <summary> /// This method is used to initialize the plug-in at the start of the build process /// </summary> /// <param name="buildProcess">A reference to the current build process</param> /// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param> /// <exception cref="BuilderException">This is thrown if the plug-in configuration is not valid</exception> public void Initialize(BuildProcess buildProcess, XPathNavigator configuration) { XPathNavigator root, node; string ripOld; builder = buildProcess; allVersions = new VersionSettingsCollection(); uniqueLabels = new List<string>(); var metadata = (HelpFileBuilderPlugInExportAttribute)this.GetType().GetCustomAttributes( typeof(HelpFileBuilderPlugInExportAttribute), false).First(); builder.ReportProgress("{0} Version {1}\r\n{2}", metadata.Id, metadata.Version, metadata.Copyright); root = configuration.SelectSingleNode("configuration"); if(root.IsEmptyElement) throw new BuilderException("VBP0001", "The Version Builder plug-in has not been configured yet"); // Add an element for the current project. This one won't have a project to build. currentVersion = new VersionSettings(); allVersions.Add(currentVersion); node = root.SelectSingleNode("currentProject"); if(node != null) { currentVersion.FrameworkLabel = node.GetAttribute("label", String.Empty).Trim(); currentVersion.Version = node.GetAttribute("version", String.Empty).Trim(); currentVersion.RipOldApis = false; ripOld = node.GetAttribute("ripOldApis", String.Empty); // This wasn't in older versions if(!String.IsNullOrEmpty(ripOld)) ripOldApis = Convert.ToBoolean(ripOld, CultureInfo.InvariantCulture); } allVersions.FromXml(builder.CurrentProject, root); // An empty label messes up the HTML so use a single space if it's blank if(String.IsNullOrEmpty(currentVersion.FrameworkLabel)) currentVersion.FrameworkLabel = " "; if(node == null) throw new BuilderException("VBP0002", "A version value is required for the Version Builder plug-in"); if(allVersions.Count == 1) builder.ReportProgress("No other version information was supplied. Only version information " + "for the documented assemblies will be included."); foreach(VersionSettings vs in allVersions) if(!uniqueLabels.Contains(vs.FrameworkLabel)) uniqueLabels.Add(vs.FrameworkLabel); uniqueLabels.Sort(); }
/// <summary> /// This method is used to initialize the plug-in at the start of the /// build process. /// </summary> /// <param name="buildProcess">A reference to the current build /// process.</param> /// <param name="configuration">The configuration data that the plug-in /// should use to initialize itself.</param> /// <exception cref="BuilderException">This is thrown if the plug-in /// configuration is not valid.</exception> public void Initialize(BuildProcess buildProcess, XPathNavigator configuration) { XPathNavigator root, node; string ripOld; builder = buildProcess; allVersions = new VersionSettingsCollection(); uniqueLabels = new List<string>(); builder.ReportProgress("{0} Version {1}\r\n{2}", this.Name, this.Version, this.Copyright); root = configuration.SelectSingleNode("configuration"); if(root.IsEmptyElement) throw new BuilderException("VBP0002", "The Version Builder plug-in has not been configured yet"); // Add an element for the current project. This one won't have // a project to build. currentVersion = new VersionSettings(); allVersions.Add(currentVersion); node = root.SelectSingleNode("currentProject"); if(node != null) { currentVersion.FrameworkLabel = node.GetAttribute("label", String.Empty).Trim(); currentVersion.Version = node.GetAttribute("version", String.Empty).Trim(); ripOld = node.GetAttribute("ripOldApis", String.Empty); // This wasn't in older versions if(!String.IsNullOrEmpty(ripOld)) ripOldApis = Convert.ToBoolean(ripOld, CultureInfo.InvariantCulture); } allVersions.FromXml(builder.CurrentProject, root); // An empty label messes up the HTML so use a single space // if it's blank. if(String.IsNullOrEmpty(currentVersion.FrameworkLabel)) currentVersion.FrameworkLabel = " "; if(node == null || allVersions.Count == 1) throw new BuilderException("VBP0003", "A version value and at least one prior version " + "are required for the Version Builder plug-in."); foreach(VersionSettings vs in allVersions) if(!uniqueLabels.Contains(vs.FrameworkLabel)) uniqueLabels.Add(vs.FrameworkLabel); uniqueLabels.Sort(); }