예제 #1
0
 public string GetPath(IndexerPage page) => Path.Combine(GetTypeDirRelative(page.Model.TypeDocumentation), "indexers", $"{page.Model.Name}.md");
예제 #2
0
        private void LoadPages()
        {
            var linkProvider = new CompositeLinkProvider(new InternalLinkProvider(m_Model, this, m_DocumentSet));

            m_Logger.LogInformation("Loading pages");

            foreach (var @namespace in m_Model.Namespaces)
            {
                var page = new NamespacePage(linkProvider, m_Configuration, @namespace, m_Logger);
                m_PagesByModel.Add(@namespace, page);
                m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
            }

            foreach (var assembly in m_Model.Assemblies)
            {
                foreach (var type in assembly.Types)
                {
                    var typePage = new TypePage(linkProvider, m_Configuration, type, m_Logger);
                    m_PagesByModel.Add(type, typePage);
                    m_DocumentSet.Add(m_PathProvider.GetPath(typePage), typePage);

                    foreach (var property in type.Properties)
                    {
                        var page = new PropertyPage(linkProvider, m_Configuration, property, m_Logger);
                        m_PagesByModel.Add(property, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }

                    foreach (var indexer in type.Indexers)
                    {
                        var page = new IndexerPage(linkProvider, m_Configuration, indexer, m_Logger);
                        m_PagesByModel.Add(indexer, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }

                    if (type.Constructors != null)
                    {
                        var page = new ConstructorsPage(linkProvider, m_Configuration, type.Constructors, m_Logger);
                        m_PagesByModel.Add(type.Constructors, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }

                    foreach (var method in type.Methods)
                    {
                        var page = new MethodPage(linkProvider, m_Configuration, method, m_Logger);
                        m_PagesByModel.Add(method, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }

                    if (type.Kind != TypeKind.Enum)
                    {
                        foreach (var field in type.Fields)
                        {
                            var page = new FieldPage(linkProvider, m_Configuration, field, m_Logger);
                            m_PagesByModel.Add(field, page);
                            m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                        }
                    }

                    foreach (var ev in type.Events)
                    {
                        var page = new EventPage(linkProvider, m_Configuration, ev, m_Logger);
                        m_PagesByModel.Add(ev, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }

                    foreach (var op in type.Operators)
                    {
                        var page = new OperatorPage(linkProvider, m_Configuration, op, m_Logger);
                        m_PagesByModel.Add(op, page);
                        m_DocumentSet.Add(m_PathProvider.GetPath(page), page);
                    }
                }
            }
        }