diff --git a/Libraries/NLog.dll b/Libraries/NLog.dll index 8a27b27f3..2403ebb9e 100644 Binary files a/Libraries/NLog.dll and b/Libraries/NLog.dll differ diff --git a/Libraries/NLog.xml b/Libraries/NLog.xml index cd0c12c15..9ee7832e6 100644 --- a/Libraries/NLog.xml +++ b/Libraries/NLog.xml @@ -1065,11 +1065,11 @@ into an expression tree. - + Initializes a new instance of the class. - The expression text. + The string reader. Instance of used to resolve references to condition methods and layout renderers. @@ -1089,6 +1089,17 @@ Instance of used to resolve references to condition methods and layout renderers. The root of the expression syntax tree which can be used to get the value of the condition in a specified context. + + + Parses the specified condition string and turns it into + tree. + + The string reader. + Instance of used to resolve references to condition methods and layout renderers. + + The root of the expression syntax tree which can be used to get the value of the condition in a specified context. + + Condition relational (==, !=, <, <=, @@ -1185,11 +1196,11 @@ Hand-written tokenizer for conditions. - + Initializes a new instance of the class. - The expression text. + The string reader. @@ -1378,6 +1389,17 @@ The type to register. The item name prefix. + + + Builds the default configuration item factory. + + Default factory. + + + + Registers items in NLog.Extended.dll using late-bound types, so that we don't need a reference to NLog.Extended.dll. + + Gets or sets default singleton instance of . @@ -1473,14 +1495,6 @@ The result. True if instance was created successfully, false otherwise. - - - Gets a collection of all registered items in the factory. - - Sequence of key/value pairs where each key represents the name - of the item and value is the of - the item. - Provides means to populate factories of named items (such as targets, layouts, layout renderers, etc.). @@ -1500,6 +1514,13 @@ The type to register. The item name prefix. + + + Registers the item based on a type name. + + Name of the item. + Name of the type. + Clears the contents of the factory. @@ -1535,14 +1556,6 @@ The name of the item. Created item. - - - Gets a collection of all registered items in the factory. - - Sequence of key/value pairs where each key represents the name - of the item and value is the of - the item. - Implemented by objects which support installation and uninstallation. @@ -2069,45 +2082,6 @@ layout targets and filters. - - - Supported operating systems. - - - If you add anything here, make sure to add the appropriate detection - code to - - - - - Any operating system. - - - - - Unix/Linux operating systems. - - - - - Windows CE. - - - - - Desktop versions of Windows (95,98,ME). - - - - - Windows NT, 2000, 2003 and future versions based on NT technology. - - - - - Unknown operating system. - - Provides simple programmatic configuration API used for trivial logging cases. @@ -3322,6 +3296,18 @@ A value of true if the specified level is enabled; otherwise, false. + + + Message Box helper. + + + + + Shows the specified message using platform-specific message box. + + The message. + The caption. + Watches multiple files at the same time and raises an event whenever @@ -3354,75 +3340,9 @@ Supports mocking of SMTP Client code. - + - Sends a QUIT message to the SMTP server, gracefully ends the TCP connection, and releases all resources used by the current instance of the class. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Supports mocking of SMTP Client code. - - - - - Creates instances of objects for given URLs. - - - - - Creates a new instance of the network sender based on a network URL. - - - URL that determines the network sender to be created. - - - A newly created network sender. - - - - - Interface for mocking socket calls. + Network sender which uses HTTP or HTTPS POST. @@ -3518,6 +3438,43 @@ Gets the last send time. + + + Initializes a new instance of the class. + + The network URL. + + + + Actually sends the given text over the specified protocol. + + The bytes to be sent. + Offset in buffer. + Number of bytes to send. + The async continuation to be invoked after the buffer has been sent. + To be overridden in inheriting classes. + + + + Creates instances of objects for given URLs. + + + + + Creates a new instance of the network sender based on a network URL. + + + URL that determines the network sender to be created. + + + A newly created network sender. + + + + + Interface for mocking socket calls. + + Default implementation of . @@ -3809,6 +3766,69 @@ Reflection helpers for accessing properties. + + + Reflection helpers. + + + + + Gets all usable exported types from the given assembly. + + Assembly to scan. + Usable types from the given assembly. + Types which cannot be loaded are skipped. + + + + Supported operating systems. + + + If you add anything here, make sure to add the appropriate detection + code to + + + + + Any operating system. + + + + + Unix/Linux operating systems. + + + + + Windows CE. + + + + + Desktop versions of Windows (95,98,ME). + + + + + Windows NT, 2000, 2003 and future versions based on NT technology. + + + + + Unknown operating system. + + + + + Simple character tokenizer. + + + + + Initializes a new instance of the class. + + The text to be tokenized. + Implements a single-call guard around given continuation function. @@ -4276,6 +4296,12 @@ + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + The environment variable. @@ -4338,12 +4364,33 @@ + + + Gets or sets the format of the output of inner exceptions. Must be a comma-separated list of exception + properties: Message, Type, ShortType, ToString, Method, StackTrace. + This parameter value is case-insensitive. + + + Gets or sets the separator used to concatenate parts specified in the Format. + + + Gets or sets the maximum number of inner exceptions to include in the output. + By default inner exceptions are not enabled for compatibility with NLog 1.0. + + + + + + Gets or sets the separator between inner exceptions. + + + Renders contents of the specified file. @@ -4515,13 +4562,6 @@ - - - Gets or sets a value indicating whether to modify the output of this renderer so it can be used as a part of file path - (illegal characters are replaced with '_'). - - - Installation parameter (passed to InstallNLogConfig). @@ -4656,6 +4696,12 @@ + + + Gets or sets the NDC item separator. + + + Gets the level of stack trace information required by the implementing class. @@ -4691,6 +4737,12 @@ The to append the rendered data to. Logging event. + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + The machine name that the process is running on. @@ -4731,6 +4783,11 @@ The formatted log message. + + + Initializes a new instance of the class. + + Renders the log message including any positional parameters and appends it to the specified . @@ -4738,6 +4795,18 @@ The to append the rendered data to. Logging event. + + + Gets or sets a value indicating whether to log exception along with message. + + + + + + Gets or sets the string that separates message from the exception. + + + Nested Diagnostic Context item. Provided for compatibility with log4net. @@ -5242,30 +5311,11 @@ The to append the rendered data to. Logging event. - + - Specifies application information to display in ${sl-appinfo} renderer. - - - - - URI of the current application XAP file. - - - - - Whether application is running out-of-browser. - - - - - Installed state of an application. - - - - - Whether application is running with elevated permissions. + Gets or sets a value indicating whether to output UTC time instead of local time. + @@ -5431,6 +5481,24 @@ The to append the rendered data to. Logging event. + + + The time in a 24-hour, sortable format HH:mm:ss.mmm. + + + + + Renders time in the 24-h format (HH:mm:ss.mmm) and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + Thread Windows identity information (username). @@ -5538,6 +5606,30 @@ + + + Filters characters not allowed in the file names by replacing them with safe character. + + + + + Initializes a new instance of the class. + + + + + Post-processes the rendered message. + + The text to be post-processed. + Padded and trimmed string. + + + + Gets or sets a value indicating whether to modify the output of this renderer so it can be used as a part of file path + (illegal characters are replaced with '_'). + + + Converts the result of another layout output to lower case. @@ -5568,6 +5660,27 @@ + + + Only outputs the inner layout when exception has been defined for log message. + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Renders the inner layout contents. + + The log event. + + Contents of inner layout. + + Applies padding to another layout output. @@ -5768,6 +5881,83 @@ A value of true if space should be translated to '+'; otherwise, false. + + + Outputs alternative layout when the inner layout produces empty result. + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Renders the inner layout contents. + + The log event. + + Contents of inner layout. + + + + + Gets or sets the layout to be rendered when original layout produced empty result. + + + + + + Only outputs the inner layout when the specified condition has been met. + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Renders the inner layout contents. + + The log event. + + Contents of inner layout. + + + + + Gets or sets the condition that must be met for the inner layout to be printed. + + + + + + Converts the result of another layout output to be XML-compliant. + + + + + Initializes a new instance of the class. + + + + + Post-processes the rendered message. + + The text to be post-processed. + Padded and trimmed string. + + + + Gets or sets a value indicating whether to apply XML encoding. + + + A column in the CSV. @@ -5937,18 +6127,6 @@ Gets the logging configuration this target is part of. - - - Precalculates the layout for the specified log event and stores the result - in per-log event cache. - - The log event. - - Calling this method enables you to store the log event in a buffer - and/or potentially evaluate it in another thread even though the - layout may contain thread-dependent renderer. - - Renders the layout for the specified logging event by invoking layout renderers. @@ -6083,17 +6261,6 @@ Parses layout strings. - - - Simple character tokenizer. - - - - - Initializes a new instance of the class. - - The text to be tokenized. - A specialized layout that renders Log4j-compatible XML events. @@ -9481,11 +9648,6 @@ The result. - - - Log Receiver Client Channel. - - Service contract for Log Receiver server. @@ -9497,6 +9659,34 @@ The events. + + + Implementation of which forwards received logs through or a given . + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The log factory. + + + + Processes the log messages. + + The events to process. + + + + Processes the log messages. + + The log events. + Internal configuration of Log Receiver Service contracts. @@ -10518,6 +10708,12 @@ + + + Gets or sets the NDC item separator. + + + Gets the collection of parameters. Each parameter contains a mapping @@ -10534,6 +10730,7 @@ Gets or sets the instance of that is used to format log messages. + @@ -11837,6 +12034,14 @@ Initializes a new instance of the class. + + + Called when log events are being sent (test hook). + + The events. + The async continuations. + True if events should be sent, false to stop processing them. + Writes logging event to the log target. Must be overridden in inheriting @@ -11886,6 +12091,12 @@ The parameters. + + + Gets or sets a value indicating whether to include per-event properties in the payload sent to the server. + + + Sends log messages by email using SMTP protocol. @@ -12206,7 +12417,7 @@ Initializes a new instance of the class. - + Prepares an array of parameters to be passed based on the logging event and calls DoInvoke(). @@ -12214,6 +12425,13 @@ The logging event. + + + Calls the target method. Must be implemented in concrete classes. + + Method call parameters. + The continuation. + Calls the target method. Must be implemented in concrete classes. @@ -12913,10 +13131,17 @@ + + Calls the target method. Must be implemented in concrete classes. + + Method call parameters. + + Invokes the web service method. Parameters to be passed. + The continuation. @@ -12942,6 +13167,12 @@ + + + Gets or sets the encoding. + + + Win32 file attributes. diff --git a/NzbDrone.Core.Test/ConfigProviderTest.cs b/NzbDrone.Core.Test/ConfigProviderTest.cs index e67e19055..bc2805f40 100644 --- a/NzbDrone.Core.Test/ConfigProviderTest.cs +++ b/NzbDrone.Core.Test/ConfigProviderTest.cs @@ -1,4 +1,5 @@ using AutoMoq; +using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Core.Providers.Core; @@ -13,52 +14,81 @@ namespace NzbDrone.Core.Test public class ConfigProviderTest : TestBase { [Test] - public void Overwrite_existing_value() + public void Add_new_value_to_database() { const string key = "MY_KEY"; const string value = "MY_VALUE"; - //Arrange - var config = new Config {Key = key, Value = value}; - var mocker = new AutoMoqer(); - - mocker.GetMock() - .Setup(r => r.Single(key)) - .Returns(config); + var db = MockLib.GetEmptyDatabase(); + mocker.SetConstant(db); //Act mocker.Resolve().SetValue(key, value); //Assert - mocker.GetMock().Verify(c => c.Update(config)); - mocker.GetMock().Verify(c => c.Add(It.IsAny()), Times.Never()); + mocker.Resolve().GetValue(key, "").Should().Be(value); } [Test] - public void Add_new_value() + public void Get_value_from_database() { const string key = "MY_KEY"; const string value = "MY_VALUE"; - //Arrange var mocker = new AutoMoqer(); + var db = MockLib.GetEmptyDatabase(); + mocker.SetConstant(db); - mocker.GetMock() - .Setup(r => r.Single(It.IsAny())) - .Returns(null) - .Verifiable(); + db.Insert(new Config { Key = key, Value = value }); //Act - mocker.Resolve().SetValue(key, value); + var result = mocker.Resolve().GetValue(key, ""); //Assert - mocker.GetMock().Verify(); - mocker.GetMock().Verify(r => r.Update(It.IsAny()), Times.Never()); - mocker.GetMock().Verify(r => r.Add(It.Is(c => c.Key == key && c.Value == value)), - Times.Once()); - - Assert.Pass(); + result.Should().Be(value); } + + + [Test] + public void Get_value_should_return_default_when_no_value() + { + const string key = "MY_KEY"; + const string value = "MY_VALUE"; + + var mocker = new AutoMoqer(); + var db = MockLib.GetEmptyDatabase(); + mocker.SetConstant(db); + + + //Act + var result = mocker.Resolve().GetValue(key, value); + + //Assert + result.Should().Be(value); + } + + [Test] + public void New_value_should_update_old_value() + { + const string key = "MY_KEY"; + const string originalValue = "OLD_VALUE"; + const string newValue = "NEW_VALUE"; + + var mocker = new AutoMoqer(); + var db = MockLib.GetEmptyDatabase(); + mocker.SetConstant(db); + + db.Insert(new Config { Key = key, Value = originalValue }); + + //Act + mocker.Resolve().SetValue(key, newValue); + var result = mocker.Resolve().GetValue(key, ""); + + //Assert + result.Should().Be(newValue); + db.Fetch().Should().HaveCount(1); + } + } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/Framework/MockLib.cs b/NzbDrone.Core.Test/Framework/MockLib.cs index 9adc0f271..85c4cb554 100644 --- a/NzbDrone.Core.Test/Framework/MockLib.cs +++ b/NzbDrone.Core.Test/Framework/MockLib.cs @@ -126,8 +126,6 @@ namespace NzbDrone.Core.Test.Framework private static void ForceMigration(IRepository repository) { - repository.All().Count(); - repository.All().Count(); repository.All().Count(); repository.All().Count(); repository.All().Count(); diff --git a/NzbDrone.Core.Test/SeriesProviderTest.cs b/NzbDrone.Core.Test/SeriesProviderTest.cs index 452603bf9..ac867fa77 100644 Binary files a/NzbDrone.Core.Test/SeriesProviderTest.cs and b/NzbDrone.Core.Test/SeriesProviderTest.cs differ diff --git a/NzbDrone.Core/Datastore/Migrations/MigrationExport.cs b/NzbDrone.Core/Datastore/Migrations/MigrationExport.cs index c64b6494c..d7714ab1a 100644 --- a/NzbDrone.Core/Datastore/Migrations/MigrationExport.cs +++ b/NzbDrone.Core/Datastore/Migrations/MigrationExport.cs @@ -53,6 +53,10 @@ namespace NzbDrone.Core.Datastore.Migrations .WithNotNullableColumn("Size", DbType.Int64) .WithNotNullableColumn("DateAdded", DbType.DateTime) .WithNotNullableColumn("SeasonNumber", DbType.Int16); + + db.CreateTable("Config") + .WithNotNullableColumn("Key", DbType.String).Unique() + .WithNotNullableColumn("Value", DbType.String); } } } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 1cc745352..a4df3b791 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -133,8 +133,9 @@ ..\Libraries\MigSharp.dll - - ..\packages\MiniProfiler.1.2\lib\MvcMiniProfiler.dll + + False + ..\packages\MiniProfiler.1.3\lib\MvcMiniProfiler.dll ..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index f1afecabb..50fc4c8d7 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -5,6 +5,7 @@ using Ninject; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; +using PetaPoco; using SubSonic.Repository; namespace NzbDrone.Core.Providers.Core @@ -12,17 +13,18 @@ namespace NzbDrone.Core.Providers.Core public class ConfigProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private readonly IRepository _repository; + private readonly IDatabase _database; + [Inject] - public ConfigProvider(IRepository repository) + public ConfigProvider(IDatabase database) { - _repository = repository; + _database = database; } public IList All() { - return _repository.All().ToList(); + return _database.Fetch(); } public ConfigProvider() @@ -129,7 +131,7 @@ namespace NzbDrone.Core.Providers.Core public virtual String SabHost { - get { return GetValue("SabHost", "localhost", true); } + get { return GetValue("SabHost", "localhost"); } set { SetValue("SabHost", value); } } @@ -164,7 +166,7 @@ namespace NzbDrone.Core.Providers.Core public virtual String SabTvCategory { - get { return GetValue("SabTvCategory", "TV", false); } + get { return GetValue("SabTvCategory", "TV"); } set { SetValue("SabTvCategory", value); } } @@ -178,7 +180,7 @@ namespace NzbDrone.Core.Providers.Core public virtual String SabDropDirectory { - get { return GetValue("SabTvDropDirectory", "", false); } + get { return GetValue("SabTvDropDirectory"); } set { SetValue("SabTvDropDirectory", value); } } @@ -230,7 +232,7 @@ namespace NzbDrone.Core.Providers.Core public virtual string SeasonFolderFormat { - get { return GetValue("Sorting_SeasonFolderFormat", "Season %s", false); } + get { return GetValue("Sorting_SeasonFolderFormat", "Season %s"); } set { SetValue("Sorting_SeasonFolderFormat", value); } } @@ -261,31 +263,29 @@ namespace NzbDrone.Core.Providers.Core private string GetValue(string key) { - return GetValue(key, String.Empty, false); + return GetValue(key, String.Empty); } private bool GetValueBoolean(string key, bool defaultValue = false) { - return Convert.ToBoolean(GetValue(key, defaultValue, false)); + return Convert.ToBoolean(GetValue(key, defaultValue)); } private int GetValueInt(string key, int defaultValue = 0) { - return Convert.ToInt16(GetValue(key, defaultValue, false)); + return Convert.ToInt16(GetValue(key, defaultValue)); } - public virtual string GetValue(string key, object defaultValue, bool makePermanent) + public virtual string GetValue(string key, object defaultValue) { string value; - var dbValue = _repository.Single(key); + var dbValue = _database.SingleOrDefault(key); if (dbValue != null && !String.IsNullOrEmpty(dbValue.Value)) return dbValue.Value; Logger.Debug("Unable to find config key '{0}' defaultValue:'{1}'", key, defaultValue); - if (makePermanent) - SetValue(key, defaultValue.ToString()); value = defaultValue.ToString(); return value; @@ -310,20 +310,16 @@ namespace NzbDrone.Core.Providers.Core Logger.Debug("Writing Setting to file. Key:'{0}' Value:'{1}'", key, value); - var dbValue = _repository.Single(key); + var dbValue = _database.SingleOrDefault("WHERE KEY=@0", key); if (dbValue == null) { - _repository.Add(new Config - { - Key = key, - Value = value - }); + _database.Insert(new Config { Key = key, Value = value }); } else { dbValue.Value = value; - _repository.Update(dbValue); + _database.Update(dbValue); } } } diff --git a/NzbDrone.Core/Providers/ExternalNotification/XbmcNotificationProvider.cs b/NzbDrone.Core/Providers/ExternalNotification/XbmcNotificationProvider.cs index bcb2bd369..8edcade41 100644 --- a/NzbDrone.Core/Providers/ExternalNotification/XbmcNotificationProvider.cs +++ b/NzbDrone.Core/Providers/ExternalNotification/XbmcNotificationProvider.cs @@ -23,9 +23,9 @@ namespace NzbDrone.Core.Providers.ExternalNotification { const string header = "NzbDrone [TV] - Grabbed"; - if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false))) { - if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false))) { _logger.Trace("Sending Notification to XBMC"); _xbmcProvider.Notify(header, message); @@ -41,21 +41,21 @@ namespace NzbDrone.Core.Providers.ExternalNotification { const string header = "NzbDrone [TV] - Downloaded"; - if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false))) { - if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false))) { _logger.Trace("Sending Notification to XBMC"); _xbmcProvider.Notify(header, message); } - if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false))) { _logger.Trace("Sending Update Request to XBMC"); _xbmcProvider.Update(seriesId); } - if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false))) { _logger.Trace("Sending Clean DB Request to XBMC"); _xbmcProvider.Clean(); @@ -69,19 +69,19 @@ namespace NzbDrone.Core.Providers.ExternalNotification { const string header = "NzbDrone [TV] - Renamed"; - if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false))) { _logger.Trace("Sending Notification to XBMC"); _xbmcProvider.Notify(header, message); } - if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false))) { _logger.Trace("Sending Update Request to XBMC"); _xbmcProvider.Update(seriesId); } - if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true))) + if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false))) { _logger.Trace("Sending Clean DB Request to XBMC"); _xbmcProvider.Clean(); diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index ad28ef4d9..a0b8bf0d0 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -1,8 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using MvcMiniProfiler; using Ninject; using NLog; using NzbDrone.Core.Helpers; @@ -206,15 +205,12 @@ namespace NzbDrone.Core.Providers public virtual Tuple GetEpisodeFilesCount(int seriesId) { - using (MiniProfiler.Current.Step("GetEpisodeFilesCount:" + seriesId)) - { - var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId); + var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId).ToList(); - var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).ToList(); - var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0).ToList(); + var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).ToList(); + var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0).ToList(); - return new Tuple(avilableEpisodes.Count, episodeTotal.Count); - } + return new Tuple(avilableEpisodes.Count, episodeTotal.Count); } private List GetMediaFileList(string path) diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 0ce51c8a4..a72080d93 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -3,14 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; -using Ninject; using NLog; -using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using PetaPoco; -using SubSonic.Repository; using TvdbLib.Data; namespace NzbDrone.Core.Providers @@ -18,22 +14,19 @@ namespace NzbDrone.Core.Providers public class SeriesProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private readonly IRepository _repository; private readonly ConfigProvider _configProvider; private readonly TvDbProvider _tvDbProvider; private readonly IDatabase _database; private readonly QualityProvider _qualityProvider; private readonly SceneNameMappingProvider _sceneNameMappingProvider; + private static readonly Regex TimeRegex = new Regex(@"^(? - - ..\packages\MiniProfiler.1.2\lib\MvcMiniProfiler.dll + + False + ..\packages\MiniProfiler.1.3\lib\MvcMiniProfiler.dll ..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll diff --git a/NzbDrone.Web/packages.config b/NzbDrone.Web/packages.config index fdd72d2b3..0f9d9b4b9 100644 --- a/NzbDrone.Web/packages.config +++ b/NzbDrone.Web/packages.config @@ -9,5 +9,5 @@ - + \ No newline at end of file diff --git a/packages/MiniProfiler.1.2/MiniProfiler.1.2.nupkg b/packages/MiniProfiler.1.2/MiniProfiler.1.2.nupkg deleted file mode 100644 index 8b03a0034..000000000 Binary files a/packages/MiniProfiler.1.2/MiniProfiler.1.2.nupkg and /dev/null differ diff --git a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.dll b/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.dll deleted file mode 100644 index bf7f0a3b1..000000000 Binary files a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.dll and /dev/null differ diff --git a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.pdb b/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.pdb deleted file mode 100644 index d70f75438..000000000 Binary files a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.pdb and /dev/null differ diff --git a/packages/MiniProfiler.1.3/MiniProfiler.1.3.nupkg b/packages/MiniProfiler.1.3/MiniProfiler.1.3.nupkg new file mode 100644 index 000000000..3acc489ca Binary files /dev/null and b/packages/MiniProfiler.1.3/MiniProfiler.1.3.nupkg differ diff --git a/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.dll b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.dll new file mode 100644 index 000000000..5e11c81d0 Binary files /dev/null and b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.dll differ diff --git a/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.pdb b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.pdb new file mode 100644 index 000000000..46efddc14 Binary files /dev/null and b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.pdb differ diff --git a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.xml b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.xml similarity index 83% rename from packages/MiniProfiler.1.2/lib/MvcMiniProfiler.xml rename to packages/MiniProfiler.1.3/lib/MvcMiniProfiler.xml index ac83c177f..937e4d4cd 100644 --- a/packages/MiniProfiler.1.2/lib/MvcMiniProfiler.xml +++ b/packages/MiniProfiler.1.3/lib/MvcMiniProfiler.xml @@ -116,6 +116,11 @@ Gets the ellapsed milliseconds in this step without any children's durations. + + + Gets the aggregate ellapsed milliseconds of all SqlTimings executed in this Timing, excluding Children Timings. + + Returns true when this is less than the configured @@ -132,6 +137,11 @@ Returns true if this Timing step collected sql execution timings. + + + Returns true if any s executed in this step are detected as duplicate statements. + + Returns true when this Timing is the first one created in a MiniProfiler session. @@ -142,6 +152,21 @@ How far away this Timing is from the Profiler's Root. + + + How many sql data readers were executed in this Timing step. + + + + + How many sql scalar queries were executed in this Timing step. + + + + + How many sql non-query statements were executed in this Timing step. + + If the underlying command supports BindByName, this sets/clears the underlying @@ -201,6 +226,11 @@ Called when database reader is closed, ending profiling for SqlTimings. + + + To help with display, put some space around sammiched commas + + Category of sql statement executed. @@ -232,6 +262,11 @@ before all records are fetched and reader is closed. + + + True when other identical sql statements have been executed during this MiniProfiler session. + + Gets part of a stack trace containing only methods we care about. @@ -254,6 +289,11 @@ their starting time. + + + + + Creates and starts a new MiniProfiler for the root , filtering steps to . @@ -294,12 +334,38 @@ be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. - + + + Returns an that will time the code between its creation and disposal. Use this method when you + do not wish to include the MvcMiniProfiler namespace for the extension method. + + A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. + This step's visibility level; allows filtering when is called. + + Returns the css and javascript includes needed to display the MiniProfiler results UI. + Which side of the page the profiler popup button should be displayed on (defaults to left) + Whether to show trivial timings by default (defaults to false) + Whether to show time the time with children column by default (defaults to false) Script and link elements normally; an empty string when there is no active profiling session. + + + Renders the current to json. + + + + + Renders the parameter to json. + + + + + Deserializes the json string parameter to a . + + Identifies this Profiler so it may be stored/cached. @@ -352,6 +418,26 @@ Returns true when we have profiled queries. + + + Returns true when any child Timings have duplicate queries. + + + + + Returns true when or any of its are . + + + + + Returns true when all child s are . + + + + + Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms. + + Ticks since this MiniProfiler was started. @@ -461,7 +547,7 @@ Returns either includes' css/javascript or results' html. - + Handles rendering our .js and .less static content files. @@ -508,6 +594,21 @@ Useful when profiling many items in a loop, but you don't wish to always see this detail. + + + Dictates on which side of the page the profiler popup button is displayed; defaults to left. + + + + + Profiler popup button is displayed on the left. + + + + + Profiler popup button is displayed on the right. + + Contains helper methods that ease working with null s.