public IActionResult Index()
        {
            IndexViewModel model = new IndexViewModel(GetModelData(),
                                                      _documentationService.GetCustomData("Header", Languages.LanguageStrings.APIReference),
                                                      _documentationService.GetCustomData("Description", Languages.LanguageStrings.InThisDocument));

            List <Document> documents = _documentationService.GetDocuments()
                                        .Where(d => d.DocumentType == DocumentType.Assembly || d.DocumentType == DocumentType.Custom)
                                        .OrderBy(o => o.SortOrder).ThenBy(o => o.Title)
                                        .ToList();

            foreach (Document doc in documents)
            {
                if (!model.AssemblyNames.ContainsKey(doc.Title))
                {
                    if (String.IsNullOrEmpty(doc.ShortDescription))
                    {
                        _logger.AddToLog(LogLevel.Information, $"No short description for document {doc.Title}");
                    }

                    model.AssemblyNames.Add(doc.Title, new DocumentationModule(doc.Title, doc.ShortDescription));
                }
            }

            return(View(model));
        }
Beispiel #2
0
        protected override bool Run(object parameters)
        {
            DocumentPostProcess documentPostProcess = new DocumentPostProcess(
                _documentationService.GetDocuments());

            PostProcessResults results = documentPostProcess.Process();

            return(results.DocumentsProcessed == 0);
        }
        protected void InitializeDocumentationPluginManager()
        {
            lock (_testPluginDocs)
            {
                while (_pluginLoadedDocs.HasValue && !_pluginLoadedDocs.Value)
                {
                    System.Threading.Thread.Sleep(30);
                }

                if (_pluginLoadedDocs.HasValue && _pluginLoadedDocs.Value)
                {
                    return;
                }

                if (_pluginLoadedDocs == null)
                {
                    _pluginLoadedDocs = false;
                }

                _testPluginDocs.AddAssembly(Assembly.GetExecutingAssembly());
                _testPluginDocs.UsePlugin(typeof(DemoWebsite.Classes.PluginInitialisation));
                _testPluginDocs.UsePlugin(typeof(DocumentationPlugin.PluginInitialisation));
                _testPluginDocs.UsePlugin(typeof(MemoryCache.Plugin.PluginInitialisation));
                _testPluginDocs.UsePlugin(typeof(ProductPlugin.PluginInitialisation));
                _testPluginDocs.UsePlugin(typeof(SearchPlugin.PluginInitialisation));
                _testPluginDocs.UsePlugin(typeof(BadEgg.Plugin.PluginInitialisation));

                _testPluginDocs.ConfigureServices();

                _pluginServicesDocs = new pm.PluginServices(_testPluginDocs) as IPluginClassesService;
                TimeSpan docLoadTime   = new TimeSpan(0, 0, 30);
                DateTime startLoadDocs = DateTime.Now;

                while (Shared.Classes.ThreadManager.Exists(SharedPluginFeatures.Constants.DocumentationLoadThread))
                {
                    System.Threading.Thread.Sleep(100);

                    if (DateTime.Now - startLoadDocs > docLoadTime)
                    {
                        break;
                    }
                }

                Assert.IsFalse(Shared.Classes.ThreadManager.Exists(Constants.DocumentationLoadThread));

                _documentationService = (IDocumentationService)_testPluginDocs.GetServiceProvider()
                                        .GetService(typeof(IDocumentationService));

                Assert.IsNotNull(_documentationService);

                Assert.IsTrue(_documentationService.GetDocuments().Count > 100);
                _pluginLoadedDocs = true;
            }

            Assert.IsNotNull(_pluginServicesDocs);
        }
Beispiel #4
0
        public void FindAllProvidersAndRetrieveInstanciatedClasses()
        {
            Assert.IsFalse(Shared.Classes.ThreadManager.Exists(SharedPluginFeatures.Constants.DocumentationLoadThread));

            IDocumentationService documentationService = (IDocumentationService)_documentationLoadPlugin.GetServiceProvider()
                                                         .GetService(typeof(IDocumentationService));

            Assert.IsNotNull(documentationService);

            Assert.IsTrue(documentationService.GetDocuments().Count > 100);
        }
        /// <summary>
        /// Retrieve a list of all documents that will be included in the sitemap
        /// </summary>
        /// <returns>List&lt;ISitemapItem&gt;</returns>
        public List <SitemapItem> Items()
        {
            List <SitemapItem> Result = new List <SitemapItem>();

            List <Document> documents = _documentationService.GetDocuments()
                                        .Where(d => d.DocumentType == DocumentType.Assembly || d.DocumentType == DocumentType.Custom)
                                        .OrderBy(o => o.SortOrder).ThenBy(o => o.Title)
                                        .ToList();

            foreach (Document document in documents)
            {
                Uri blogUrl = new Uri($"docs/Document/{HtmlHelper.RouteFriendlyName(document.Title)}/",
                                      UriKind.RelativeOrAbsolute);

                Result.Add(new SitemapItem(blogUrl, SitemapChangeFrequency.Daily));
            }

            return(Result);
        }
 protected override bool Run(object parameters)
 {
     _documentationService.GetDocuments();
     return(false);
 }