protected static HomeServerData GetHomeServerData(string serverApplicationPath) { PathManager pathManager = new PathManager(); // Fake path manager to inject the settings path to SettingsManager and StringManager pathManager.InitializeDefaults(serverApplicationPath); ServiceRegistration.Set <IPathManager>(pathManager); ISettingsManager settingsManager = new SettingsManager(); ServiceRegistration.Set <ISettingsManager>(settingsManager); ServiceRegistration.Set <IRegistry>(new MediaPortal.Common.Services.Registry.Registry()); ServiceRegistration.Set <IPluginManager>(new PluginManager()); StringManager stringManager = new StringManager(); stringManager.Startup(); ServiceRegistration.Set <ILocalization>(stringManager); ISystemResolver backendSystemResolver = new SystemResolver(); HomeServerData result = new HomeServerData { HomeServerName = new LocalizedUPnPDeviceInformation().GetFriendlyName(CultureInfo.InvariantCulture), HomeServerSystemId = backendSystemResolver.LocalSystemId }; ServiceRegistration.RemoveAndDispose <ILocalization>(); ServiceRegistration.RemoveAndDispose <IPluginManager>(); ServiceRegistration.RemoveAndDispose <IRegistry>(); ServiceRegistration.RemoveAndDispose <ISettingsManager>(); ServiceRegistration.RemoveAndDispose <IPathManager>(); return(result); }
protected static HomeServerData GetHomeServerData(string serverApplicationPath) { PathManager pathManager = new PathManager(); // Fake path manager to inject the settings path to SettingsManager and StringManager pathManager.InitializeDefaults(serverApplicationPath); ServiceRegistration.Set <IPathManager>(pathManager); ISettingsManager settingsManager = new SettingsManager(); ServiceRegistration.Set <ISettingsManager>(settingsManager); ServiceRegistration.Set <IRegistry>(new MediaPortal.Common.Services.Registry.Registry()); ServiceRegistration.Set <IMessageBroker>(new MessageBroker()); PluginManager pluginManager = new PluginManager(); ServiceRegistration.Set <IPluginManager>(pluginManager); // Required to load language resource registration from plugins, so ILocalization is able to use them. pluginManager.Initialize(); pluginManager.Startup(true); // Use "maintenance" mode here, this won't activate plugins as they are not needed here. StringManager stringManager = new StringManager(); stringManager.Startup(); ServiceRegistration.Set <ILocalization>(stringManager); ISystemResolver backendSystemResolver = new SystemResolver(); HomeServerData result = new HomeServerData { HomeServerName = new LocalizedUPnPDeviceInformation().GetFriendlyName(CultureInfo.InvariantCulture), HomeServerSystemId = backendSystemResolver.LocalSystemId }; pluginManager.Shutdown(); ServiceRegistration.RemoveAndDispose <ILocalization>(); ServiceRegistration.RemoveAndDispose <IPluginManager>(); ServiceRegistration.RemoveAndDispose <IRegistry>(); ServiceRegistration.RemoveAndDispose <ISettingsManager>(); ServiceRegistration.RemoveAndDispose <IPathManager>(); return(result); }