public SdkAcquirer(HttpClient httpClient, ITextWriter textWriter, IInstallerLauncher installerLauncher, IPlatformIdentifier platformIdentifier)
 {
     _httpClient         = httpClient;
     _textWriter         = textWriter;
     _installerLauncher  = installerLauncher;
     _platformIdentifier = platformIdentifier;
 }
 /// <summary>
 /// Construct an <see cref="AdministrationController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/></param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="generalConfiguration"/></param>
 public AdministrationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     IServerControl serverUpdater,
     IApplication application,
     IIOManager ioManager,
     IPlatformIdentifier platformIdentifier,
     ILogger <AdministrationController> logger,
     IOptions <UpdatesConfiguration> updatesConfigurationOptions,
     IOptions <GeneralConfiguration> generalConfigurationOptions)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         false,
         true)
 {
     this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.serverUpdater       = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.application         = application ?? throw new ArgumentNullException(nameof(application));
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     updatesConfiguration     = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
     generalConfiguration     = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdministrationController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
 /// <param name="serverControl">The value of <see cref="serverControl"/>.</param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/>.</param>
 /// <param name="fileLoggingConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="fileLoggingConfiguration"/>.</param>
 public AdministrationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     IServerControl serverControl,
     IServerUpdateInitiator serverUpdater,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIOManager ioManager,
     IPlatformIdentifier platformIdentifier,
     IFileTransferTicketProvider fileTransferService,
     ILogger <AdministrationController> logger,
     IOptions <UpdatesConfiguration> updatesConfigurationOptions,
     IOptions <FileLoggingConfiguration> fileLoggingConfigurationOptions)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.gitHubClientFactory         = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.serverControl               = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     this.serverUpdater               = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
     updatesConfiguration     = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
     fileLoggingConfiguration = fileLoggingConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
 }
        /// <summary>
        /// Gets the evaluated log <see cref="Directory"/>.
        /// </summary>
        /// <param name="ioManager">The <see cref="IIOManager"/> to use.</param>
        /// <param name="assemblyInformationProvider">The <see cref="IAssemblyInformationProvider"/> to use.</param>
        /// <param name="platformIdentifier">The <see cref="IPlatformIdentifier"/> to use</param>
        /// <returns>The evaluated log <see cref="Directory"/>.</returns>
        public string GetFullLogDirectory(
            IIOManager ioManager,
            IAssemblyInformationProvider assemblyInformationProvider,
            IPlatformIdentifier platformIdentifier)
        {
            if (ioManager == null)
            {
                throw new ArgumentNullException(nameof(ioManager));
            }
            if (assemblyInformationProvider == null)
            {
                throw new ArgumentNullException(nameof(assemblyInformationProvider));
            }
            if (platformIdentifier == null)
            {
                throw new ArgumentNullException(nameof(platformIdentifier));
            }

            var directoryToUse = platformIdentifier.IsWindows
                                ? Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) // C:/ProgramData
                                : "/var/log";                                                                // :pain:

            return(!String.IsNullOrEmpty(Directory)
                                ? Directory
                                : ioManager.ConcatPath(
                       directoryToUse,
                       assemblyInformationProvider.VersionPrefix));
        }
Beispiel #5
0
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="portAllocator">The value of <see cref="IPortAllocator"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="swarmConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="swarmConfiguration"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public InstanceController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IJobManager jobManager,
     IInstanceManager instanceManager,
     IIOManager ioManager,
     IPortAllocator portAllocator,
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <SwarmConfiguration> swarmConfigurationOptions,
     ILogger <InstanceController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.jobManager         = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager    = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager          = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.portAllocator      = portAllocator ?? throw new ArgumentNullException(nameof(portAllocator));
     generalConfiguration    = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     swarmConfiguration      = swarmConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(swarmConfigurationOptions));
 }
Beispiel #6
0
 /// <summary>
 /// Construct a <see cref="SessionControllerFactory"/>
 /// </summary>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
 /// <param name="byond">The value of <see cref="byond"/></param>
 /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="instance">The value of <see cref="instance"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="chat">The value of <see cref="chat"/></param>
 /// <param name="networkPromptReaper">The value of <see cref="networkPromptReaper"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
 public SessionControllerFactory(
     IProcessExecutor processExecutor,
     IByondManager byond,
     IByondTopicSender byondTopicSender,
     ICryptographySuite cryptographySuite,
     IApplication application,
     IIOManager ioManager,
     IChat chat,
     INetworkPromptReaper networkPromptReaper,
     IPlatformIdentifier platformIdentifier,
     ILoggerFactory loggerFactory,
     Api.Models.Instance instance)
 {
     this.processExecutor   = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.byond             = byond ?? throw new ArgumentNullException(nameof(byond));
     this.byondTopicSender  = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
     this.cryptographySuite = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.application       = application ?? throw new ArgumentNullException(nameof(application));
     this.instance          = instance ?? throw new ArgumentNullException(nameof(instance));
     this.ioManager         = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
     this.networkPromptReaper = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.loggerFactory       = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
 }
 /// <summary>
 /// Construct a <see cref="HomeController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="tokenFactory">The value of <see cref="tokenFactory"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="identityCache">The value of <see cref="identityCache"/></param>
 /// <param name="oAuthProviders">The value of <see cref="oAuthProviders"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="browserResolver">The value of <see cref="browserResolver"/></param>
 /// <param name="swarmService">The value of <see cref="swarmService"/>.</param>
 /// <param name="serverControl">The value of <see cref="serverControl"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="controlPanelConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="controlPanelConfiguration"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public HomeController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ITokenFactory tokenFactory,
     ISystemIdentityFactory systemIdentityFactory,
     ICryptographySuite cryptographySuite,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIdentityCache identityCache,
     IOAuthProviders oAuthProviders,
     IPlatformIdentifier platformIdentifier,
     IBrowserResolver browserResolver,
     ISwarmService swarmService,
     IServerControl serverControl,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <ControlPanelConfiguration> controlPanelConfigurationOptions,
     ILogger <HomeController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         false)
 {
     this.tokenFactory                = tokenFactory ?? throw new ArgumentNullException(nameof(tokenFactory));
     this.systemIdentityFactory       = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory));
     this.cryptographySuite           = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.identityCache               = identityCache ?? throw new ArgumentNullException(nameof(identityCache));
     this.platformIdentifier          = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.oAuthProviders              = oAuthProviders ?? throw new ArgumentNullException(nameof(oAuthProviders));
     this.browserResolver             = browserResolver ?? throw new ArgumentNullException(nameof(browserResolver));
     this.swarmService                = swarmService ?? throw new ArgumentNullException(nameof(swarmService));
     this.serverControl               = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     generalConfiguration             = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     controlPanelConfiguration        = controlPanelConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(controlPanelConfigurationOptions));
 }
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IJobManager jobManager, IInstanceManager instanceManager, IIOManager ioManager, IApplication application, IPlatformIdentifier platformIdentifier, ILogger <InstanceController> logger) : base(databaseContext, authenticationContextFactory, logger, false, true)
 {
     this.jobManager         = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager    = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager          = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.application        = application ?? throw new ArgumentNullException(nameof(application));
     this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostSetupServices"/> <see langword="class"/>.
 /// </summary>
 /// <param name="platformIdentifier">The value of <see cref="PlatformIdentifier"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="GeneralConfiguration"/>.</param>
 /// <param name="databaseConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="DatabaseConfiguration"/>.</param>
 /// <param name="fileLoggingConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="FileLoggingConfiguration"/>.</param>
 public PostSetupServices(
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <DatabaseConfiguration> databaseConfigurationOptions,
     IOptions <FileLoggingConfiguration> fileLoggingConfigurationOptions)
 {
     PlatformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.generalConfigurationOptions     = generalConfigurationOptions ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     this.databaseConfigurationOptions    = databaseConfigurationOptions ?? throw new ArgumentNullException(nameof(databaseConfigurationOptions));
     this.fileLoggingConfigurationOptions = fileLoggingConfigurationOptions ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
 }
        /// <summary>
        /// Construct <see cref="Configuration"/>
        /// </summary>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/></param>
        /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/></param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/></param>
        /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        public Configuration(IIOManager ioManager, ISynchronousIOManager synchronousIOManager, ISymlinkFactory symlinkFactory, IProcessExecutor processExecutor, IPostWriteHandler postWriteHandler, IPlatformIdentifier platformIdentifier, ILogger <Configuration> logger)
        {
            this.ioManager            = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.synchronousIOManager = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
            this.symlinkFactory       = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
            this.processExecutor      = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.postWriteHandler     = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
            this.platformIdentifier   = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            semaphore = new SemaphoreSlim(1);
        }
Beispiel #11
0
 /// <summary>
 /// Construct a <see cref="SetupWizard"/>
 /// </summary>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="console">The value of <see cref="console"/></param>
 /// <param name="hostingEnvironment">The value of <see cref="hostingEnvironment"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="dbConnectionFactory">The value of <see cref="dbConnectionFactory"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="asyncDelayer">The value of <see cref="asyncDelayer"/></param>
 /// <param name="logger">The value of <see cref="logger"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/></param>
 public SetupWizard(IIOManager ioManager, IConsole console, IHostingEnvironment hostingEnvironment, IApplication application, IDBConnectionFactory dbConnectionFactory, IPlatformIdentifier platformIdentifier, IAsyncDelayer asyncDelayer, ILogger <SetupWizard> logger, IOptions <GeneralConfiguration> generalConfigurationOptions)
 {
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.console             = console ?? throw new ArgumentNullException(nameof(console));
     this.hostingEnvironment  = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
     this.application         = application ?? throw new ArgumentNullException(nameof(application));
     this.dbConnectionFactory = dbConnectionFactory ?? throw new ArgumentNullException(nameof(dbConnectionFactory));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.asyncDelayer        = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
     this.logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceFactory"/> class.
 /// </summary>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/>.</param>
 /// <param name="topicClientFactory">The value of <see cref="topicClientFactory"/>.</param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/>.</param>
 /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/>.</param>
 /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/>.</param>
 /// <param name="byondInstaller">The value of <see cref="byondInstaller"/>.</param>
 /// <param name="chatFactory">The value of <see cref="chatFactory"/>.</param>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/>.</param>
 /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/>.</param>
 /// <param name="watchdogFactory">The value of <see cref="watchdogFactory"/>.</param>
 /// <param name="jobManager">The value of <see cref="jobManager"/>.</param>
 /// <param name="networkPromptReaper">The value of <see cref="networkPromptReaper"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="repositoryFactory">The value of <see cref="repositoryFactory"/>.</param>
 /// <param name="repositoryCommands">The value of <see cref="repositoryCommands"/>.</param>
 /// <param name="serverPortProvider">The value of <see cref="serverPortProvider"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="gitRemoteFeaturesFactory">The value of <see cref="gitRemoteFeaturesFactory"/>.</param>
 /// <param name="remoteDeploymentManagerFactory">The value of <see cref="remoteDeploymentManagerFactory"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 public InstanceFactory(
     IIOManager ioManager,
     IDatabaseContextFactory databaseContextFactory,
     IAssemblyInformationProvider assemblyInformationProvider,
     ILoggerFactory loggerFactory,
     ITopicClientFactory topicClientFactory,
     ICryptographySuite cryptographySuite,
     ISynchronousIOManager synchronousIOManager,
     ISymlinkFactory symlinkFactory,
     IByondInstaller byondInstaller,
     IChatManagerFactory chatFactory,
     IProcessExecutor processExecutor,
     IPostWriteHandler postWriteHandler,
     IWatchdogFactory watchdogFactory,
     IJobManager jobManager,
     INetworkPromptReaper networkPromptReaper,
     IPlatformIdentifier platformIdentifier,
     ILibGit2RepositoryFactory repositoryFactory,
     ILibGit2Commands repositoryCommands,
     IServerPortProvider serverPortProvider,
     IFileTransferTicketProvider fileTransferService,
     IGitRemoteFeaturesFactory gitRemoteFeaturesFactory,
     IRemoteDeploymentManagerFactory remoteDeploymentManagerFactory,
     IOptions <GeneralConfiguration> generalConfigurationOptions)
 {
     this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.databaseContextFactory      = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.loggerFactory                  = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.topicClientFactory             = topicClientFactory ?? throw new ArgumentNullException(nameof(topicClientFactory));
     this.cryptographySuite              = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.synchronousIOManager           = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
     this.symlinkFactory                 = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
     this.byondInstaller                 = byondInstaller ?? throw new ArgumentNullException(nameof(byondInstaller));
     this.chatFactory                    = chatFactory ?? throw new ArgumentNullException(nameof(chatFactory));
     this.processExecutor                = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.postWriteHandler               = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
     this.watchdogFactory                = watchdogFactory ?? throw new ArgumentNullException(nameof(watchdogFactory));
     this.jobManager                     = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.networkPromptReaper            = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
     this.platformIdentifier             = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.repositoryFactory              = repositoryFactory ?? throw new ArgumentNullException(nameof(repositoryFactory));
     this.repositoryCommands             = repositoryCommands ?? throw new ArgumentNullException(nameof(repositoryCommands));
     this.serverPortProvider             = serverPortProvider ?? throw new ArgumentNullException(nameof(serverPortProvider));
     this.fileTransferService            = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
     this.gitRemoteFeaturesFactory       = gitRemoteFeaturesFactory ?? throw new ArgumentNullException(nameof(gitRemoteFeaturesFactory));
     this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory));
     generalConfiguration                = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
Beispiel #13
0
 /// <summary>
 /// Construct a <see cref="DatabaseSeeder"/>
 /// </summary>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="databaseConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="databaseConfiguration"/>.</param>
 /// <param name="databaseLogger">The value of <see cref="databaseLogger"/></param>
 /// <param name="logger">The value of <see cref="logger"/>.</param>
 public DatabaseSeeder(
     ICryptographySuite cryptographySuite,
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <DatabaseConfiguration> databaseConfigurationOptions,
     ILogger <DatabaseContext> databaseLogger,
     ILogger <DatabaseSeeder> logger)
 {
     this.cryptographySuite  = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     databaseConfiguration   = databaseConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(databaseConfigurationOptions));
     generalConfiguration    = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     this.databaseLogger     = databaseLogger ?? throw new ArgumentNullException(nameof(databaseLogger));
     this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Beispiel #14
0
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IJobManager jobManager,
     IInstanceManager instanceManager,
     IIOManager ioManager,
     IAssemblyInformationProvider assemblyInformationProvider,
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     ILogger <InstanceController> logger)
     : base(databaseContext, authenticationContextFactory, logger, false, true)
 {
     this.jobManager                  = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager             = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager                   = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.platformIdentifier          = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     generalConfiguration             = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PostSetupServices{TLoggerType}"/> <see langword="class"/>.
        /// </summary>
        /// <param name="platformIdentifier">The value of <see cref="PlatformIdentifier"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> used to create <see cref="Logger"/>.</param>
        /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="GeneralConfiguration"/>.</param>
        /// <param name="databaseConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="DatabaseConfiguration"/>.</param>
        /// <param name="securityConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="SecurityConfiguration"/>.</param>
        /// <param name="fileLoggingConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="FileLoggingConfiguration"/>.</param>
        public PostSetupServices(
            IPlatformIdentifier platformIdentifier,
            ILoggerFactory loggerFactory,
            IOptions <GeneralConfiguration> generalConfigurationOptions,
            IOptions <DatabaseConfiguration> databaseConfigurationOptions,
            IOptions <SecurityConfiguration> securityConfigurationOptions,
            IOptions <FileLoggingConfiguration> fileLoggingConfigurationOptions)
        {
            PlatformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            Logger = loggerFactory.CreateLogger <TLoggerType>();
            this.generalConfigurationOptions     = generalConfigurationOptions ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
            this.databaseConfigurationOptions    = databaseConfigurationOptions ?? throw new ArgumentNullException(nameof(databaseConfigurationOptions));
            this.securityConfigurationOptions    = securityConfigurationOptions ?? throw new ArgumentNullException(nameof(securityConfigurationOptions));
            this.fileLoggingConfigurationOptions = fileLoggingConfigurationOptions ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
        }
Beispiel #16
0
 /// <summary>
 /// Construct an <see cref="InstanceFactory"/>
 /// </summary>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
 /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/></param>
 /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/></param>
 /// <param name="byondInstaller">The value of <see cref="byondInstaller"/></param>
 /// <param name="chatFactory">The value of <see cref="chatFactory"/></param>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
 /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/></param>
 /// <param name="watchdogFactory">The value of <see cref="watchdogFactory"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="credentialsProvider">The value of <see cref="credentialsProvider"/></param>
 /// <param name="networkPromptReaper">The value of <see cref="networkPromptReaper"/></param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 public InstanceFactory(IIOManager ioManager, IDatabaseContextFactory databaseContextFactory, IApplication application, ILoggerFactory loggerFactory, IByondTopicSender byondTopicSender, ICryptographySuite cryptographySuite, ISynchronousIOManager synchronousIOManager, ISymlinkFactory symlinkFactory, IByondInstaller byondInstaller, IChatFactory chatFactory, IProcessExecutor processExecutor, IPostWriteHandler postWriteHandler, IWatchdogFactory watchdogFactory, IJobManager jobManager, ICredentialsProvider credentialsProvider, INetworkPromptReaper networkPromptReaper, IGitHubClientFactory gitHubClientFactory, IPlatformIdentifier platformIdentifier)
 {
     this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.application            = application ?? throw new ArgumentNullException(nameof(application));
     this.loggerFactory          = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.byondTopicSender       = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
     this.cryptographySuite      = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.synchronousIOManager   = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
     this.symlinkFactory         = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
     this.byondInstaller         = byondInstaller ?? throw new ArgumentNullException(nameof(byondInstaller));
     this.chatFactory            = chatFactory ?? throw new ArgumentNullException(nameof(chatFactory));
     this.processExecutor        = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.postWriteHandler       = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
     this.watchdogFactory        = watchdogFactory ?? throw new ArgumentNullException(nameof(watchdogFactory));
     this.jobManager             = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.credentialsProvider    = credentialsProvider ?? throw new ArgumentNullException(nameof(credentialsProvider));
     this.networkPromptReaper    = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
     this.gitHubClientFactory    = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.platformIdentifier     = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
 }
Beispiel #17
0
 /// <summary>
 /// Construct a <see cref="SetupWizard"/>
 /// </summary>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="console">The value of <see cref="console"/></param>
 /// <param name="hostingEnvironment">The value of <see cref="hostingEnvironment"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="dbConnectionFactory">The value of <see cref="dbConnectionFactory"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="asyncDelayer">The value of <see cref="asyncDelayer"/></param>
 /// <param name="applicationLifetime">The value of <see cref="applicationLifetime"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/></param>
 public SetupWizard(
     IIOManager ioManager,
     IConsole console,
     IHostEnvironment hostingEnvironment,
     IAssemblyInformationProvider assemblyInformationProvider,
     IDatabaseConnectionFactory dbConnectionFactory,
     IPlatformIdentifier platformIdentifier,
     IAsyncDelayer asyncDelayer,
     IHostApplicationLifetime applicationLifetime,
     IOptions <GeneralConfiguration> generalConfigurationOptions)
 {
     this.ioManager                   = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.console                     = console ?? throw new ArgumentNullException(nameof(console));
     this.hostingEnvironment          = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.dbConnectionFactory         = dbConnectionFactory ?? throw new ArgumentNullException(nameof(dbConnectionFactory));
     this.platformIdentifier          = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.asyncDelayer                = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
     this.applicationLifetime         = applicationLifetime ?? throw new ArgumentNullException(nameof(applicationLifetime));
     generalConfiguration             = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
        /// <summary>
        /// Construct <see cref="Configuration"/>
        /// </summary>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/></param>
        /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/></param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/></param>
        /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
        /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        public Configuration(
            IIOManager ioManager,
            ISynchronousIOManager synchronousIOManager,
            ISymlinkFactory symlinkFactory,
            IProcessExecutor processExecutor,
            IPostWriteHandler postWriteHandler,
            IPlatformIdentifier platformIdentifier,
            IFileTransferTicketProvider fileTransferService,
            ILogger <Configuration> logger)
        {
            this.ioManager            = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.synchronousIOManager = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
            this.symlinkFactory       = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
            this.processExecutor      = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.postWriteHandler     = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
            this.platformIdentifier   = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
            this.fileTransferService  = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            semaphore   = new SemaphoreSlim(1);
            disposeCts  = new CancellationTokenSource();
            uploadTasks = Task.CompletedTask;
        }
Beispiel #19
0
 /// <summary>
 /// Construct a <see cref="DatabaseSeeder"/>
 /// </summary>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 public DatabaseSeeder(ICryptographySuite cryptographySuite, IPlatformIdentifier platformIdentifier)
 {
     this.cryptographySuite  = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
 }