Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
        /// </summary>
        protected BaseApplicationHost(TApplicationPathsType applicationPaths,
                                      ILogManager logManager,
                                      IFileSystem fileSystem,
                                      IEnvironmentInfo environmentInfo,
                                      ISystemEvents systemEvents,
                                      IMemoryStreamFactory memoryStreamFactory,
                                      INetworkManager networkManager)
        {
            NetworkManager      = networkManager;
            EnvironmentInfo     = environmentInfo;
            SystemEvents        = systemEvents;
            MemoryStreamFactory = memoryStreamFactory;

            // hack alert, until common can target .net core
            BaseExtensions.CryptographyProvider = CryptographyProvider;

            XmlSerializer    = new MyXmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer"));
            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");
        }
 /// <summary>
 /// Returns the Type property for the SystemEvent with the Id provided.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the SystemEvent whose Type property is to be returned.  Must be
 /// double URL encoded.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <string> RetrieveTypeAsync(this ISystemEvents operations, string id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RetrieveTypeWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Returns all SystemEvent which fit the filter criteria supplied. All filter
 /// parameters are optional. SystemEvent will be ordered and paged as
 /// requested.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='priorityFrom'>
 /// Return only SystemEvent with a Priority greater or equal to the value
 /// supplied.
 /// </param>
 /// <param name='priorityTo'>
 /// Return only SystemEvent with a Priority less or equal to the value
 /// supplied.
 /// </param>
 /// <param name='type'>
 /// Return only SystemEvent with this Type value.
 /// </param>
 /// <param name='occurredOnOrAfter'>
 /// Return only SystemEvent with OccurredOn which is on or after this value.
 /// </param>
 /// <param name='occurredBefore'>
 /// Return only SystemEvent with OccurredOn which is before this value.
 /// </param>
 /// <param name='orderBy'>
 /// SystemEvent will be returned in this order.  OccurredOnAscending by
 /// default. Possible values include: 'OccurredOnAscending',
 /// 'OccurredOnDescending'
 /// </param>
 /// <param name='take'>
 /// Number of SystemEvent that should be returned.  200 by default.
 /// </param>
 /// <param name='skip'>
 /// Number of SystemEvent that should be skipped before items are returned.  0
 /// by default.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <SystemEventModel> > RetrieveAsync(this ISystemEvents operations, int?priorityFrom = default(int?), int?priorityTo = default(int?), string type = default(string), DateTime?occurredOnOrAfter = default(DateTime?), DateTime?occurredBefore = default(DateTime?), string orderBy = default(string), int?take = default(int?), int?skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RetrieveWithHttpMessagesAsync(priorityFrom, priorityTo, type, occurredOnOrAfter, occurredBefore, orderBy, take, skip, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduledTaskWorker" /> class.
        /// </summary>
        /// <param name="scheduledTask">The scheduled task.</param>
        /// <param name="applicationPaths">The application paths.</param>
        /// <param name="taskManager">The task manager.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <exception cref="System.ArgumentNullException">
        /// scheduledTask
        /// or
        /// applicationPaths
        /// or
        /// taskManager
        /// or
        /// jsonSerializer
        /// or
        /// logger
        /// </exception>
        public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
        {
            if (scheduledTask == null)
            {
                throw new ArgumentNullException("scheduledTask");
            }
            if (applicationPaths == null)
            {
                throw new ArgumentNullException("applicationPaths");
            }
            if (taskManager == null)
            {
                throw new ArgumentNullException("taskManager");
            }
            if (jsonSerializer == null)
            {
                throw new ArgumentNullException("jsonSerializer");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            ScheduledTask    = scheduledTask;
            ApplicationPaths = applicationPaths;
            TaskManager      = taskManager;
            JsonSerializer   = jsonSerializer;
            Logger           = logger;
            _fileSystem      = fileSystem;
            _systemEvents    = systemEvents;

            InitTriggerEvents();
        }
Esempio n. 5
0
 public TrackerViewModelFactory(ISystemEvents systemEvents)
 {
     if (systemEvents == null)
     {
         throw new ArgumentNullException("systemEvents");
     }
     this.systemEvents = systemEvents;
 }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskManager" /> class.
        /// </summary>
        /// <param name="applicationPaths">The application paths.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <exception cref="System.ArgumentException">kernel</exception>
        public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
        {
            ApplicationPaths = applicationPaths;
            JsonSerializer   = jsonSerializer;
            Logger           = logger;
            _fileSystem      = fileSystem;
            _systemEvents    = systemEvents;

            ScheduledTasks = new IScheduledTaskWorker[] { };
        }
 public TrackerViewModel(ISystemEvents systemEvents, IWindow window)
 {
     if (systemEvents == null)
     {
         throw new ArgumentNullException("systemEvents");
     }
     if (window == null)
     {
         throw new ArgumentNullException("window");
     }
     systemEvents.SessionSwitch += SystemEvents_SessionSwitch;
     this.window = window;
 }
Esempio n. 8
0
        /// <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();
        }
