示例#1
0
文件: Startup.cs 项目: 274188A/Atlas
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              AtlasDbContext atlasDbContext,
                              ApplicationDbContext applicationDbContext,
                              IInstallationService installationService,
                              IDocumentationService documentationService)
        {
            if (env.IsDevelopment())
            {
                app.UseExceptionHandler("/Error");

                //app.UseDeveloperExceptionPage();
                //app.UseDatabaseErrorPage();
                app.UseWebAssemblyDebugging();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseBlazorFrameworkFiles();
            app.UseStaticFiles();
            //app.UseStaticFiles(new StaticFileOptions
            //{
            //    FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"Uploads")),
            //    RequestPath = new PathString("/Uploads")
            //});

            app.UseRouting();

            app.UseIdentityServer();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
                endpoints.MapFallbackToFile("index.html");
            });

            if (Configuration["MigrateDatabases"] == "true")
            {
                atlasDbContext.Database.Migrate();
                applicationDbContext.Database.Migrate();
            }

            if (Configuration["EnsureDefaultSiteInitialized"] == "true")
            {
                installationService.EnsureDefaultSiteInitializedAsync().Wait();
            }

            if (Configuration["GenerateDocumentationOnStartup"] == "true")
            {
                documentationService.Generate(typeof(Site).Assembly);
            }
        }
示例#2
0
 public FileController(ILogger <FileController> logger, IWebHostEnvironment hostEnvironment, IOptions <LiveDocsOptions> options, IDocumentationService documentationService)
 {
     _Logger               = logger;
     _HostEnvironment      = hostEnvironment;
     _Options              = options.Value;
     _DocumentationService = documentationService;
 }
示例#3
0
 public EpgpModule(
     IPriorityReportingService priorityReportingService,
     IQueryService queryService,
     IEpgpService epgpService,
     IAuditService auditService,
     IEpgpCalculator epgpCalculator,
     IEpgpConfigurationService epgpConfigurationService,
     IPageService pageService,
     IDocumentationService documentationService,
     IEmoteService emoteService,
     IAliasService aliasService,
     IItemService itemService,
     IRaidService raidService,
     IAdministrationService administrationService,
     BuzzBotDbContext dbContext, IUserService userService, IMapper mapper, IDecayProcessor decayProcessor)
 {
     _priorityReportingService = priorityReportingService;
     _queryService             = queryService;
     _epgpService              = epgpService;
     _auditService             = auditService;
     _epgpCalculator           = epgpCalculator;
     _epgpConfigurationService = epgpConfigurationService;
     _pageService              = pageService;
     _documentationService     = documentationService;
     _emoteService             = emoteService;
     _aliasService             = aliasService;
     _itemService              = itemService;
     _raidService              = raidService;
     _administrationService    = administrationService;
     _dbContext      = dbContext;
     _userService    = userService;
     _mapper         = mapper;
     _decayProcessor = decayProcessor;
 }
        public DocsController(IDocumentationService documentationService, ILogger logger,
            ISettingsProvider settingsProvider)
        {
            if (settingsProvider == null)
                throw new ArgumentNullException(nameof(settingsProvider));

            _documentationService = documentationService ?? throw new ArgumentNullException(nameof(documentationService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }
        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);
        }
示例#6
0
        public override void SetUp()
        {
            base.SetUp();

            _xmlDocumentation     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources/SimpleInjector.xml");
            _documentationService = new DocumentationService(
                new PluginFinder(new AppDomainTypeFinder(new FakeAssemblyFinder(new List <Assembly> {
                typeof(DocumentationMember).Assembly
            })),
                                 new TinyIoCContainer()));
        }
示例#7
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);
        }
示例#8
0
 public RaidModule(
     IRaidService raidService,
     IRaidFactory raidFactory,
     IEpgpConfigurationService epgpConfigurationService,
     IDocumentationService documentationService,
     IPageService pageService)
 {
     _raidService = raidService;
     _raidFactory = raidFactory;
     _epgpConfigurationService = epgpConfigurationService;
     _documentationService     = documentationService;
     _pageService = pageService;
 }
