Example #1
0
        /// <inheritdoc />
        public override object ConvertTo(ITypeDescriptorContext context,
                                         CultureInfo culture, object value, Type destinationType)
        {
            NamespaceSummaryItemCollection items = value as NamespaceSummaryItemCollection;
            int excluded = 0, summary = 0;

            if (items == null || destinationType != typeof(string))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }

            if (items.Count == 0)
            {
                return("(None)");
            }

            foreach (NamespaceSummaryItem nsi in items)
            {
                if (!nsi.IsDocumented)
                {
                    excluded++;
                }
                else
                if (!String.IsNullOrEmpty(nsi.Summary))
                {
                    summary++;
                }
            }

            return(String.Format(culture, "{0} with summary, {1} excluded",
                                 summary, excluded));
        }
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="items">The namespace summary item collection to edit</param>
        public NamespaceSummaryItemEditorDlg(NamespaceSummaryItemCollection items)
        {
            InitializeComponent();

            nsColl = items;
            namespaceItems = new SortedDictionary<string, NamespaceSummaryItem>();

            // Get a copy of the current namespace summary items
            foreach(NamespaceSummaryItem nsi in nsColl)
                namespaceItems.Add(nsi.Name, nsi);
        }
Example #3
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="items">The namespace summary item collection to edit</param>
        public NamespaceSummaryItemEditorDlg(NamespaceSummaryItemCollection items)
        {
            InitializeComponent();

            nsColl         = items;
            namespaceItems = new SortedDictionary <string, NamespaceSummaryItem>(new NamespaceComparer());

            // Get a copy of the current namespace summary items
            foreach (NamespaceSummaryItem nsi in nsColl)
            {
                namespaceItems.Add(nsi.Name, nsi);
            }
        }
        /// <inheritdoc />
        protected override bool BindControlValue(Control control)
        {
            ProjectProperty projProp;

#if !STANDALONEGUI
            if (this.ProjectMgr == null)
            {
                return(false);
            }
#else
            if (this.CurrentProject == null)
            {
                return(false);
            }
#endif

            if (control.Name == "lblNamespaceSummaryState")
            {
                // Pass it the Sandcastle project instance as we use the designer dialog to edit the collection
                // and it obtains it from the collection to do the required partial build.
#if !STANDALONEGUI
                namespaceSummaries = new NamespaceSummaryItemCollection
                {
                    Project = ((SandcastleBuilderProjectNode)base.ProjectMgr).SandcastleProject
                };

                projProp = this.ProjectMgr.BuildProject.GetProperty("NamespaceSummaries");
#else
                namespaceSummaries = new NamespaceSummaryItemCollection()
                {
                    Project = base.CurrentProject
                };

                projProp = this.CurrentProject.MSBuildProject.GetProperty("NamespaceSummaries");
#endif
                summariesChanged = false;

                if (projProp != null && !String.IsNullOrEmpty(projProp.UnevaluatedValue))
                {
                    namespaceSummaries.FromXml(projProp.UnevaluatedValue);
                }

                this.UpdateNamespaceSummaryInfo();
                return(true);
            }

            return(false);
        }
