public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory, IPowerManagement powerManagement) : base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)) { _logger = logger1; _timerFactory = timerFactory; _powerManagement = powerManagement; }
public void Initialize() { // Set a sane default value for on_battery. Thus, if we don't find a working power manager // we assume we're not on battery. on_battery = false; try { BusG.Init(); if (Bus.System.NameHasOwner(DeviceKitPowerName)) { devicekit = Bus.System.GetObject <IDeviceKitPower> (DeviceKitPowerName, new ObjectPath(DeviceKitPowerPath)); devicekit.OnChanged += DeviceKitOnChanged; on_battery = (bool)devicekit.Get(DeviceKitPowerName, "on-battery"); Log <SystemService> .Debug("Using org.freedesktop.DeviceKit.Power for battery information"); } else if (Bus.Session.NameHasOwner(PowerManagementName)) { power = Bus.Session.GetObject <IPowerManagement> (PowerManagementName, new ObjectPath(PowerManagementPath)); power.OnBatteryChanged += PowerOnBatteryChanged; on_battery = power.GetOnBattery(); Log <SystemService> .Debug("Using org.freedesktop.PowerManager for battery information"); } } catch (Exception e) { Log <SystemService> .Error("Could not initialize dbus: {0}", e.Message); Log <SystemService> .Debug(e.StackTrace); } }
void InitializeBattery() { // Set a sane default value for on_battery. Thus, if we don't find a working power manager // we assume we're not on battery. on_battery = false; try { if (Bus.System.NameHasOwner(UPowerName)) { upower = Bus.System.GetObject <IUPower> (UPowerName, new ObjectPath(UPowerPath)); upower.Changed += HandleUPowerChanged; HandleUPowerChanged(); Log <SystemService> .Debug("Using org.freedesktop.UPower for battery information"); } else if (Bus.System.NameHasOwner(DeviceKitPowerName)) { devicekit = Bus.System.GetObject <IDeviceKitPower> (DeviceKitPowerName, new ObjectPath(DeviceKitPowerPath)); devicekit.Changed += HandleDeviceKitChanged; HandleDeviceKitChanged(); Log <SystemService> .Debug("Using org.freedesktop.DeviceKit.Power for battery information"); } else if (Bus.Session.NameHasOwner(PowerManagementName)) { power = Bus.Session.GetObject <IPowerManagement> (PowerManagementName, new ObjectPath(PowerManagementPath)); power.OnBatteryChanged += PowerOnBatteryChanged; on_battery = power.GetOnBattery(); Log <SystemService> .Debug("Using org.freedesktop.PowerManager for battery information"); } } catch (Exception e) { Log <SystemService> .Error("Could not initialize power manager dbus: '{0}'", e.Message); Log <SystemService> .Info(e.StackTrace); } }
public KeepServerAwake(ISessionManager sessionManager, ILogger logger, IServerApplicationHost appHost, ITimerFactory timerFactory, IPowerManagement powerManagement) { _sessionManager = sessionManager; _logger = logger; _appHost = appHost; _timerFactory = timerFactory; _powerManagement = powerManagement; }
public EmbyTV(IApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ISecurityManager security, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, IPowerManagement powerManagement) { Current = this; _appHpst = appHost; _logger = logger; _httpClient = httpClient; _config = config; _fileSystem = fileSystem; _security = security; _libraryManager = libraryManager; _libraryMonitor = libraryMonitor; _providerManager = providerManager; _organizationService = organizationService; _mediaEncoder = mediaEncoder; _liveTvManager = (LiveTvManager)liveTvManager; _jsonSerializer = jsonSerializer; _recordingProvider = new ItemDataProvider<RecordingInfo>(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)); _seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), powerManagement, _logger); _timerProvider.TimerFired += _timerProvider_TimerFired; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationHost" /> class. /// </summary> public ApplicationHost(ApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, ISystemEvents systemEvents, INetworkManager networkManager) { // hack alert, until common can target .net core BaseExtensions.CryptographyProvider = CryptographyProvider; XmlSerializer = new MyXmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer")); NetworkManager = networkManager; EnvironmentInfo = environmentInfo; SystemEvents = systemEvents; MemoryStreamFactory = new MemoryStreamProvider(); FailedAssemblies = new List <string>(); ApplicationPaths = applicationPaths; LogManager = logManager; FileSystemManager = fileSystem; ConfigurationManager = GetConfigurationManager(); // Initialize this early in case the -v command line option is used Logger = LogManager.GetLogger("App"); StartupOptions = options; ReleaseAssetFilename = releaseAssetFilename; PowerManagement = powerManagement; SetBaseExceptionMessage(); }
public EmbyTV(IApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ISecurityManager security, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, IPowerManagement powerManagement) { Current = this; _appHpst = appHost; _logger = logger; _httpClient = httpClient; _config = config; _fileSystem = fileSystem; _security = security; _libraryManager = libraryManager; _libraryMonitor = libraryMonitor; _providerManager = providerManager; _organizationService = organizationService; _mediaEncoder = mediaEncoder; _liveTvManager = (LiveTvManager)liveTvManager; _jsonSerializer = jsonSerializer; _seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), powerManagement, _logger); _timerProvider.TimerFired += _timerProvider_TimerFired; _config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated; }
public MonoAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, IMemoryStreamFactory memoryStreamFactory, MediaBrowser.Common.Net.INetworkManager networkManager, Action <string, string> certificateGenerator, Func <string> defaultUsernameFactory) : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, memoryStreamFactory, networkManager, certificateGenerator, defaultUsernameFactory) { }
public WindowsAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager) : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, networkManager) { fileSystem.AddShortcutHandler(new LnkShortcutHandler()); }
public EmbyTV(IApplicationHost appHost, ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient, IServerConfigurationManager config, ILiveTvManager liveTvManager, IFileSystem fileSystem, ISecurityManager security, ILibraryManager libraryManager, ILibraryMonitor libraryMonitor, IProviderManager providerManager, IFileOrganizationService organizationService, IMediaEncoder mediaEncoder, IPowerManagement powerManagement) { Current = this; _appHpst = appHost; _logger = logger; _httpClient = httpClient; _config = config; _fileSystem = fileSystem; _security = security; _libraryManager = libraryManager; _libraryMonitor = libraryMonitor; _providerManager = providerManager; _organizationService = organizationService; _mediaEncoder = mediaEncoder; _liveTvManager = (LiveTvManager)liveTvManager; _jsonSerializer = jsonSerializer; _recordingProvider = new ItemDataProvider <RecordingInfo>(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)); _seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), powerManagement, _logger); _timerProvider.TimerFired += _timerProvider_TimerFired; }