From dce9093ba1f67a41c3bb9bca59ec9df77c5bd4bd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 May 2014 17:23:24 -0400 Subject: split files into separate classes --- .../MediaBrowser.Common.Implementations.csproj | 3 +- .../ScheduledTasks/Tasks/ReloadLoggerFileTask.cs | 105 +++++++++++++++++++++ .../ScheduledTasks/Tasks/ReloadLoggerTask.cs | 105 --------------------- .../Security/MBRegistration.cs | 7 -- .../Security/RegRecord.cs | 11 +++ 5 files changed, 118 insertions(+), 113 deletions(-) create mode 100644 MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs delete mode 100644 MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs create mode 100644 MediaBrowser.Common.Implementations/Security/RegRecord.cs (limited to 'MediaBrowser.Common.Implementations') diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index f6f800f4a..fcb66d0bd 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -95,11 +95,12 @@ - + + diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs new file mode 100644 index 000000000..78f60632f --- /dev/null +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs @@ -0,0 +1,105 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Model.Logging; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks +{ + /// + /// Class ReloadLoggerFileTask + /// + public class ReloadLoggerFileTask : IScheduledTask, IConfigurableScheduledTask + { + /// + /// Gets or sets the log manager. + /// + /// The log manager. + private ILogManager LogManager { get; set; } + /// + /// Gets or sets the configuration manager. + /// + /// The configuration manager. + private IConfigurationManager ConfigurationManager { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The logManager. + /// The configuration manager. + public ReloadLoggerFileTask(ILogManager logManager, IConfigurationManager configurationManager) + { + LogManager = logManager; + ConfigurationManager = configurationManager; + } + + /// + /// Gets the default triggers. + /// + /// IEnumerable{BaseTaskTrigger}. + public IEnumerable GetDefaultTriggers() + { + var trigger = new DailyTrigger { TimeOfDay = TimeSpan.FromHours(0) }; //12am + + return new[] { trigger }; + } + + /// + /// Executes the internal. + /// + /// The cancellation token. + /// The progress. + /// Task. + public Task Execute(CancellationToken cancellationToken, IProgress progress) + { + cancellationToken.ThrowIfCancellationRequested(); + + progress.Report(0); + + LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging + ? LogSeverity.Debug + : LogSeverity.Info); + + return Task.FromResult(true); + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return "Start new log file"; } + } + + /// + /// Gets the description. + /// + /// The description. + public string Description + { + get { return "Moves logging to a new file to help reduce log file sizes."; } + } + + /// + /// Gets the category. + /// + /// The category. + public string Category + { + get { return "Application"; } + } + + public bool IsHidden + { + get { return true; } + } + + public bool IsEnabled + { + get { return true; } + } + } +} diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs deleted file mode 100644 index 78f60632f..000000000 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs +++ /dev/null @@ -1,105 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.ScheduledTasks; -using MediaBrowser.Model.Logging; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks -{ - /// - /// Class ReloadLoggerFileTask - /// - public class ReloadLoggerFileTask : IScheduledTask, IConfigurableScheduledTask - { - /// - /// Gets or sets the log manager. - /// - /// The log manager. - private ILogManager LogManager { get; set; } - /// - /// Gets or sets the configuration manager. - /// - /// The configuration manager. - private IConfigurationManager ConfigurationManager { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The logManager. - /// The configuration manager. - public ReloadLoggerFileTask(ILogManager logManager, IConfigurationManager configurationManager) - { - LogManager = logManager; - ConfigurationManager = configurationManager; - } - - /// - /// Gets the default triggers. - /// - /// IEnumerable{BaseTaskTrigger}. - public IEnumerable GetDefaultTriggers() - { - var trigger = new DailyTrigger { TimeOfDay = TimeSpan.FromHours(0) }; //12am - - return new[] { trigger }; - } - - /// - /// Executes the internal. - /// - /// The cancellation token. - /// The progress. - /// Task. - public Task Execute(CancellationToken cancellationToken, IProgress progress) - { - cancellationToken.ThrowIfCancellationRequested(); - - progress.Report(0); - - LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging - ? LogSeverity.Debug - : LogSeverity.Info); - - return Task.FromResult(true); - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return "Start new log file"; } - } - - /// - /// Gets the description. - /// - /// The description. - public string Description - { - get { return "Moves logging to a new file to help reduce log file sizes."; } - } - - /// - /// Gets the category. - /// - /// The category. - public string Category - { - get { return "Application"; } - } - - public bool IsHidden - { - get { return true; } - } - - public bool IsEnabled - { - get { return true; } - } - } -} diff --git a/MediaBrowser.Common.Implementations/Security/MBRegistration.cs b/MediaBrowser.Common.Implementations/Security/MBRegistration.cs index 1d64b5ea1..ca000df19 100644 --- a/MediaBrowser.Common.Implementations/Security/MBRegistration.cs +++ b/MediaBrowser.Common.Implementations/Security/MBRegistration.cs @@ -94,11 +94,4 @@ namespace MediaBrowser.Common.Implementations.Security return new MBRegistrationRecord { IsRegistered = reg.registered, ExpirationDate = reg.expDate, RegChecked = true }; } } - - class RegRecord - { - public string featId { get; set; } - public bool registered { get; set; } - public DateTime expDate { get; set; } - } } diff --git a/MediaBrowser.Common.Implementations/Security/RegRecord.cs b/MediaBrowser.Common.Implementations/Security/RegRecord.cs new file mode 100644 index 000000000..f4e4337bf --- /dev/null +++ b/MediaBrowser.Common.Implementations/Security/RegRecord.cs @@ -0,0 +1,11 @@ +using System; + +namespace MediaBrowser.Common.Implementations.Security +{ + class RegRecord + { + public string featId { get; set; } + public bool registered { get; set; } + public DateTime expDate { get; set; } + } +} \ No newline at end of file -- cgit v1.2.3