Example #5
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            // Get the namespace summary item collection
            NamespaceSummaryItemCollection items = value as NamespaceSummaryItemCollection;

            if (context == null || provider == null || context.Instance == null ||
                items == null)
            {
                return(base.EditValue(context, provider, value));
            }

            using (NamespaceSummaryItemEditorDlg dlg =
                       new NamespaceSummaryItemEditorDlg(items))
            {
                dlg.ShowDialog();
            }

            return(value);
        }
        /// <summary>
        /// This refreshes the project instance property values by reloading them from the underlying MSBuild
        /// project.
        /// </summary>
        public void RefreshProjectProperties()
        {
            projectPropertyCache = null;
            docSources = null;
            apiFilter = null;
            namespaceSummaries = null;
            componentConfigs = null;
            plugInConfigs = null;

            msBuildProject.ReevaluateIfNecessary();

            this.LoadProperties();
        }
        /// <inheritdoc />
        protected override bool BindControlValue(Control control)
        {
            ProjectProperty projProp;

#if !STANDALONEGUI
            if(this.ProjectMgr == null)
                return false;
#else
            if(this.CurrentProject == null)
                return false;
#endif

            if(control.Name == "lblNamespaceSummaryState")
            {
                // Pass it the Sandcastle project instance as we use the designer dialog to edit the collection
                // and it obtains it from the collection to do the required partial build.
#if !STANDALONEGUI
                namespaceSummaries = new NamespaceSummaryItemCollection(
                    ((SandcastleBuilderProjectNode)base.ProjectMgr).SandcastleProject);
                summariesChanged = false;

                projProp = this.ProjectMgr.BuildProject.GetProperty("NamespaceSummaries");
#else
                namespaceSummaries = new NamespaceSummaryItemCollection(base.CurrentProject);
                summariesChanged = false;

                projProp = this.CurrentProject.MSBuildProject.GetProperty("NamespaceSummaries");
#endif
                if(projProp != null && !String.IsNullOrEmpty(projProp.UnevaluatedValue))
                    namespaceSummaries.FromXml(projProp.UnevaluatedValue);

                this.UpdateNamespaceSummaryInfo();
                return true;
            }

            return false;
        }
Example #8
0
        /// <summary>
        /// Scan for new namespaces when loaded
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void NamespacesDlg_Activated(object sender, EventArgs e)
        {
            NamespaceSummaryItemCollection nsColl = project.NamespaceSummaries;
            Collection <string>            asmNS, namespaces = new Collection <string>();
            AssemblyLoader loader = null;
            string         path = null;

            // Only load them once and not at design time
            if (namespacesLoaded || this.DesignMode)
            {
                return;
            }

            try
            {
                this.Cursor = Cursors.WaitCursor;
                Application.DoEvents();
                namespacesLoaded = true;

                try
                {
                    // Make sure we start in the project's folder so that
                    // relative paths are resolved correctly.
                    Directory.SetCurrentDirectory(Path.GetDirectoryName(
                                                      project.Filename));

                    loader = AssemblyLoader.CreateAssemblyLoader(project);

                    // Get a list of all unique namespaces in the
                    // documentation assemblies.
                    foreach (DocumentAssembly da in project.Assemblies)
                    {
                        if (da.CommentsOnly)
                        {
                            continue;
                        }

                        try
                        {
                            path  = da.AssemblyPath;
                            asmNS = loader.GetNamespaces(path);

                            foreach (string ns in asmNS)
                            {
                                if (!namespaces.Contains(ns))
                                {
                                    namespaces.Add(ns);
                                }
                            }
                        }
                        catch (FileNotFoundException ex)
                        {
                            System.Diagnostics.Debug.WriteLine(ex);

                            if (MessageBox.Show("Unable to find the assembly '" +
                                                path + "' or one of its dependencies.  You " +
                                                "may need to build it or add a dependency " +
                                                "to the project dependency list.  Do you " +
                                                "want to continue loading the remaining " +
                                                "assemblies?", Constants.AppName,
                                                MessageBoxButtons.YesNo,
                                                MessageBoxIcon.Error) == DialogResult.No)
                            {
                                break;
                            }
                        }
                    }
                }
                finally
                {
                    if (loader != null)
                    {
                        AssemblyLoader.ReleaseAssemblyLoader();
                    }
                }

                // The global namespace (N:) isn't always listed but we'll
                // add it as it does show up in the reflection info anyway.
                if (!namespaces.Contains(String.Empty))
                {
                    namespaces.Add(String.Empty);
                }

                // Add new namespaces to the list
                foreach (string ns in namespaces)
                {
                    if (!nsColl.Contains(ns))
                    {
                        nsColl.Add(new NamespaceSummaryItem(ns));
                    }
                }

                nsColl.Sort();

                // Load the listbox with the namespace items
                foreach (NamespaceSummaryItem nsi in nsColl)
                {
                    lbNamespaces.Items.Add(nsi, nsi.IsDocumented);
                }

                if (lbNamespaces.Items.Count == 0)
                {
                    btnDelete.Enabled = txtSummary.Enabled = false;
                }
                else
                {
                    lbNamespaces.SelectedIndex = 0;
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Example #9
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <overloads>There are five overloads for the constructor</overloads>
        protected SandcastleProject()
        {
            characterMatchEval = new MatchEvaluator(this.OnCharacterMatch);
            buildVarMatchEval = new MatchEvaluator(this.OnBuildVarMatch);

            docSources = new DocumentationSourceCollection(this);
            docSources.ListChanged += docSources_ListChanged;

            namespaceSummaries = new NamespaceSummaryItemCollection(this);
            namespaceSummaries.ListChanged += ItemList_ListChanged;

            references = new ReferenceItemCollection(this);
            references.ListChanged += ItemList_ListChanged;

            componentConfigs = new ComponentConfigurationDictionary(this);
            plugInConfigs = new PlugInConfigurationDictionary(this);

            apiFilter = new ApiFilterCollection(this);
            apiFilter.ListChanged += ItemList_ListChanged;

            helpAttributes = new MSHelpAttrCollection(this);
            helpAttributes.ListChanged += ItemList_ListChanged;

            try
            {
                loadingProperties = removeProjectWhenDisposed = true;

                contentPlacement = ContentPlacement.AboveNamespaces;
                cleanIntermediates = keepLogFile = binaryTOC = includeStopWordList = true;

                this.BuildLogFile = null;

                missingTags = MissingTags.Summary | MissingTags.Parameter | MissingTags.TypeParameter |
                    MissingTags.Returns | MissingTags.AutoDocumentCtors | MissingTags.Namespace |
                    MissingTags.AutoDocumentDispose;

                visibleItems = VisibleItems.InheritedFrameworkMembers | VisibleItems.InheritedMembers |
                    VisibleItems.Protected | VisibleItems.ProtectedInternalAsProtected;

                buildAssemblerVerbosity = BuildAssemblerVerbosity.OnlyWarningsAndErrors;
                helpFileFormat = HelpFileFormats.HtmlHelp1;
                htmlSdkLinkType = websiteSdkLinkType = HtmlSdkLinkType.Msdn;
                help2SdkLinkType = MSHelp2SdkLinkType.Msdn;
                helpViewerSdkLinkType = MSHelpViewerSdkLinkType.Msdn;
                sdkLinkTarget = SdkLinkTarget.Blank;
                presentationStyle = Constants.DefaultPresentationStyle;
                namingMethod = NamingMethod.Guid;
                syntaxFilters = ComponentUtilities.DefaultSyntaxFilter;
                collectionTocStyle = CollectionTocStyle.Hierarchical;
                helpFileVersion = "1.0.0.0";
                tocOrder = -1;
                maximumGroupParts = 2;

                this.OutputPath = null;
                this.HtmlHelp1xCompilerPath = this.HtmlHelp2xCompilerPath = this.WorkingPath =
                    this.ComponentPath = null;

                this.HelpTitle = this.HtmlHelpName = this.CopyrightHref = this.CopyrightText =
                    this.FeedbackEMailAddress = this.FeedbackEMailLinkText = this.HeaderText = this.FooterText =
                    this.ProjectSummary = this.RootNamespaceTitle = this.PlugInNamespaces = this.TopicVersion =
                    this.TocParentId = this.TocParentVersion = this.CatalogProductId = this.CatalogVersion =
                    this.CatalogName = null;
                this.FrameworkVersion = null;

                language = new CultureInfo("en-US");
            }
            finally
            {
                loadingProperties = false;
            }
        }