/// <summary> /// Creates vital core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterVitalCoreServices(string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set<ILogger>(new NoLogger()); Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) pathManager.SetPath("DATA", dataDirectory); ServiceRegistration.Set<IPathManager>(pathManager); ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); // Assembly and build information FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetCallingAssembly().Location); logger.Info("ApplicationCore: Comments: {0}", fileVersionInfo.Comments); logger.Info("ApplicationCore: Copyright: {0}", fileVersionInfo.LegalCopyright); logger.Info("ApplicationCore: Version: {0}", fileVersionInfo.FileVersion); logger.Info("ApplicationCore: Source: {0}", fileVersionInfo.ProductVersion); logger.Info("ApplicationCore: ----------------------------------------------------------"); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set<ILogger>(logger); logger.Debug("ApplicationCore: Registering ISettingsManager service"); ServiceRegistration.Set<ISettingsManager>(new SettingsManager()); }
/// <summary> /// Creates vital core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterVitalCoreServices(string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set <ILogger>(new NoLogger()); Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) { pathManager.SetPath("DATA", dataDirectory); } ServiceRegistration.Set <IPathManager>(pathManager); ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); // Assembly and build information FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetCallingAssembly().Location); logger.Info("ApplicationCore: Comments: {0}", fileVersionInfo.Comments); logger.Info("ApplicationCore: Copyright: {0}", fileVersionInfo.LegalCopyright); logger.Info("ApplicationCore: Version: {0}", fileVersionInfo.FileVersion); logger.Info("ApplicationCore: Source: {0}", fileVersionInfo.ProductVersion); logger.Info("ApplicationCore: ----------------------------------------------------------"); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set <ILogger>(logger); logger.Debug("ApplicationCore: Registering ISettingsManager service"); ServiceRegistration.Set <ISettingsManager>(new SettingsManager()); }
/// <summary> /// Creates vital core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="paths"><c>true</c> if the <paramref name="dataDirectory"/> should be set as <c>DATA</c> path</param> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterVitalCoreServices(bool paths, string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set <ILogger>(new NoLogger()); // First register settings manager to allow the logger to access settings already ServiceRegistration.Set <ISettingsManager>(new SettingsManager()); ILogger logger = null; if (paths) { Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) { pathManager.SetPath("DATA", dataDirectory); } ServiceRegistration.Set <IPathManager>(pathManager); logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); } else { logger = ServiceRegistration.Get <ILogger>(); } logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); // Assembly and build information FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetCallingAssembly().Location); logger.Info("ApplicationCore: Comments: {0}", fileVersionInfo.Comments); logger.Info("ApplicationCore: Copyright: {0}", fileVersionInfo.LegalCopyright); logger.Info("ApplicationCore: Version: {0}", fileVersionInfo.FileVersion); logger.Info("ApplicationCore: Source: {0}", fileVersionInfo.ProductVersion); logger.Info("ApplicationCore: Architecture: {0}", IntPtr.Size > 4 ? "x64" : "x86"); // Operating system info logger.Info("ApplicationCore: OS version: {0}", Environment.OSVersion); foreach (string key in new[] { "ProductName", "ReleaseId", "BuildLab", "InstallationType", "EditionID" }) { try { var value = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", key, string.Empty).ToString(); logger.Info("ApplicationCore: {0,-18}{1}", key + ":", value); } catch { break; } } logger.Info("ApplicationCore: ----------------------------------------------------------"); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set <ILogger>(logger); logger.Debug("ApplicationCore: Registered ISettingsManager service"); }
private void Init() { PathManager pathManager = new PathManager(); // Use only local folder for temporary config string testDataLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; pathManager.SetPath("<CONFIG>", testDataLocation); ServiceRegistration.Set<IPathManager>(pathManager); ServiceRegistration.Set<ILocalization>(new NoLocalization()); ServiceRegistration.Set<ILogger>(new NoLogger()); ServiceRegistration.Set<ISettingsManager>(new SettingsManager()); }
public void Init() { string testDataLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; string cacheLocation = Path.Combine(testDataLocation, "TheMovieDB"); // Delete cache to force online lookups if (Directory.Exists(cacheLocation)) Directory.Delete(cacheLocation, true); PathManager pathManager = new PathManager(); pathManager.SetPath("DATA", testDataLocation); ServiceRegistration.Set<IPathManager>(pathManager); ServiceRegistration.Set<ILocalization>(new NoLocalization()); ServiceRegistration.Set<ILogger>(new NoLogger()); _matcher = new MovieTheMovieDbMatcher { DownloadFanart = false }; _matcher.Init(); }
/// <summary> /// Creates vital core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterVitalCoreServices(string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set<ILogger>(new NoLogger()); Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) pathManager.SetPath("DATA", dataDirectory); ServiceRegistration.Set<IPathManager>(pathManager); ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set<ILogger>(logger); logger.Debug("ApplicationCore: Registering ISettingsManager service"); ServiceRegistration.Set<ISettingsManager>(new SettingsManager()); }
/// <summary> /// Creates core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterCoreServices(string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set <ILogger>(new NoLogger()); Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) { pathManager.SetPath("DATA", dataDirectory); } ServiceRegistration.Set <IPathManager>(pathManager); ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set <ILogger>(logger); logger.Debug("ApplicationCore: Registering IRegistry service"); ServiceRegistration.Set <IRegistry>(new Services.Registry.Registry()); logger.Debug("ApplicationCore: Registering IThreadPool service"); ServiceRegistration.Set <IThreadPool>(new ThreadPool()); logger.Debug("ApplicationCore: Registering IMessageBroker service"); ServiceRegistration.Set <IMessageBroker>(new MessageBroker()); logger.Debug("ApplicationCore: Registering IPluginManager service"); ServiceRegistration.Set <IPluginManager>(new Services.PluginManager.PluginManager()); logger.Debug("ApplicationCore: Registering ISettingsManager service"); ServiceRegistration.Set <ISettingsManager>(new SettingsManager()); logger.Debug("ApplicationCore: Registering ILocalization service"); ServiceRegistration.Set <ILocalization>(new StringManager()); logger.Debug("ApplicationCore: Registering ITaskScheduler service"); ServiceRegistration.Set <ITaskScheduler>(new Services.TaskScheduler.TaskScheduler()); logger.Debug("ApplicationCore: Registering IMediaAccessor service"); ServiceRegistration.Set <IMediaAccessor>(new MediaAccessor()); logger.Debug("ApplicationCore: Registering IImporterWorker service"); ServiceRegistration.Set <IImporterWorker>(new ImporterWorker()); logger.Debug("ApplicationCore: Registering IResourceServer service"); ServiceRegistration.Set <IResourceServer>(new ResourceServer()); logger.Debug("ApplicationCore: Registering IResourceMountingService"); ServiceRegistration.Set <IResourceMountingService>(new ResourceMountingService()); logger.Debug("ApplicationCore: Registering IRemoteResourceInformationService"); ServiceRegistration.Set <IRemoteResourceInformationService>(new RemoteResourceInformationService()); logger.Debug("ApplicationCore: Registering IThumbnailGenerator service"); ServiceRegistration.Set <IThumbnailGenerator>(new ThumbnailGenerator()); AdditionalPluginItemBuilders.Register(); }
/// <summary> /// Creates core service instances and registers them in <see cref="ServiceRegistration"/>. The optional <paramref name="dataDirectory"/> argument can /// be used to startup the application using a custom directory for data storage. /// </summary> /// <param name="dataDirectory">Path to custom data directory</param> public static void RegisterCoreServices(string dataDirectory = null) { // Insert a dummy while loading the path manager to break circular dependency of logger and path manager. This should not // be considered as a hack - simply the logger needs a path managed by the path manager and I don't want to remove log // output from the path manager only to prevent the dependency. Maybe we have a better solution in the future. ServiceRegistration.Set<ILogger>(new NoLogger()); Services.PathManager.PathManager pathManager = new Services.PathManager.PathManager(); pathManager.InitializeDefaults(); if (!string.IsNullOrEmpty(dataDirectory)) pathManager.SetPath("DATA", dataDirectory); ServiceRegistration.Set<IPathManager>(pathManager); ILogger logger = new Log4NetLogger(pathManager.GetPath(@"<LOG>")); logger.Info("ApplicationCore: Launching in AppDomain {0}...", AppDomain.CurrentDomain.FriendlyName); logger.Debug("ApplicationCore: Registering ILogger service"); ServiceRegistration.Set<ILogger>(logger); logger.Debug("ApplicationCore: Registering IRegistry service"); ServiceRegistration.Set<IRegistry>(new Services.Registry.Registry()); logger.Debug("ApplicationCore: Registering IThreadPool service"); ServiceRegistration.Set<IThreadPool>(new ThreadPool()); logger.Debug("ApplicationCore: Registering IMessageBroker service"); ServiceRegistration.Set<IMessageBroker>(new MessageBroker()); logger.Debug("ApplicationCore: Registering IPluginManager service"); ServiceRegistration.Set<IPluginManager>(new Services.PluginManager.PluginManager()); logger.Debug("ApplicationCore: Registering ISettingsManager service"); ServiceRegistration.Set<ISettingsManager>(new SettingsManager()); logger.Debug("ApplicationCore: Registering ILocalization service"); ServiceRegistration.Set<ILocalization>(new StringManager()); logger.Debug("ApplicationCore: Registering ITaskScheduler service"); ServiceRegistration.Set<ITaskScheduler>(new Services.TaskScheduler.TaskScheduler()); logger.Debug("ApplicationCore: Registering IMediaAccessor service"); ServiceRegistration.Set<IMediaAccessor>(new MediaAccessor()); logger.Debug("ApplicationCore: Registering IImporterWorker service"); ServiceRegistration.Set<IImporterWorker>(new ImporterWorker()); logger.Debug("ApplicationCore: Registering IResourceServer service"); ServiceRegistration.Set<IResourceServer>(new ResourceServer()); logger.Debug("ApplicationCore: Registering IResourceMountingService"); ServiceRegistration.Set<IResourceMountingService>(new ResourceMountingService()); logger.Debug("ApplicationCore: Registering IRemoteResourceInformationService"); ServiceRegistration.Set<IRemoteResourceInformationService>(new RemoteResourceInformationService()); logger.Debug("ApplicationCore: Registering IThumbnailGenerator service"); ServiceRegistration.Set<IThumbnailGenerator>(new ThumbnailGenerator()); AdditionalPluginItemBuilders.Register(); }