public MopHost(HostProperties p, MopLifeService life, IInjectorService injector) { if (p.DataDirectory is null) { throw new ArgumentNullException("Data directory is null"); } if (p.TempDirectory is null) { throw new ArgumentNullException("Temp directory is null"); } Info = BuildHostInfo(p.Id, p.Name); DataDirectory = new DirectoryInfo(p.DataDirectory); TempDirectory = new DirectoryInfo(p.TempDirectory); _lifeHandler = life; _injector = injector; }
/// <summary> /// Register services. /// </summary> public static string[] Register(string[] args) { _container = new Container(); var(startup, restArgs) = StartupArgsFactory.Build(args); var life = new MopLifeService(AppState.Life.Token); var cmd = CommandLineFacilitator .Create(new CustomActivator()) .AddCurrentAssembly(); _container.Register(() => startup, Lifestyle.Singleton); _container.Register(() => cmd, Lifestyle.Singleton); _container.Register(() => life, Lifestyle.Singleton); _container.Register <ISettingsLoaderService <AppSettings>, SettingsLoaderService <AppSettings> >(Lifestyle.Singleton); _container.Register <ISettingsService, SettingsService>(Lifestyle.Singleton); _container.Register <ILogService, LogService>(Lifestyle.Singleton); _container.Register <IHostsHandlerService, HostsHandlerService>(Lifestyle.Singleton); _container.Register <IParserService, ParserService>(Lifestyle.Singleton); _container.Register <IActorService, ActorService>(Lifestyle.Singleton); _container.Register <ICommandLineService, CommandLineService>(Lifestyle.Singleton); return(restArgs); }