示例#9
0
 public BankModule(
     ClassicGuildBankClient client,
     CommandService commandService,
     ItemRequestService itemRequestService,
     IAdministrationService administrationService,
     IPageService pageService,
     IDocumentationService documentationService,
     IBankService bankService)
 {
     _client                = client;
     _commandService        = commandService;
     _itemRequestService    = itemRequestService;
     _administrationService = administrationService;
     _pageService           = pageService;
     _documentationService  = documentationService;
     _bankService           = bankService;
 }
        public MainRegionViewModel(IEventAggregator eventAggregator,
            IResourceDictionaryProvider resourceDictionaryProvider,
            IApplicationProperties appliationProperties,
            IEventContext eventContext,
            IObjectServiceOperations objectServiceOperations,
            IInteractionService interactionService,
            IHistoricalTimeUtility historicalTimeUtility,
            IPropertyNameService columnNameService,
            IHistoricalColumnService historicalColumnService,
            ISerializationService serializationService,
            IHelpExtension helpExtension,
            IValueFormatter valueFormatter,
            IHdaFileExportService hdaFileExportService,
            IDocumentationService documentationService)
            : base(eventContext, objectServiceOperations,
                  interactionService, historicalTimeUtility,
                  columnNameService, historicalColumnService,
                  serializationService, helpExtension,
                  valueFormatter, eventAggregator,
                  hdaFileExportService, documentationService)
        {
            _eventAggregator = eventAggregator;
            _eventContext = eventContext;
            _historicalTimeUtility = historicalTimeUtility;

            if (HistoricalExcelService.Current == null)
                HistoricalExcelService.Current = new HistoricalExcelService(this,
                    eventContext, objectServiceOperations, interactionService, historicalTimeUtility, valueFormatter, appliationProperties);

            ItemsHistoricalTimePeriodViewModel.Items.CollectionChanged += Items_CollectionChanged;

            ListViewModel.ExportCommand = new DelegateCommand(ExportPropertyList);
            ListViewModel.ExportCommandText = interactionService.TranslatingService.GetSystemText("Import");

            EventListViewModel.ExportCommand = new DelegateCommand(ExportEventList);
            EventListViewModel.ExportCommandText = interactionService.TranslatingService.GetSystemText("Import");

            SubscribeEvents();
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="documentationService">IDocumentationService instance</param>
 public DocumentationSitemapProvider(IDocumentationService documentationService)
 {
     _documentationService = documentationService ?? throw new ArgumentNullException(nameof(documentationService));
 }
示例#12
0
 public LandingController(IDocumentationService service)
 {
     _service = service;
 }
示例#13
0
 public Worker(ILogger <Worker> logger, IHostApplicationLifetime applicationLifetime, IDocumentationService documentationService)
 {
     _Logger = logger;
     _ApplicationLifetime  = applicationLifetime;
     _DocumentationService = documentationService;
 }
示例#14
0
 public EntityFieldPartDriver(IDocumentationService documentationService)
 {
     _documentationService = documentationService;
 }
示例#15
0
 public DocumentationController(IDocumentationService documentationService, ICacheManager cacheManager)
 {
     _documentationService = documentationService;
     _cacheManager         = cacheManager;
 }
示例#16
0
        public DocumentationMember(XmlNode memberNode, IDocumentationService documentationService)
        {
            _memberNode = memberNode;

            var nameAttribute = _memberNode.Attributes["name"];
            if(nameAttribute == null) throw new InvalidOperationException("The member doesn't have a name attribute");

            switch (nameAttribute.Value.Substring(0, 2))
            {
                case "T:":
                    Type = DocumentationMemberType.Type;
                    break;
                case "M:":
                    Type = DocumentationMemberType.Member;
                    break;
                case "P:":
                    Type = DocumentationMemberType.Property;
                    break;
                case "E:":
                    Type = DocumentationMemberType.Event;
                    break;
                case "F:":
                    Type = DocumentationMemberType.Field;
                    break;
                default:
                    throw new InvalidOperationException("Unknown member type " + nameAttribute.Value.Substring(0, 2));
            }

            FullMemberName = nameAttribute.Value.Substring(2);
            var memberNameMatch = Regex.Match(FullMemberName, @"\.[\w\`\+\#\@]+(.#ctor)?(\([\w\.\,\`\+\{\}\[\]\#\@]*\))?$").Value;
            if (string.IsNullOrEmpty(memberNameMatch))
                throw new Exception("Couldn't get member name");
            MemberName = memberNameMatch.Substring(1);
            if (MemberName.IndexOf(".#ctor", StringComparison.Ordinal) > 0)
                MemberName = MemberName.Substring(0, MemberName.IndexOf(".#ctor", StringComparison.Ordinal));
            if (MemberName.IndexOf("(", StringComparison.Ordinal) > 0)
                MemberName = MemberName.Substring(0, MemberName.IndexOf("(", StringComparison.Ordinal));

            IsConstructor = FullMemberName.Contains(".#ctor");

            ParameterTypes = new List<string>();
            if(Type == DocumentationMemberType.Member)
            {
                var parameterTypesMatch = Regex.Match(FullMemberName, @"\([\w\.\,]*\)$");
                if (parameterTypesMatch.Success)
                {
                    var parameterTypesRaw = parameterTypesMatch.Value.Substring(1);
                    parameterTypesRaw = parameterTypesRaw.Substring(0, parameterTypesRaw.Length - 1);
                    foreach(var parameterType in parameterTypesRaw.Split(Convert.ToChar(",")))
                    {
                        ParameterTypes.Add(parameterType);
                    }
                }
            }

            MemberInfos = new List<DocumentationMemberInfo>();
            MemberInfos.AddRange(documentationService.GetInfosForMember(memberNode));
            MemberSummary = MemberInfos.OfType<DocumentationMemberSummary>().FirstOrDefault();
            MemberReturns = MemberInfos.OfType<DocumentationMemberReturns>().FirstOrDefault();
            MemberValue = MemberInfos.OfType<DocumentationMemberValue>().FirstOrDefault();
            MemberParameters = MemberInfos.OfType<DocumentationMemberParameter>().ToList();

            foreach (var memberParameter in MemberParameters)
            {
                var memberParameterIndex = MemberParameters.IndexOf(memberParameter);
                if((ParameterTypes.Count - 1) >= memberParameterIndex)
                {
                    memberParameter.ParameterType = memberParameter.CleanText(ParameterTypes[memberParameterIndex]);
                }
            }
        }
示例#17
0
 public EndpointPartDriver(IDocumentationService documentationService)
 {
     _documentationService = documentationService;
 }
示例#18
0
        public override void SetUp()
        {
            base.SetUp();

            _xmlDocumentation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources/SimpleInjector.xml");
            _documentationService = new DocumentationService(
                new PluginFinder(new AppDomainTypeFinder(new FakeAssemblyFinder(new List<Assembly>{typeof(DocumentationMember).Assembly})),
                new TinyIoCContainer()));
        }
示例#19
0
 public ErrorResultPartDriver(IDocumentationService documentationService)
 {
     _documentationService = documentationService;
 }
示例#20
0
 public NavController(IDocumentationService repo)
 {
     _service = repo;
     helper = new UrlHelper(new System.Web.Routing.RequestContext(), RouteTable.Routes);
 }
示例#21
0
 public DocumentationsController(IDocumentationService documentationService) => _documentationService = documentationService;
示例#22
0
 public DataModule(BuzzBotDbContext dbContext, IPageService pageService, IDocumentationService documentationService)
 {
     _dbContext            = dbContext;
     _pageService          = pageService;
     _documentationService = documentationService;
 }
示例#23
0
 internal DocumentLoadThread(IDocumentationService documentationService)
     : base(null, new TimeSpan(0, 5, 0))
 {
     HangTimeout           = 0;
     _documentationService = documentationService ?? throw new ArgumentNullException(nameof(documentationService));
 }
示例#24
0
 public EntityDefinitionPartDriver(IDocumentationService documentationService)
 {
     _documentationService = documentationService;
 }
示例#25
0
 public ProjectController(IDocumentationService repo)
 {
     _service = repo;
     ViewBag.PartialResult = false;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="documentationService">IDocumentationService instance</param>
 public KeywordSearchProvider(IDocumentationService documentationService)
 {
     _documentationService = documentationService ?? throw new ArgumentNullException(nameof(documentationService));
 }
示例#27
0
        public DocumentationMember(XmlNode memberNode, IDocumentationService documentationService)
        {
            _memberNode = memberNode;

            var nameAttribute = _memberNode.Attributes["name"];

            if (nameAttribute == null)
            {
                throw new InvalidOperationException("The member doesn't have a name attribute");
            }

            switch (nameAttribute.Value.Substring(0, 2))
            {
            case "T:":
                Type = DocumentationMemberType.Type;
                break;

            case "M:":
                Type = DocumentationMemberType.Member;
                break;

            case "P:":
                Type = DocumentationMemberType.Property;
                break;

            case "E:":
                Type = DocumentationMemberType.Event;
                break;

            case "F:":
                Type = DocumentationMemberType.Field;
                break;

            default:
                throw new InvalidOperationException("Unknown member type " + nameAttribute.Value.Substring(0, 2));
            }

            FullMemberName = nameAttribute.Value.Substring(2);
            var memberNameMatch = Regex.Match(FullMemberName, @"\.[\w\`\+\#\@]+(.#ctor)?(\([\w\.\,\`\+\{\}\[\]\#\@]*\))?$").Value;

            if (string.IsNullOrEmpty(memberNameMatch))
            {
                throw new Exception("Couldn't get member name");
            }
            MemberName = memberNameMatch.Substring(1);
            if (MemberName.IndexOf(".#ctor", StringComparison.Ordinal) > 0)
            {
                MemberName = MemberName.Substring(0, MemberName.IndexOf(".#ctor", StringComparison.Ordinal));
            }
            if (MemberName.IndexOf("(", StringComparison.Ordinal) > 0)
            {
                MemberName = MemberName.Substring(0, MemberName.IndexOf("(", StringComparison.Ordinal));
            }

            IsConstructor = FullMemberName.Contains(".#ctor");

            ParameterTypes = new List <string>();
            if (Type == DocumentationMemberType.Member)
            {
                var parameterTypesMatch = Regex.Match(FullMemberName, @"\([\w\.\,]*\)$");
                if (parameterTypesMatch.Success)
                {
                    var parameterTypesRaw = parameterTypesMatch.Value.Substring(1);
                    parameterTypesRaw = parameterTypesRaw.Substring(0, parameterTypesRaw.Length - 1);
                    foreach (var parameterType in parameterTypesRaw.Split(Convert.ToChar(",")))
                    {
                        ParameterTypes.Add(parameterType);
                    }
                }
            }

            MemberInfos = new List <DocumentationMemberInfo>();
            MemberInfos.AddRange(documentationService.GetInfosForMember(memberNode));
            MemberSummary    = MemberInfos.OfType <DocumentationMemberSummary>().FirstOrDefault();
            MemberReturns    = MemberInfos.OfType <DocumentationMemberReturns>().FirstOrDefault();
            MemberValue      = MemberInfos.OfType <DocumentationMemberValue>().FirstOrDefault();
            MemberParameters = MemberInfos.OfType <DocumentationMemberParameter>().ToList();

            foreach (var memberParameter in MemberParameters)
            {
                var memberParameterIndex = MemberParameters.IndexOf(memberParameter);
                if ((ParameterTypes.Count - 1) >= memberParameterIndex)
                {
                    memberParameter.ParameterType = memberParameter.CleanText(ParameterTypes[memberParameterIndex]);
                }
            }
        }