Esempio n. 9
0
 public CoreAppHost(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory, StartupOptions options, IFileSystem fileSystem, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager)
     : base(applicationPaths, loggerFactory, options, fileSystem, environmentInfo, imageEncoder, systemEvents, networkManager)
 {
 }
Esempio n. 10
0
 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)
 {
 }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
        /// </summary>
        public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
        {
            if (taskManager == null)
            {
                throw new ArgumentNullException("taskManager");
            }

            LibraryManager       = libraryManager;
            TaskManager          = taskManager;
            Logger               = logManager.GetLogger(GetType().Name);
            ConfigurationManager = configurationManager;
            _fileSystem          = fileSystem;
            _timerFactory        = timerFactory;
            _environmentInfo     = environmentInfo;

            systemEvents.Resume += _systemEvents_Resume;
        }
Esempio n. 12
0
 public MyViewModel(ISystemEvents systemEvents)
 {
     //Store the instance of your object here, and subscribe to the desired events
 }
Esempio n. 13
0
 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());
 }
Esempio n. 14
0
 public SystemEventTrigger(ISystemEvents systemEvents)
 {
     _systemEvents = systemEvents;
 }
Esempio n. 15
0
 public SystemEvents(ISystemEvents systemEvents, IServerApplicationHost appHost)
 {
     _systemEvents = systemEvents;
     _appHost      = appHost;
 }
 /// <summary>
 /// Returns the Type property for the SystemEvent with the Id provided.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the SystemEvent whose Type property is to be returned.  Must be
 /// double URL encoded.
 /// </param>
 public static string RetrieveType(this ISystemEvents operations, string id)
 {
     return(Task.Factory.StartNew(s => ((ISystemEvents)s).RetrieveTypeAsync(id), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public TestClass(ISystemEvents systemEvents, ITestService testService)
 {
     _testService = testService;
     systemEvents.PowerModeChanged += OnPowerModeChanged;
 }
 /// <summary>
 /// Returns all SystemEvent which fit the filter criteria supplied. All filter
 /// parameters are optional. SystemEvent will be ordered and paged as
 /// requested.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='priorityFrom'>
 /// Return only SystemEvent with a Priority greater or equal to the value
 /// supplied.
 /// </param>
 /// <param name='priorityTo'>
 /// Return only SystemEvent with a Priority less or equal to the value
 /// supplied.
 /// </param>
 /// <param name='type'>
 /// Return only SystemEvent with this Type value.
 /// </param>
 /// <param name='occurredOnOrAfter'>
 /// Return only SystemEvent with OccurredOn which is on or after this value.
 /// </param>
 /// <param name='occurredBefore'>
 /// Return only SystemEvent with OccurredOn which is before this value.
 /// </param>
 /// <param name='orderBy'>
 /// SystemEvent will be returned in this order.  OccurredOnAscending by
 /// default. Possible values include: 'OccurredOnAscending',
 /// 'OccurredOnDescending'
 /// </param>
 /// <param name='take'>
 /// Number of SystemEvent that should be returned.  200 by default.
 /// </param>
 /// <param name='skip'>
 /// Number of SystemEvent that should be skipped before items are returned.  0
 /// by default.
 /// </param>
 public static IList <SystemEventModel> Retrieve(this ISystemEvents operations, int?priorityFrom = default(int?), int?priorityTo = default(int?), string type = default(string), DateTime?occurredOnOrAfter = default(DateTime?), DateTime?occurredBefore = default(DateTime?), string orderBy = default(string), int?take = default(int?), int?skip = default(int?))
 {
     return(Task.Factory.StartNew(s => ((ISystemEvents)s).RetrieveAsync(priorityFrom, priorityTo, type, occurredOnOrAfter, occurredBefore, orderBy, take, skip), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }