diff --git a/NzbDrone.5.1.ReSharper b/NzbDrone.5.1.ReSharper new file mode 100644 index 000000000..5792be25b --- /dev/null +++ b/NzbDrone.5.1.ReSharper @@ -0,0 +1,70 @@ + + + + + SOLUTION + + + + public + protected + internal + private + new + abstract + virtual + override + sealed + static + readonly + extern + unsafe + volatile + + + + + $object$_On$event$ + $event$Handler + + + + + + + $object$_On$event$ + $event$Handler + + + + + + + + + + + + + + $object$_On$event$ + $event$Handler + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NzbDrone.Core.Test/AutoMoq/AutoMoqer.cs b/NzbDrone.Core.Test/AutoMoq/AutoMoqer.cs index 2c59c52a2..8a00b36cf 100644 --- a/NzbDrone.Core.Test/AutoMoq/AutoMoqer.cs +++ b/NzbDrone.Core.Test/AutoMoq/AutoMoqer.cs @@ -14,9 +14,9 @@ namespace AutoMoq { public class AutoMoqer { + internal Type ResolveType; private IUnityContainer container; private IDictionary registeredMocks; - internal Type ResolveType = null; public AutoMoqer() { @@ -30,7 +30,7 @@ namespace AutoMoq public virtual T Resolve() { - ResolveType = typeof(T); + ResolveType = typeof (T); var result = container.Resolve(); ResolveType = null; return result; @@ -67,47 +67,6 @@ namespace AutoMoq SetMock(instance.GetType(), null); } - #region private methods - - private void SetupAutoMoqer(IUnityContainer container) - { - this.container = container; - registeredMocks = new Dictionary(); - - AddTheAutoMockingContainerExtensionToTheContainer(container); - container.RegisterInstance(this); - } - - private static void AddTheAutoMockingContainerExtensionToTheContainer(IUnityContainer container) - { - container.AddNewExtension(); - return; - } - - private Mock TheRegisteredMockForThisType(Type type) where T : class - { - return (Mock)registeredMocks.Where(x => x.Key == type).First().Value; - } - - private void CreateANewMockAndRegisterIt(Type type, MockBehavior behavior) where T : class - { - var mock = new Mock(behavior); - container.RegisterInstance(mock.Object); - SetMock(type, mock); - } - - private bool GetMockHasNotBeenCalledForThisType(Type type) - { - return registeredMocks.ContainsKey(type) == false; - } - - private static Type GetTheMockType() where T : class - { - return typeof(T); - } - - #endregion - public ISetup Setup(Expression> expression) where T : class { return GetMock().Setup(expression); @@ -147,5 +106,45 @@ namespace AutoMoq } } + #region private methods + + private void SetupAutoMoqer(IUnityContainer container) + { + this.container = container; + registeredMocks = new Dictionary(); + + AddTheAutoMockingContainerExtensionToTheContainer(container); + container.RegisterInstance(this); + } + + private static void AddTheAutoMockingContainerExtensionToTheContainer(IUnityContainer container) + { + container.AddNewExtension(); + return; + } + + private Mock TheRegisteredMockForThisType(Type type) where T : class + { + return (Mock) registeredMocks.Where(x => x.Key == type).First().Value; + } + + private void CreateANewMockAndRegisterIt(Type type, MockBehavior behavior) where T : class + { + var mock = new Mock(behavior); + container.RegisterInstance(mock.Object); + SetMock(type, mock); + } + + private bool GetMockHasNotBeenCalledForThisType(Type type) + { + return registeredMocks.ContainsKey(type) == false; + } + + private static Type GetTheMockType() where T : class + { + return typeof (T); + } + + #endregion } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/AutoMoq/AutoMoqerTest.cs b/NzbDrone.Core.Test/AutoMoq/AutoMoqerTest.cs index 19fecff58..dacb0e36d 100644 --- a/NzbDrone.Core.Test/AutoMoq/AutoMoqerTest.cs +++ b/NzbDrone.Core.Test/AutoMoq/AutoMoqerTest.cs @@ -1,22 +1,7 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; using AutoMoq; -using FizzWare.NBuilder; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using Ninject; -using Ninject.Moq; -using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; -using SubSonic.Repository; -using TvdbLib.Data; -using SubSonic.Extensions; namespace NzbDrone.Core.Test { @@ -117,7 +102,7 @@ namespace NzbDrone.Core.Test //Arrange var mocker = new AutoMoqer(); - var constant = new VirtualDependency() { PropValue = Guid.NewGuid().ToString() }; + var constant = new VirtualDependency {PropValue = Guid.NewGuid().ToString()}; mocker.SetConstant(constant); @@ -127,7 +112,6 @@ namespace NzbDrone.Core.Test //Assert Assert.AreEqual(constant.PropValue, result); } - } public class ConcreteClass @@ -138,24 +122,27 @@ namespace NzbDrone.Core.Test } } - public class Dependency : IDependency { } + public class Dependency : IDependency + { + } - public interface IDependency { } + public interface IDependency + { + } public class ClassWithDependencies { - public IDependency Dependency { get; set; } - public ClassWithDependencies(IDependency dependency) { Dependency = dependency; } + + public IDependency Dependency { get; set; } } public class ClassWithVirtualDependencies { private readonly VirtualDependency _virtualDependency; - public IDependency Dependency { get; set; } public ClassWithVirtualDependencies(IDependency dependency, VirtualDependency virtualDependency) { @@ -163,6 +150,8 @@ namespace NzbDrone.Core.Test Dependency = dependency; } + public IDependency Dependency { get; set; } + public string CallVirtualChild() { return _virtualDependency.VirtualMethod(); @@ -178,19 +167,20 @@ namespace NzbDrone.Core.Test { private readonly IDependency _dependency; - public string PropValue { get; set; } - - public VirtualDependency() { } + public VirtualDependency() + { + } public VirtualDependency(IDependency dependency) { _dependency = dependency; } + public string PropValue { get; set; } + public virtual string VirtualMethod() { return "hello"; } } - -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/AutoMoq/Unity/AutoMockingBuilderStrategy.cs b/NzbDrone.Core.Test/AutoMoq/Unity/AutoMockingBuilderStrategy.cs index d6dff8997..26297916e 100644 --- a/NzbDrone.Core.Test/AutoMoq/Unity/AutoMockingBuilderStrategy.cs +++ b/NzbDrone.Core.Test/AutoMoq/Unity/AutoMockingBuilderStrategy.cs @@ -10,9 +10,9 @@ namespace AutoMoq.Unity { internal class AutoMockingBuilderStrategy : BuilderStrategy { + private readonly IUnityContainer container; private readonly MockFactory mockFactory; private readonly IEnumerable registeredTypes; - private readonly IUnityContainer container; public AutoMockingBuilderStrategy(IEnumerable registeredTypes, IUnityContainer container) { @@ -45,7 +45,7 @@ namespace AutoMoq.Unity private static Type GetTheTypeFromTheBuilderContext(IBuilderContext context) { - return ((NamedTypeBuildKey)context.OriginalBuildKey).Type; + return (context.OriginalBuildKey).Type; } private bool TypeIsNotRegistered(Type type) @@ -62,19 +62,19 @@ namespace AutoMoq.Unity private Mock InvokeTheMockCreationMethod(MethodInfo createMethod) { - return (Mock)createMethod.Invoke(mockFactory, new object[] { new List().ToArray() }); + return (Mock) createMethod.Invoke(mockFactory, new object[] {new List().ToArray()}); } private MethodInfo GenerateAnInterfaceMockCreationMethod(Type type) { var createMethodWithNoParameters = mockFactory.GetType().GetMethod("Create", EmptyArgumentList()); - return createMethodWithNoParameters.MakeGenericMethod(new[] { type }); + return createMethodWithNoParameters.MakeGenericMethod(new[] {type}); } private static Type[] EmptyArgumentList() { - return new[] { typeof(object[]) }; + return new[] {typeof (object[])}; } #endregion diff --git a/NzbDrone.Core.Test/DbConfigControllerTest.cs b/NzbDrone.Core.Test/DbConfigControllerTest.cs index edb959b39..e70d613c4 100644 --- a/NzbDrone.Core.Test/DbConfigControllerTest.cs +++ b/NzbDrone.Core.Test/DbConfigControllerTest.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; -using AutoMoq; -using Gallio.Framework; +using AutoMoq; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -24,13 +18,13 @@ namespace NzbDrone.Core.Test const string value = "MY_VALUE"; //Arrange - var config = new Config { Key = key, Value = value }; + var config = new Config {Key = key, Value = value}; var mocker = new AutoMoqer(); mocker.GetMock() - .Setup(r => r.Single(key)) - .Returns(config); + .Setup(r => r.Single(key)) + .Returns(config); //Act mocker.Resolve().SetValue(key, value); @@ -50,9 +44,9 @@ namespace NzbDrone.Core.Test var mocker = new AutoMoqer(); mocker.GetMock() - .Setup(r => r.Single(It.IsAny())) - .Returns(null) - .Verifiable(); + .Setup(r => r.Single(It.IsAny())) + .Returns(null) + .Verifiable(); //Act mocker.Resolve().SetValue(key, value); @@ -60,7 +54,8 @@ namespace NzbDrone.Core.Test //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()); + mocker.GetMock().Verify(r => r.Add(It.Is(c => c.Key == key && c.Value == value)), + Times.Once()); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/EpisodeProviderTest.cs b/NzbDrone.Core.Test/EpisodeProviderTest.cs index 7b109098a..78142ebc7 100644 --- a/NzbDrone.Core.Test/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/EpisodeProviderTest.cs @@ -1,22 +1,15 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; using AutoMoq; using FizzWare.NBuilder; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using Ninject; -using Ninject.Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using SubSonic.Repository; using TvdbLib.Data; -using SubSonic.Extensions; namespace NzbDrone.Core.Test { @@ -33,24 +26,23 @@ namespace NzbDrone.Core.Test var fakeEpisodes = Builder.CreateNew().With( c => c.Episodes = - new List(Builder.CreateListOfSize(episodeCount). - WhereAll() - .Have(l => l.Language = new TvdbLanguage(0, "eng", "a")) - .Build()) - ).With(c => c.Id = seriesId).Build(); + new List(Builder.CreateListOfSize(episodeCount). + WhereAll() + .Have(l => l.Language = new TvdbLanguage(0, "eng", "a")) + .Build()) + ).With(c => c.Id = seriesId).Build(); var mocker = new AutoMoqer(); mocker.SetConstant(MockLib.GetEmptyRepository()); mocker.GetMock() - .Setup(c => c.GetSeries(seriesId, true)) - .Returns(fakeEpisodes).Verifiable(); + .Setup(c => c.GetSeries(seriesId, true)) + .Returns(fakeEpisodes).Verifiable(); //mocker.GetMock().SetReturnsDefault(); - //Act var sw = Stopwatch.StartNew(); mocker.Resolve().RefreshEpisodeInfo(seriesId); @@ -72,14 +64,14 @@ namespace NzbDrone.Core.Test var repo = new Mock(); var epInDb = new Episode - { - AirDate = DateTime.Today, - EpisodeId = 55555, - EpisodeNumber = 5, - Language = "en", - SeasonId = 4444, - SeasonNumber = 1 - }; + { + AirDate = DateTime.Today, + EpisodeId = 55555, + EpisodeNumber = 5, + Language = "en", + SeasonId = 4444, + SeasonNumber = 1 + }; season.Setup(s => s.IsIgnored(12345, 1)).Returns(false); series.Setup(s => s.QualityWanted(12345, QualityTypes.TV)).Returns(true); @@ -90,11 +82,10 @@ namespace NzbDrone.Core.Test //repo.All().Where(c => c.EpisodeId == episode.EpisodeId); - //Act //Assert } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Fixtures.cs b/NzbDrone.Core.Test/Fixtures.cs index ae4af6754..50a25be07 100644 --- a/NzbDrone.Core.Test/Fixtures.cs +++ b/NzbDrone.Core.Test/Fixtures.cs @@ -3,7 +3,6 @@ using System.IO; using MbUnit.Framework; using NLog; using NLog.Config; -using System.Linq; namespace NzbDrone.Core.Test { @@ -13,27 +12,32 @@ namespace NzbDrone.Core.Test [TearDown] public void TearDown() { - foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories)) + foreach ( + var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories)) { try { File.Delete(file); } catch - { } + { + } } } [FixtureTearDown] public void FixtureTearDown() { - foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.*", SearchOption.AllDirectories)) + foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.*", SearchOption.AllDirectories) + ) { try { File.Delete(file); } - catch { } + catch + { + } } } @@ -42,7 +46,8 @@ namespace NzbDrone.Core.Test { try { - LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false); + LogManager.Configuration = + new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false); LogManager.ThrowExceptions = true; } catch (Exception e) @@ -50,7 +55,5 @@ namespace NzbDrone.Core.Test Console.WriteLine("Unable to configure logging. " + e); } } - - } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/HistoryProviderTest.cs b/NzbDrone.Core.Test/HistoryProviderTest.cs index 623a37379..fef2798e5 100644 --- a/NzbDrone.Core.Test/HistoryProviderTest.cs +++ b/NzbDrone.Core.Test/HistoryProviderTest.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; @@ -20,7 +17,14 @@ namespace NzbDrone.Core.Test public void AllItems() { //Setup - var indexer = new Indexer { Enabled = true, IndexerId = 0, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; + var indexer = new Indexer + { + Enabled = true, + IndexerId = 0, + IndexerName = "NzbMatrix", + Order = 1, + RssUrl = "http://www.nzbmatrix.com" + }; var series = new Series { SeriesId = 5656, @@ -31,7 +35,7 @@ namespace NzbDrone.Core.Test Title = "30 Rock", Path = @"C:\Test\TV\30 Rock" }; - var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true }; + var season = new Season {SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true}; var episode = new Episode { AirDate = DateTime.Today.AddDays(-1), @@ -74,46 +78,53 @@ namespace NzbDrone.Core.Test { //Todo: This test fails... Moq Setup doesn't return the expected value //Setup - var indexer = new Indexer { Enabled = true, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; + var indexer = new Indexer + { + Enabled = true, + IndexerName = "NzbMatrix", + Order = 1, + RssUrl = "http://www.nzbmatrix.com" + }; var series = new Series - { - SeriesId = 5656, - CleanTitle = "rock", - Monitored = true, - Overview = "Series Overview", - QualityProfileId = 1, - Title = "30 Rock", - Path = @"C:\Test\TV\30 Rock" - }; - var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true }; + { + SeriesId = 5656, + CleanTitle = "rock", + Monitored = true, + Overview = "Series Overview", + QualityProfileId = 1, + Title = "30 Rock", + Path = @"C:\Test\TV\30 Rock" + }; + var season = new Season {SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true}; var episode = new Episode - { - AirDate = DateTime.Today.AddDays(-1), - EpisodeId = 1234, - EpisodeNumber = 5, - Language = "English", - Overview = "This is an Overview", - SeasonNumber = 1, - SeasonId = 4321, - Season = season, - SeriesId = 5656 - }; + { + AirDate = DateTime.Today.AddDays(-1), + EpisodeId = 1234, + EpisodeNumber = 5, + Language = "English", + Overview = "This is an Overview", + SeasonNumber = 1, + SeasonId = 4321, + Season = season, + SeriesId = 5656 + }; var list = new List(); list.Add(new History - { - HistoryId = new int(), - Date = DateTime.Now, - IsProper = false, - Quality = QualityTypes.TV, - IndexerId = indexer.IndexerId, - EpisodeId = episode.EpisodeId - }); + { + HistoryId = new int(), + Date = DateTime.Now, + IsProper = false, + Quality = QualityTypes.TV, + IndexerId = indexer.IndexerId, + EpisodeId = episode.EpisodeId + }); var proper = false; var repo = new Mock(); - repo.Setup(r => r.Exists(h => h.EpisodeId == episode.EpisodeId && h.IsProper == proper)).Returns(true); + repo.Setup(r => r.Exists(h => h.EpisodeId == episode.EpisodeId && h.IsProper == proper)).Returns( + true); var target = new HistoryProvider(repo.Object); @@ -131,44 +142,51 @@ namespace NzbDrone.Core.Test //Todo: This test fails... Moq Setup doesn't return the expected value //Setup - var indexer = new Indexer { Enabled = true, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; + var indexer = new Indexer + { + Enabled = true, + IndexerName = "NzbMatrix", + Order = 1, + RssUrl = "http://www.nzbmatrix.com" + }; var series = new Series - { - SeriesId = 5656, - CleanTitle = "rock", - Monitored = true, - Overview = "Series Overview", - QualityProfileId = 1, - Title = "30 Rock", - Path = @"C:\Test\TV\30 Rock" - }; - var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true }; + { + SeriesId = 5656, + CleanTitle = "rock", + Monitored = true, + Overview = "Series Overview", + QualityProfileId = 1, + Title = "30 Rock", + Path = @"C:\Test\TV\30 Rock" + }; + var season = new Season {SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true}; var episode = new Episode - { - AirDate = DateTime.Today.AddDays(-1), - EpisodeId = 1234, - EpisodeNumber = 5, - Language = "English", - Overview = "This is an Overview", - SeasonNumber = 1, - SeasonId = 4321, - Season = season, - SeriesId = 5656 - }; + { + AirDate = DateTime.Today.AddDays(-1), + EpisodeId = 1234, + EpisodeNumber = 5, + Language = "English", + Overview = "This is an Overview", + SeasonNumber = 1, + SeasonId = 4321, + Season = season, + SeriesId = 5656 + }; var list = new List(); list.Add(new History - { - HistoryId = new int(), - Date = DateTime.Now, - IsProper = false, - Quality = QualityTypes.TV, - IndexerId = indexer.IndexerId, - EpisodeId = episode.EpisodeId - }); + { + HistoryId = new int(), + Date = DateTime.Now, + IsProper = false, + Quality = QualityTypes.TV, + IndexerId = indexer.IndexerId, + EpisodeId = episode.EpisodeId + }); var repo = new Mock(); - repo.Setup(r => r.Exists(h => h.Episode == episode && h.IsProper == list[0].IsProper)).Returns(false); + repo.Setup(r => r.Exists(h => h.Episode == episode && h.IsProper == list[0].IsProper)).Returns( + false); var target = new HistoryProvider(repo.Object); diff --git a/NzbDrone.Core.Test/IndexerProviderTest.cs b/NzbDrone.Core.Test/IndexerProviderTest.cs index a5bb4a85f..02c17a07d 100644 --- a/NzbDrone.Core.Test/IndexerProviderTest.cs +++ b/NzbDrone.Core.Test/IndexerProviderTest.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; @@ -25,10 +21,14 @@ namespace NzbDrone.Core.Test //Setup var list = new List(); - list.Add(new Indexer { IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 }); - list.Add(new Indexer { IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 }); - list.Add(new Indexer { IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 }); - list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 }); + list.Add(new Indexer + {IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1}); + list.Add(new Indexer + {IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4}); + list.Add(new Indexer + {IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3}); + list.Add(new Indexer + {IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2}); var repo = new Mock(); var config = new Mock(); @@ -53,10 +53,14 @@ namespace NzbDrone.Core.Test //Setup var list = new List(); - list.Add(new Indexer { IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 }); - list.Add(new Indexer { IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 }); - list.Add(new Indexer { IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 }); - list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 }); + list.Add(new Indexer + {IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1}); + list.Add(new Indexer + {IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4}); + list.Add(new Indexer + {IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3}); + list.Add(new Indexer + {IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2}); var repo = new Mock(); var config = new Mock(); @@ -72,4 +76,4 @@ namespace NzbDrone.Core.Test Assert.AreEqual(result.Last().IndexerName, "Test3"); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/MediaFileProviderTests.cs b/NzbDrone.Core.Test/MediaFileProviderTests.cs index 6449dd0da..6f7633969 100644 --- a/NzbDrone.Core.Test/MediaFileProviderTests.cs +++ b/NzbDrone.Core.Test/MediaFileProviderTests.cs @@ -1,16 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq.Expressions; -using System.Text; using AutoMoq; using FizzWare.NBuilder; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using Ninject; -using Ninject.Moq; -using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; @@ -23,7 +16,6 @@ namespace NzbDrone.Core.Test // ReSharper disable InconsistentNaming public class MediaFileProviderTests { - [Test] [Description("Verifies that a new file imported properly")] public void import_new_file() @@ -45,15 +37,16 @@ namespace NzbDrone.Core.Test var mocker = new AutoMoqer(); mocker.GetMock() - .Setup(r => r.Exists(It.IsAny>>())).Returns(false).Verifiable(); + .Setup(r => r.Exists(It.IsAny>>())).Returns(false).Verifiable(); mocker.GetMock() - .Setup(r => r.Add(It.IsAny())).Returns(0).Verifiable(); + .Setup(r => r.Add(It.IsAny())).Returns(0).Verifiable(); mocker.GetMock() - .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable(); + .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode). + Verifiable(); mocker.GetMock() - .Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable(); + .Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable(); //Act @@ -62,7 +55,7 @@ namespace NzbDrone.Core.Test //Assert Assert.IsNotNull(result); mocker.GetMock().VerifyAll(); - mocker.GetMock().Verify(r => r.Add(result), Times.Once()); + mocker.GetMock().Verify(r => r.Add(result), Times.Once()); mocker.GetMock().VerifyAll(); mocker.GetMock().VerifyAll(); @@ -96,7 +89,7 @@ namespace NzbDrone.Core.Test var mocker = new AutoMoqer(); mocker.GetMock(MockBehavior.Strict) - .Setup(r => r.Exists(It.IsAny>>())).Returns(true).Verifiable(); + .Setup(r => r.Exists(It.IsAny>>())).Returns(true).Verifiable(); mocker.GetMock(MockBehavior.Strict); mocker.GetMock(MockBehavior.Strict); @@ -109,7 +102,7 @@ namespace NzbDrone.Core.Test mocker.GetMock().VerifyAll(); mocker.GetMock(MockBehavior.Strict).VerifyAll(); Assert.IsNull(result); - mocker.GetMock().Verify(r => r.Add(result), Times.Never()); + mocker.GetMock().Verify(r => r.Add(result), Times.Never()); } [Test] @@ -130,10 +123,11 @@ namespace NzbDrone.Core.Test //Mocks var mocker = new AutoMoqer(); mocker.GetMock(MockBehavior.Strict) - .Setup(r => r.Exists(It.IsAny>>())).Returns(false).Verifiable(); + .Setup(r => r.Exists(It.IsAny>>())).Returns(false).Verifiable(); mocker.GetMock(MockBehavior.Strict) - .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(null).Verifiable(); + .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(null). + Verifiable(); mocker.GetMock(MockBehavior.Strict); @@ -144,12 +138,7 @@ namespace NzbDrone.Core.Test //Assert mocker.VerifyAllMocks(); Assert.IsNull(result); - mocker.GetMock().Verify(r => r.Add(result), Times.Never()); + mocker.GetMock().Verify(r => r.Add(result), Times.Never()); } - - - } - - -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/MockLib.cs b/NzbDrone.Core.Test/MockLib.cs index 7e9e56712..a6f9bb5ba 100644 --- a/NzbDrone.Core.Test/MockLib.cs +++ b/NzbDrone.Core.Test/MockLib.cs @@ -1,40 +1,45 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; -using FizzWare.NBuilder; using Moq; -using NLog; using NzbDrone.Core.Instrumentation; -using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using SubSonic.DataProviders; using SubSonic.Repository; -using TvdbLib; namespace NzbDrone.Core.Test { /// - /// Provides the standard Mocks needed for a typical test + /// Provides the standard Mocks needed for a typical test /// - static class MockLib + internal static class MockLib { - public static string[] StandardSeries { - get { return new string[] { "c:\\tv\\the simpsons", "c:\\tv\\family guy", "c:\\tv\\southpark", "c:\\tv\\24" }; } + get { return new[] {"c:\\tv\\the simpsons", "c:\\tv\\family guy", "c:\\tv\\southpark", "c:\\tv\\24"}; } + } + + public static ConfigProvider StandardConfig + { + get + { + var mock = new Mock(); + mock.SetupGet(c => c.SeriesRoot).Returns("C:\\"); + return mock.Object; + } } public static IRepository GetEmptyRepository() { return GetEmptyRepository(true); } + public static IRepository GetEmptyRepository(bool enableLogging) { Console.WriteLine("Creating an empty SQLite database"); - var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".db;Version=3;New=True", "System.Data.SQLite"); + var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".db;Version=3;New=True", + "System.Data.SQLite"); if (enableLogging) { provider.Log = new NlogWriter(); @@ -42,16 +47,6 @@ namespace NzbDrone.Core.Test return new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations); } - public static ConfigProvider StandardConfig - { - get - { - var mock = new Mock(); - mock.SetupGet(c => c.SeriesRoot).Returns("C:\\"); - return mock.Object; - } - } - public static DiskProvider GetStandardDisk(int seasons, int episodes) { var mock = new Mock(); @@ -77,4 +72,4 @@ namespace NzbDrone.Core.Test return mock.Object; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs b/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs index 82a0c5a90..6ae16b6d8 100644 --- a/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs +++ b/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs @@ -6,28 +6,31 @@ using Ninject.Syntax; namespace Ninject.Moq { - /// - /// Extensions for the fluent binding syntax API. - /// - public static class ExtensionsForBindingSyntax - { - /// - /// Indicates that the service should be bound to a mocked instance of the specified type. - /// - /// The service that is being mocked. - /// The builder that is building the binding. - public static IBindingWhenInNamedWithOrOnSyntax ToMock(this IBindingToSyntax builder) - { - var haveBinding = builder as IHaveBinding; - - if (haveBinding == null) - throw new NotSupportedException(String.Format("The binding builder for {0} is of type {1}, which does not implement IHaveBinding and is therefore not extensible.", typeof(T), builder.GetType())); + /// + /// Extensions for the fluent binding syntax API. + /// + public static class ExtensionsForBindingSyntax + { + /// + /// Indicates that the service should be bound to a mocked instance of the specified type. + /// + /// The service that is being mocked. + /// The builder that is building the binding. + public static IBindingWhenInNamedWithOrOnSyntax ToMock(this IBindingToSyntax builder) + { + var haveBinding = builder as IHaveBinding; - IBinding binding = haveBinding.Binding; + if (haveBinding == null) + throw new NotSupportedException( + String.Format( + "The binding builder for {0} is of type {1}, which does not implement IHaveBinding and is therefore not extensible.", + typeof (T), builder.GetType())); - binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get()); + IBinding binding = haveBinding.Binding; - return builder as IBindingWhenInNamedWithOrOnSyntax; - } - } -} + binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get()); + + return builder as IBindingWhenInNamedWithOrOnSyntax; + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Ninject.Moq/MockProvider.cs b/NzbDrone.Core.Test/Ninject.Moq/MockProvider.cs index 3edab1a3f..04a744601 100644 --- a/NzbDrone.Core.Test/Ninject.Moq/MockProvider.cs +++ b/NzbDrone.Core.Test/Ninject.Moq/MockProvider.cs @@ -6,70 +6,75 @@ using Ninject.Injection; namespace Ninject.Moq { - /// - /// Creates mocked instances via Moq. - /// - public class MockProvider : IProvider - { - private static readonly Dictionary _injectors = new Dictionary(); + /// + /// Creates mocked instances via Moq. + /// + public class MockProvider : IProvider + { + private static readonly Dictionary _injectors = + new Dictionary(); - /// - /// Gets the type (or prototype) of instances the provider creates. - /// - public Type Type - { - get { return typeof(Mock<>); } - } + /// + /// Initializes a new instance of the class. + /// + /// The injector factory component. + public MockProvider(IInjectorFactory injectorFactory) + { + InjectorFactory = injectorFactory; + } - /// - /// Gets the injector factory component. - /// - public IInjectorFactory InjectorFactory { get; private set; } + /// + /// Gets the injector factory component. + /// + public IInjectorFactory InjectorFactory { get; private set; } - /// - /// Initializes a new instance of the class. - /// - /// The injector factory component. - public MockProvider(IInjectorFactory injectorFactory) - { - InjectorFactory = injectorFactory; - } + #region IProvider Members - /// - /// Creates an instance within the specified context. - /// - /// The context. - /// The created instance. - public object Create(IContext context) - { - ConstructorInjector injector = GetInjector(context.Request.Service); - var mock = injector.Invoke() as Mock; - return mock.Object; - } + /// + /// Gets the type (or prototype) of instances the provider creates. + /// + public Type Type + { + get { return typeof (Mock<>); } + } - private ConstructorInjector GetInjector(Type service) - { - lock (_injectors) - { - Type mockType = typeof(Mock<>).MakeGenericType(service); + /// + /// Creates an instance within the specified context. + /// + /// The context. + /// The created instance. + public object Create(IContext context) + { + ConstructorInjector injector = GetInjector(context.Request.Service); + var mock = injector.Invoke() as Mock; + return mock.Object; + } - if (_injectors.ContainsKey(mockType)) - return _injectors[mockType]; + #endregion - ConstructorInjector injector = InjectorFactory.Create(mockType.GetConstructor(Type.EmptyTypes)); - _injectors[mockType] = injector; + private ConstructorInjector GetInjector(Type service) + { + lock (_injectors) + { + Type mockType = typeof (Mock<>).MakeGenericType(service); - return injector; - } - } + if (_injectors.ContainsKey(mockType)) + return _injectors[mockType]; - /// - /// Gets a callback that creates an instance of the . - /// - /// The created callback. - public static Func GetCreationCallback() - { - return ctx => new MockProvider(ctx.Kernel.Components.Get()); - } - } -} + ConstructorInjector injector = InjectorFactory.Create(mockType.GetConstructor(Type.EmptyTypes)); + _injectors[mockType] = injector; + + return injector; + } + } + + /// + /// Gets a callback that creates an instance of the . + /// + /// The created callback. + public static Func GetCreationCallback() + { + return ctx => new MockProvider(ctx.Kernel.Components.Get()); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Ninject.Moq/MockingKernel.cs b/NzbDrone.Core.Test/Ninject.Moq/MockingKernel.cs index 0a0eba8fd..f391dc549 100644 --- a/NzbDrone.Core.Test/Ninject.Moq/MockingKernel.cs +++ b/NzbDrone.Core.Test/Ninject.Moq/MockingKernel.cs @@ -5,14 +5,14 @@ using Ninject.Planning.Bindings; namespace Ninject.Moq { /// - /// A kernel that will create mocked instances (via Moq) for any service that is - /// requested for which no binding is registered. + /// A kernel that will create mocked instances (via Moq) for any service that is + /// requested for which no binding is registered. /// public class MockingKernel : StandardKernel { /// - /// Clears the kernel's cache, immediately deactivating all activated instances regardless of scope. - /// This does not remove any modules, extensions, or bindings. + /// Clears the kernel's cache, immediately deactivating all activated instances regardless of scope. + /// This does not remove any modules, extensions, or bindings. /// public void Reset() { @@ -20,22 +20,22 @@ namespace Ninject.Moq } /// - /// Attempts to handle a missing binding for a service. + /// Attempts to handle a missing binding for a service. /// - /// The service. + /// The service. /// True if the missing binding can be handled; otherwise false. protected override bool HandleMissingBinding(Type service) { var binding = new Binding(service) - { - ProviderCallback = MockProvider.GetCreationCallback(), - ScopeCallback = ctx => null, - IsImplicit = true - }; + { + ProviderCallback = MockProvider.GetCreationCallback(), + ScopeCallback = ctx => null, + IsImplicit = true + }; AddBinding(binding); return true; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 3ef26d57a..1e6f14e54 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Gallio.Framework; -using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; +using MbUnit.Framework; using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core.Test @@ -70,9 +65,9 @@ namespace NzbDrone.Core.Test } [Test] - [Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, new[] { 2, 3, 4, 5, 6 })] - [Row("Two.and.a.Half.Me.103.104.720p.HDTV.X264-DIMENSION", 1, new[] { 3, 4 })] - [Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })] + [Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, new[] {2, 3, 4, 5, 6})] + [Row("Two.and.a.Half.Me.103.104.720p.HDTV.X264-DIMENSION", 1, new[] {3, 4})] + [Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] {1, 2})] public void episode_multipart_parse(string path, int season, int[] episodes) { var result = Parser.ParseEpisodeInfo(path); @@ -82,7 +77,6 @@ namespace NzbDrone.Core.Test } - [Test] [Row(@"c:\test\", @"c:\test")] [Row(@"c:\\test\\", @"c:\test")] diff --git a/NzbDrone.Core.Test/Properties/AssemblyInfo.cs b/NzbDrone.Core.Test/Properties/AssemblyInfo.cs index 874626192..b3fff6ebe 100644 --- a/NzbDrone.Core.Test/Properties/AssemblyInfo.cs +++ b/NzbDrone.Core.Test/Properties/AssemblyInfo.cs @@ -1,12 +1,10 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; +using System.Reflection; using System.Runtime.InteropServices; -using MbUnit.Framework; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. + [assembly: AssemblyTitle("NzbDrone.Core.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -19,9 +17,11 @@ using MbUnit.Framework; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. + [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM + [assembly: Guid("699aed1b-015e-4f0d-9c81-d5557b05d260")] // Version information for an assembly consists of the following four values: @@ -34,5 +34,6 @@ using MbUnit.Framework; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] + [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/NzbDrone.Core.Test/QualityProfileTest.cs b/NzbDrone.Core.Test/QualityProfileTest.cs index 356b78490..4f7ce0a95 100644 --- a/NzbDrone.Core.Test/QualityProfileTest.cs +++ b/NzbDrone.Core.Test/QualityProfileTest.cs @@ -1,40 +1,34 @@ using System; using System.Collections.Generic; -using System.IO; +using System.Linq; using FizzWare.NBuilder; using MbUnit.Framework; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; -using System.Linq; -using TvdbLib.Data; namespace NzbDrone.Core.Test { [TestFixture] // ReSharper disable InconsistentNaming - public class QualityProfileTest { - /// - /// Test_s the storage. - /// - /// - /// + /// + /// Test_s the storage. + /// [Test] public void Test_Storage() { - //Arrange var repo = MockLib.GetEmptyRepository(); var testProfile = new QualityProfile { Name = Guid.NewGuid().ToString(), Cutoff = QualityTypes.TV, - Allowed = new List() { QualityTypes.HDTV, QualityTypes.DVD }, + Allowed = new List {QualityTypes.HDTV, QualityTypes.DVD}, }; //Act - var id = (int)repo.Add(testProfile); + var id = (int) repo.Add(testProfile); var fetch = repo.Single(c => c.QualityProfileId == id); //Assert @@ -51,19 +45,19 @@ namespace NzbDrone.Core.Test var repo = MockLib.GetEmptyRepository(); var testProfile = new QualityProfile - { - Name = Guid.NewGuid().ToString(), - Cutoff = QualityTypes.TV, - Allowed = new List() { QualityTypes.HDTV, QualityTypes.DVD }, - }; + { + Name = Guid.NewGuid().ToString(), + Cutoff = QualityTypes.TV, + Allowed = new List {QualityTypes.HDTV, QualityTypes.DVD}, + }; - var profileId = (int)repo.Add(testProfile); + var profileId = (int) repo.Add(testProfile); var series = Builder.CreateNew().Build(); series.QualityProfileId = profileId; - var seriesID = (int)repo.Add(series); + var seriesID = (int) repo.Add(series); var result = repo.All(); diff --git a/NzbDrone.Core.Test/RepoTest.cs b/NzbDrone.Core.Test/RepoTest.cs index 38a9663e3..e4050614b 100644 --- a/NzbDrone.Core.Test/RepoTest.cs +++ b/NzbDrone.Core.Test/RepoTest.cs @@ -3,10 +3,10 @@ using System.Linq; using FizzWare.NBuilder; using MbUnit.Framework; using NLog; +using NLog.Config; using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Repository; -using LogLevel = NzbDrone.Core.Instrumentation.LogLevel; -using NLog.Config; +using LogLevel = NLog.LogLevel; namespace NzbDrone.Core.Test { @@ -38,7 +38,9 @@ namespace NzbDrone.Core.Test } [Test] - [Description("This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value")] + [Description( + "This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value" + )] public void tvdbid_is_preserved([RandomNumbers(Minimum = 100, Maximum = 999, Count = 1)] int tvdbId) { //Arrange @@ -72,7 +74,7 @@ namespace NzbDrone.Core.Test var sonicTarget = new SubsonicTarget(sonicRepo); LogManager.Configuration.AddTarget("DbLogger", sonicTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget)); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget)); LogManager.Configuration.Reload(); Logger Logger = LogManager.GetCurrentClassLogger(); @@ -89,7 +91,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(message, logItem.Message); Assert.AreEqual(Logger.Name, logItem.Logger); Assert.AreEqual(Logger.Name, logItem.Logger); - Assert.AreEqual(LogLevel.Info, logItem.Level); + Assert.AreEqual(Instrumentation.LogLevel.Info, logItem.Level); } [Test] @@ -102,7 +104,7 @@ namespace NzbDrone.Core.Test var sonicTarget = new SubsonicTarget(sonicRepo); LogManager.Configuration.AddTarget("DbLogger", sonicTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget)); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget)); LogManager.Configuration.Reload(); Logger Logger = LogManager.GetCurrentClassLogger(); @@ -120,7 +122,7 @@ namespace NzbDrone.Core.Test Assert.AreNotEqual(new DateTime(), logItem.Time); Assert.AreEqual(message, logItem.Message); Assert.AreEqual(Logger.Name, logItem.Logger); - Assert.AreEqual(LogLevel.Error, logItem.Level); + Assert.AreEqual(Instrumentation.LogLevel.Error, logItem.Level); Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType); Assert.AreEqual(ex.ToString(), logItem.ExceptionString); Assert.AreEqual(ex.Message, logItem.ExceptionMessage); @@ -136,7 +138,7 @@ namespace NzbDrone.Core.Test var sonicTarget = new SubsonicTarget(sonicRepo); LogManager.Configuration.AddTarget("DbLogger", sonicTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, sonicTarget)); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget)); LogManager.Configuration.Reload(); Logger Logger = LogManager.GetCurrentClassLogger(); @@ -154,10 +156,10 @@ namespace NzbDrone.Core.Test Assert.AreNotEqual(new DateTime(), logItem.Time); Assert.AreEqual(ex.Message, logItem.Message); Assert.AreEqual(Logger.Name, logItem.Logger); - Assert.AreEqual(LogLevel.Error, logItem.Level); + Assert.AreEqual(Instrumentation.LogLevel.Error, logItem.Level); Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType); Assert.AreEqual(ex.ToString(), logItem.ExceptionString); Assert.AreEqual(ex.Message, logItem.ExceptionMessage); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/RootDirProviderTest.cs b/NzbDrone.Core.Test/RootDirProviderTest.cs index 20f656847..b931ee1df 100644 --- a/NzbDrone.Core.Test/RootDirProviderTest.cs +++ b/NzbDrone.Core.Test/RootDirProviderTest.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using AutoMoq; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; -using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -21,8 +15,8 @@ namespace NzbDrone.Core.Test { //Setup var sonicRepo = MockLib.GetEmptyRepository(); - sonicRepo.Add(new RootDir { Path = @"C:\TV" }); - sonicRepo.Add(new RootDir { Path = @"C:\TV2" }); + sonicRepo.Add(new RootDir {Path = @"C:\TV"}); + sonicRepo.Add(new RootDir {Path = @"C:\TV2"}); var mocker = new AutoMoqer(); @@ -48,7 +42,7 @@ namespace NzbDrone.Core.Test //Act var rootDirProvider = mocker.Resolve(); - rootDirProvider.Add(new RootDir{ Path = path }); + rootDirProvider.Add(new RootDir {Path = path}); //Assert @@ -69,8 +63,8 @@ namespace NzbDrone.Core.Test //Act var rootDirProvider = mocker.Resolve(); - rootDirProvider.Add(new RootDir { Path = @"C:\TV" }); - rootDirProvider.Update(new RootDir { Id = 1, Path = path }); + rootDirProvider.Add(new RootDir {Path = @"C:\TV"}); + rootDirProvider.Update(new RootDir {Id = 1, Path = path}); //Assert var rootDirs = rootDirProvider.GetAll(); @@ -90,7 +84,7 @@ namespace NzbDrone.Core.Test //Act var rootDirProvider = mocker.Resolve(); - rootDirProvider.Add(new RootDir { Path = @"C:\TV" }); + rootDirProvider.Add(new RootDir {Path = @"C:\TV"}); rootDirProvider.Remove(1); //Assert @@ -110,7 +104,7 @@ namespace NzbDrone.Core.Test //Act var rootDirProvider = mocker.Resolve(); - rootDirProvider.Add(new RootDir { Id = id, Path = path }); + rootDirProvider.Add(new RootDir {Id = id, Path = path}); //Assert var rootDir = rootDirProvider.GetRootDir(id); @@ -118,4 +112,4 @@ namespace NzbDrone.Core.Test Assert.AreEqual(path, rootDir.Path); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/RssProviderTest.cs b/NzbDrone.Core.Test/RssProviderTest.cs index e29c3dc2c..2d95fceea 100644 --- a/NzbDrone.Core.Test/RssProviderTest.cs +++ b/NzbDrone.Core.Test/RssProviderTest.cs @@ -1,31 +1,21 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.ServiceModel.Syndication; -using System.Text; using System.Xml; using AutoMoq; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using Ninject; -using Ninject.Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Feed; -using NzbDrone.Core.Repository; -using SubSonic.Repository; namespace NzbDrone.Core.Test { [TestFixture] public class RssProviderTest - // ReSharper disable InconsistentNaming + // ReSharper disable InconsistentNaming { [Test] - public void Download_feed_test() { var mocker = new AutoMoqer(); @@ -38,19 +28,20 @@ namespace NzbDrone.Core.Test mocker.Resolve().Fetch(); } - } public class MockFeedProvider : FeedProviderBase { - public MockFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider) + public MockFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, + EpisodeProvider episodeProvider, ConfigProvider configProvider, + HttpProvider httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) { } protected override string[] URL { - get { return new[] { "www.google.com" }; } + get { return new[] {"www.google.com"}; } } protected override string Name @@ -63,4 +54,4 @@ namespace NzbDrone.Core.Test return item.Links[0].Uri.ToString(); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/SabControllerTest.cs b/NzbDrone.Core.Test/SabControllerTest.cs index fd402532e..b22337c89 100644 --- a/NzbDrone.Core.Test/SabControllerTest.cs +++ b/NzbDrone.Core.Test/SabControllerTest.cs @@ -1,15 +1,9 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Text; using AutoMoq; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; -using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; -using SubSonic.Repository; namespace NzbDrone.Core.Test { @@ -49,11 +43,15 @@ namespace NzbDrone.Core.Test .Returns(category); mocker.GetMock() - .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns("ok"); + .Setup( + s => + s.DownloadString( + "http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("ok"); //Act - bool result = mocker.Resolve().AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); + bool result = mocker.Resolve().AddByUrl( + "http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); //Assert Assert.AreEqual(true, result); @@ -83,11 +81,15 @@ namespace NzbDrone.Core.Test fakeConfig.Setup(c => c.GetValue("SabTvCategory", String.Empty, true)).Returns(category); mocker.GetMock() - .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns("error"); + .Setup( + s => + s.DownloadString( + "http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns("error"); //Act - bool result = mocker.Resolve().AddByUrl("http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); + bool result = mocker.Resolve().AddByUrl( + "http://www.nzbclub.com/nzb_download.aspx?mid=1950232", "This is an Nzb"); //Assert Assert.AreEqual(false, result); @@ -113,7 +115,10 @@ namespace NzbDrone.Core.Test fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); mocker.GetMock() - .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Setup( + s => + s.DownloadString( + "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(new StreamReader(@".\Files\Queue.xml").ReadToEnd()); //Act @@ -143,8 +148,11 @@ namespace NzbDrone.Core.Test fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); mocker.GetMock() - .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns(new StreamReader(@".\Files\QueueEmpty.xml").ReadToEnd()); + .Setup( + s => + s.DownloadString( + "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns(new StreamReader(@".\Files\QueueEmpty.xml").ReadToEnd()); //Act bool result = mocker.Resolve().IsInQueue(String.Empty); @@ -173,8 +181,11 @@ namespace NzbDrone.Core.Test fakeConfig.Setup(c => c.GetValue("SabPassword", String.Empty, false)).Returns(password); mocker.GetMock() - .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) - .Returns(new StreamReader(@".\Files\QueueError.xml").ReadToEnd()); + .Setup( + s => + s.DownloadString( + "http://192.168.5.55:2222/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) + .Returns(new StreamReader(@".\Files\QueueError.xml").ReadToEnd()); //Act @@ -184,4 +195,4 @@ namespace NzbDrone.Core.Test Assert.AreEqual(false, result); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/SeriesProviderTest.cs b/NzbDrone.Core.Test/SeriesProviderTest.cs index 99ec64ac6..d17151258 100644 --- a/NzbDrone.Core.Test/SeriesProviderTest.cs +++ b/NzbDrone.Core.Test/SeriesProviderTest.cs @@ -1,24 +1,18 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.IO; -using System.Text; +using System.Linq; using AutoMoq; using FizzWare.NBuilder; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; -using Ninject; -using Ninject.Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using SubSonic.Repository; using TvdbLib.Data; -using System.Linq; // ReSharper disable InconsistentNaming + namespace NzbDrone.Core.Test { [TestFixture] @@ -65,7 +59,6 @@ namespace NzbDrone.Core.Test [Test] public void Add_new_series() { - var mocker = new AutoMoqer(); mocker.SetConstant(MockLib.GetEmptyRepository()); @@ -85,16 +78,14 @@ namespace NzbDrone.Core.Test Assert.AreEqual(path, series.First().Path); Assert.AreEqual(tvDbId, series.First().SeriesId); Assert.AreEqual(qualityProfileId, series.First().QualityProfileId); - } - [Test] - [Row(new object[] { "That's Life - 2x03 -The Devil and Miss DeLucca", "That's Life" })] - [Row(new object[] { "Van.Duin.Op.Zn.Best.S02E05.DUTCH.WS.PDTV.XViD-DiFFERENT", "Van Duin Op Zn Best" })] - [Row(new object[] { "Dollhouse.S02E06.The.Left.Hand.720p.BluRay.x264-SiNNERS", "Dollhouse" })] - [Row(new object[] { "Heroes.S02.COMPLETE.German.PROPER.DVDRip.XviD-Prim3time", "Heroes" })] + [Row(new object[] {"That's Life - 2x03 -The Devil and Miss DeLucca", "That's Life"})] + [Row(new object[] {"Van.Duin.Op.Zn.Best.S02E05.DUTCH.WS.PDTV.XViD-DiFFERENT", "Van Duin Op Zn Best"})] + [Row(new object[] {"Dollhouse.S02E06.The.Left.Hand.720p.BluRay.x264-SiNNERS", "Dollhouse"})] + [Row(new object[] {"Heroes.S02.COMPLETE.German.PROPER.DVDRip.XviD-Prim3time", "Heroes"})] [Ignore("should be updated to validate agains a remote episode instance rather than just the title string")] public void Test_Parse_Success(string postTitle, string title) { @@ -110,14 +101,14 @@ namespace NzbDrone.Core.Test mocker.SetConstant(MockLib.GetEmptyRepository()); mocker.Resolve().Add(Builder.CreateNew() - .With(c => c.Monitored = true) - .With(c => c.SeriesId = 12) - .Build()); + .With(c => c.Monitored = true) + .With(c => c.SeriesId = 12) + .Build()); mocker.Resolve().Add(Builder.CreateNew() - .With(c => c.Monitored = false) - .With(c => c.SeriesId = 11) - .Build()); + .With(c => c.Monitored = false) + .With(c => c.SeriesId = 11) + .Build()); //Act, Assert @@ -128,7 +119,6 @@ namespace NzbDrone.Core.Test } - [Test] [Row(12, QualityTypes.TV, true)] [Row(12, QualityTypes.Unknown, false)] @@ -139,14 +129,14 @@ namespace NzbDrone.Core.Test public void QualityWanted(int seriesId, QualityTypes qualityTypes, Boolean result) { var quality = Builder.CreateNew() - .With(q => q.Allowed = new List() { QualityTypes.BDRip, QualityTypes.DVD, QualityTypes.TV }) - .With(q => q.Cutoff = QualityTypes.DVD) - .Build(); + .With(q => q.Allowed = new List {QualityTypes.BDRip, QualityTypes.DVD, QualityTypes.TV}) + .With(q => q.Cutoff = QualityTypes.DVD) + .Build(); var series = Builder.CreateNew() - .With(c => c.SeriesId = 12) - .With(c => c.QualityProfileId = quality.QualityProfileId) - .Build(); + .With(c => c.SeriesId = 12) + .With(c => c.QualityProfileId = quality.QualityProfileId) + .Build(); var mocker = new AutoMoqer(); var emptyRepository = MockLib.GetEmptyRepository(); @@ -154,7 +144,7 @@ namespace NzbDrone.Core.Test mocker.GetMock() - .Setup(c => c.Find(quality.QualityProfileId)).Returns(quality); + .Setup(c => c.Find(quality.QualityProfileId)).Returns(quality); emptyRepository.Add(series); @@ -165,4 +155,4 @@ namespace NzbDrone.Core.Test Assert.AreEqual(result, needed); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/SyncProviderTest.cs b/NzbDrone.Core.Test/SyncProviderTest.cs index 660f39413..b0422ed68 100644 --- a/NzbDrone.Core.Test/SyncProviderTest.cs +++ b/NzbDrone.Core.Test/SyncProviderTest.cs @@ -1,15 +1,9 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Text; using AutoMoq; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; -using SubSonic.Repository; namespace NzbDrone.Core.Test { @@ -35,11 +29,11 @@ namespace NzbDrone.Core.Test } [Test] - [ExpectedException(typeof(ArgumentException))] + [ExpectedException(typeof (ArgumentException))] public void empty_folder_path_throws() { var mocker = new AutoMoqer(); mocker.Resolve().GetUnmappedFolders(""); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/TvDbControllerTest.cs b/NzbDrone.Core.Test/TvDbControllerTest.cs index 6becfb0b9..eec987004 100644 --- a/NzbDrone.Core.Test/TvDbControllerTest.cs +++ b/NzbDrone.Core.Test/TvDbControllerTest.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Text; -using Gallio.Framework; using MbUnit.Framework; -using MbUnit.Framework.ContractVerifiers; using NzbDrone.Core.Providers; namespace NzbDrone.Core.Test @@ -40,19 +36,19 @@ namespace NzbDrone.Core.Test [Test] - [Row(new object[] { "CAPITAL", "capital", true })] - [Row(new object[] { "Something!!", "Something", true })] - [Row(new object[] { "Simpsons 2000", "Simpsons", true })] - [Row(new object[] { "Simp222sons", "Simpsons", true })] - [Row(new object[] { "Simpsons", "The Simpsons", true })] - [Row(new object[] { "Law and order", "Law & order", true })] - [Row(new object[] { "xxAndxx", "xxxx", false })] - [Row(new object[] { "Andxx", "xx", false })] - [Row(new object[] { "xxAnd", "xx", false })] - [Row(new object[] { "Thexx", "xx", false })] - [Row(new object[] { "Thexx", "xx", false })] - [Row(new object[] { "xxThexx", "xxxxx", false })] - [Row(new object[] { "Simpsons The", "Simpsons", true })] + [Row(new object[] {"CAPITAL", "capital", true})] + [Row(new object[] {"Something!!", "Something", true})] + [Row(new object[] {"Simpsons 2000", "Simpsons", true})] + [Row(new object[] {"Simp222sons", "Simpsons", true})] + [Row(new object[] {"Simpsons", "The Simpsons", true})] + [Row(new object[] {"Law and order", "Law & order", true})] + [Row(new object[] {"xxAndxx", "xxxx", false})] + [Row(new object[] {"Andxx", "xx", false})] + [Row(new object[] {"xxAnd", "xx", false})] + [Row(new object[] {"Thexx", "xx", false})] + [Row(new object[] {"Thexx", "xx", false})] + [Row(new object[] {"xxThexx", "xxxxx", false})] + [Row(new object[] {"Simpsons The", "Simpsons", true})] public void Name_match_test(string a, string b, bool match) { bool result = TvDbProvider.IsTitleMatch(a, b); @@ -85,8 +81,5 @@ namespace NzbDrone.Core.Test //assert Assert.IsNull(result); } - } - - -} +} \ No newline at end of file diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 0e8fbc300..861812669 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -2,22 +2,16 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Web; using System.Web.Hosting; using Ninject; -using NLog.Config; -using NLog.Targets; +using NLog; using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; -using NzbDrone.Core.Providers.Fakes; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using SubSonic.DataProviders; -using SubSonic.Query; using SubSonic.Repository; -using NLog; -using System.Linq; namespace NzbDrone.Core { @@ -28,6 +22,45 @@ namespace NzbDrone.Core private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static string _startupPath; + public static String AppPath + { + get + { + if (!String.IsNullOrWhiteSpace(HostingEnvironment.ApplicationPhysicalPath)) + { + return HostingEnvironment.ApplicationPhysicalPath; + } + return Directory.GetCurrentDirectory(); + } + } + + public static string ExecutablePath + { + get + { + //var uri = new Uri(Assembly.EscapedCodeBase); + //return Path.GetDirectoryName(uri.LocalPath); + return Directory.GetCurrentDirectory(); + } + } + + public static string StartupPath + { + get { return _startupPath; } + } + + public static StandardKernel NinjectKernel + { + get + { + if (_kernel == null) + { + BindKernel(); + } + return _kernel; + } + } + public static void BindKernel() { lock (KernelLock) @@ -42,10 +75,12 @@ namespace NzbDrone.Core var AppDataPath = new DirectoryInfo(Path.Combine(AppPath, "App_Data", "nzbdrone.db")); if (!AppDataPath.Exists) AppDataPath.Create(); - string connectionString = String.Format("Data Source={0};Version=3;", Path.Combine(AppDataPath.FullName, "nzbdrone.db")); + string connectionString = String.Format("Data Source={0};Version=3;", + Path.Combine(AppDataPath.FullName, "nzbdrone.db")); var dbProvider = ProviderFactory.GetProvider(connectionString, "System.Data.SQLite"); - string logConnectionString = String.Format("Data Source={0};Version=3;", Path.Combine(AppDataPath.FullName, "log.db")); + string logConnectionString = String.Format("Data Source={0};Version=3;", + Path.Combine(AppDataPath.FullName, "log.db")); var logDbProvider = ProviderFactory.GetProvider(logConnectionString, "System.Data.SQLite"); @@ -80,9 +115,11 @@ namespace NzbDrone.Core _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); _kernel.Bind().ToSelf().InSingletonScope(); - _kernel.Bind().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope(); + _kernel.Bind().ToMethod( + c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope(); - _kernel.Bind().ToConstant(logRepository).WhenInjectedInto().InSingletonScope(); + _kernel.Bind().ToConstant(logRepository).WhenInjectedInto(). + InSingletonScope(); _kernel.Bind().ToConstant(logRepository).WhenInjectedInto().InSingletonScope(); ForceMigration(_kernel.Get()); @@ -97,46 +134,6 @@ namespace NzbDrone.Core } } - public static String AppPath - { - get - { - if (!String.IsNullOrWhiteSpace(HostingEnvironment.ApplicationPhysicalPath)) - { - return HostingEnvironment.ApplicationPhysicalPath; - } - return Directory.GetCurrentDirectory(); - - } - } - - public static string ExecutablePath - { - get - { - //var uri = new Uri(Assembly.EscapedCodeBase); - //return Path.GetDirectoryName(uri.LocalPath); - return Directory.GetCurrentDirectory(); - } - } - - public static string StartupPath - { - get { return _startupPath; } - } - - public static StandardKernel NinjectKernel - { - get - { - if (_kernel == null) - { - BindKernel(); - } - return _kernel; - } - } - private static void ForceMigration(IRepository repository) { repository.GetPaged(0, 1); @@ -148,23 +145,24 @@ namespace NzbDrone.Core } /// - /// This method forces IISExpress process to exit with the host application + /// This method forces IISExpress process to exit with the host application /// public static void DedicateToHost() { try { Logger.Debug("Attaching to parent process for automatic termination."); - var pc = new PerformanceCounter("Process", "Creating Process ID", Process.GetCurrentProcess().ProcessName); - var pid = (int)pc.NextValue(); + var pc = new PerformanceCounter("Process", "Creating Process ID", + Process.GetCurrentProcess().ProcessName); + var pid = (int) pc.NextValue(); var hostProcess = Process.GetProcessById(pid); hostProcess.EnableRaisingEvents = true; hostProcess.Exited += (delegate - { - Logger.Info("Host has been terminated. Shutting down web server."); - ShutDown(); - }); + { + Logger.Info("Host has been terminated. Shutting down web server."); + ShutDown(); + }); Logger.Debug("Successfully Attached to host. Process ID: {0}", pid); } @@ -184,8 +182,10 @@ namespace NzbDrone.Core { //Setup the default providers in the Providers table - string nzbMatrixRss = "http://rss.nzbmatrix.com/rss.php?page=download&username={USERNAME}&apikey={APIKEY}&subcat=6,41&english=1"; - string nzbMatrixApi = "http://rss.nzbmatrix.com/rss.php?page=download&username={USERNAME}&apikey={APIKEY}&subcat=6,41&english=1&age={AGE}&term={TERM}"; + string nzbMatrixRss = + "http://rss.nzbmatrix.com/rss.php?page=download&username={USERNAME}&apikey={APIKEY}&subcat=6,41&english=1"; + string nzbMatrixApi = + "http://rss.nzbmatrix.com/rss.php?page=download&username={USERNAME}&apikey={APIKEY}&subcat=6,41&english=1&age={AGE}&term={TERM}"; string nzbsOrgRss = "http://nzbs.org/rss.php?type=1&dl=1&num=100&i={UID}&h={HASH}"; string nzbsOrgApi = String.Empty; string nzbsrusRss = "http://www.nzbsrus.com/rssfeed.php?cat=91,75&i={UID}&h={HASH}"; @@ -210,13 +210,13 @@ namespace NzbDrone.Core }; var nzbsrusIndexer = new Indexer - { - IndexerId = 3, - IndexerName = "Nzbsrus", - RssUrl = nzbsrusRss, - ApiUrl = nzbsrusApi, - Order = 3 - }; + { + IndexerId = 3, + IndexerName = "Nzbsrus", + RssUrl = nzbsrusRss, + ApiUrl = nzbsrusApi, + Order = 3 + }; //NzbMatrix Logger.Debug("Checking for NzbMatrix Indexer"); @@ -273,18 +273,20 @@ namespace NzbDrone.Core private static void SetupDefaultQualityProfiles(IRepository repository) { var sd = new QualityProfile - { - Name = "SD", - Allowed = new List { QualityTypes.TV, QualityTypes.DVD }, - Cutoff = QualityTypes.TV - }; + { + Name = "SD", + Allowed = new List {QualityTypes.TV, QualityTypes.DVD}, + Cutoff = QualityTypes.TV + }; var hd = new QualityProfile - { - Name = "HD", - Allowed = new List { QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.BDRip, QualityTypes.Bluray720 }, - Cutoff = QualityTypes.HDTV - }; + { + Name = "HD", + Allowed = + new List + {QualityTypes.HDTV, QualityTypes.WEBDL, QualityTypes.BDRip, QualityTypes.Bluray720}, + Cutoff = QualityTypes.HDTV + }; //Add or Update SD Logger.Debug(String.Format("Checking for default QualityProfile: {0}", sd.Name)); diff --git a/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs b/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs index 9ccb95ae9..ded4882bb 100644 --- a/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs +++ b/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs @@ -7,25 +7,70 @@ namespace NzbDrone.Core.Helpers public static class EpisodeSortingHelper { private static readonly List SeparatorStyles = new List - { - new EpisodeSortingType {Id = 0, Name = "Dash", Pattern = " - "}, - new EpisodeSortingType {Id = 1, Name = "Space", Pattern = " "} - }; + { + new EpisodeSortingType + { + Id = 0, + Name = "Dash", + Pattern = " - " + }, + new EpisodeSortingType + { + Id = 1, + Name = "Space", + Pattern = " " + } + }; private static readonly List NumberStyles = new List - { - new EpisodeSortingType { Id = 0, Name = "1x05", Pattern = "%sx%0e"}, - new EpisodeSortingType { Id = 1, Name = "01x05", Pattern = "%0sx%0e"}, - new EpisodeSortingType { Id = 2, Name = "S01E05", Pattern = "S%0sE%0e"}, - new EpisodeSortingType { Id = 3, Name = "s01e05", Pattern = "s%0se%0e"} - }; + { + new EpisodeSortingType + { + Id = 0, + Name = "1x05", + Pattern = "%sx%0e" + }, + new EpisodeSortingType + { + Id = 1, + Name = "01x05", + Pattern = "%0sx%0e" + }, + new EpisodeSortingType + { + Id = 2, + Name = "S01E05", + Pattern = "S%0sE%0e" + }, + new EpisodeSortingType + { + Id = 3, + Name = "s01e05", + Pattern = "s%0se%0e" + } + }; private static readonly List MultiEpisodeStyles = new List - { - new EpisodeSortingType { Id = 0, Name = "Extend", Pattern = "" }, - new EpisodeSortingType { Id = 1, Name = "Duplicate", Pattern = "" }, - new EpisodeSortingType { Id = 2, Name = "Repeat", Pattern = "" } - }; + { + new EpisodeSortingType + { + Id = 0, + Name = "Extend", + Pattern = "" + }, + new EpisodeSortingType + { + Id = 1, + Name = "Duplicate", + Pattern = "" + }, + new EpisodeSortingType + { + Id = 2, + Name = "Repeat", + Pattern = "" + } + }; public static List GetSeparatorStyles() { @@ -72,4 +117,4 @@ namespace NzbDrone.Core.Helpers return MultiEpisodeStyles.Single(s => s.Name == name); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Helpers/SceneNameHelper.cs b/NzbDrone.Core/Helpers/SceneNameHelper.cs index 91afad92f..73e50159e 100644 --- a/NzbDrone.Core/Helpers/SceneNameHelper.cs +++ b/NzbDrone.Core/Helpers/SceneNameHelper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using NzbDrone.Core.Model; namespace NzbDrone.Core.Helpers @@ -9,70 +8,302 @@ namespace NzbDrone.Core.Helpers public static class SceneNameHelper { private static readonly List SceneNameMappings = new List - { - new SceneNameModel { SeriesId = 72546, Name = "CSI" }, - new SceneNameModel { SeriesId = 73696, Name = "CSI New York" }, - new SceneNameModel { SeriesId = 73696, Name = "CSI NY" }, - new SceneNameModel { SeriesId = 110381, Name = "Archer" }, - new SceneNameModel { SeriesId = 83897, Name = "Life After People The Series" }, - new SceneNameModel { SeriesId = 83897, Name = "Life After People" }, - new SceneNameModel { SeriesId = 80552, Name = "Kitchen Nightmares US" }, - new SceneNameModel { SeriesId = 71256, Name = "The Daily Show" }, - new SceneNameModel { SeriesId = 71256, Name = "The Daily Show with Jon Stewart" }, - new SceneNameModel { SeriesId = 75692, Name = "Law and Order SVU" }, - new SceneNameModel { SeriesId = 75692, Name = "Law and Order Special Victims Unit" }, - new SceneNameModel { SeriesId = 71489, Name = "Law and Order Criminal Intent" }, - new SceneNameModel { SeriesId = 71489, Name = "Law and Order CI" }, - new SceneNameModel { SeriesId = 79590, Name = "Dancing With The Stars US" }, - new SceneNameModel { SeriesId = 73387, Name = "Craig Ferguson" }, - new SceneNameModel { SeriesId = 85355, Name = "Jimmy Fallon" }, - new SceneNameModel { SeriesId = 75088, Name = "David Letterman" }, - new SceneNameModel { SeriesId = 76706, Name = "Big Brother US" }, - new SceneNameModel { SeriesId = 105521, Name = "The Colony" }, - new SceneNameModel { SeriesId = 105521, Name = "The Colony US" }, - new SceneNameModel { SeriesId = 76235, Name = "Americas Funniest Home Videos" }, - new SceneNameModel { SeriesId = 76235, Name = "AFHV" }, - new SceneNameModel { SeriesId = 139941, Name = "Childrens Hospital US" }, - new SceneNameModel { SeriesId = 139941, Name = "Childrens Hospital" }, - new SceneNameModel { SeriesId = 83123, Name = "Merlin" }, - new SceneNameModel { SeriesId = 83123, Name = "Merlin 2008" }, - new SceneNameModel { SeriesId = 76779, Name = "WWE Monday Night RAW" }, - new SceneNameModel { SeriesId = 164951, Name = "Shit My Dad Says" }, - new SceneNameModel { SeriesId = 83714, Name = "Genius with Dave Gorman" }, - new SceneNameModel { SeriesId = 168161, Name = "Law and Order Los Angeles" }, - new SceneNameModel { SeriesId = 168161, Name = "Law and Order LA" }, - new SceneNameModel { SeriesId = 77526, Name = "Star Trek TOS" }, - new SceneNameModel { SeriesId = 72073, Name = "Star Trek DS9" }, - new SceneNameModel { SeriesId = 72194, Name = "Ellen Degeneres" }, - new SceneNameModel { SeriesId = 72194, Name = "Ellen Degeneres" }, - new SceneNameModel { SeriesId = 195831, Name = "Drinking Made Easy" }, - new SceneNameModel { SeriesId = 195831, Name = "Zane Lampreys Drinking Made Easy" }, - new SceneNameModel { SeriesId = 76133, Name = "Poirot" }, - new SceneNameModel { SeriesId = 76133, Name = "Agatha Christies Poirot" }, - new SceneNameModel { SeriesId = 70870, Name = "The Real World Road Rules Challenge" }, - new SceneNameModel { SeriesId = 70870, Name = "The Challenge Cutthroat" }, - new SceneNameModel { SeriesId = 77444, Name = "This Old House Program" }, - new SceneNameModel { SeriesId = 73290, Name = "60 Minutes US" }, - new SceneNameModel { SeriesId = 194751, Name = "Conan" }, - new SceneNameModel { SeriesId = 194751, Name = "Conan 2010" }, - new SceneNameModel { SeriesId = 164451, Name = "Carlos 2010" }, - new SceneNameModel { SeriesId = 70726, Name = "Babalon 5" }, - new SceneNameModel { SeriesId = 70726, Name = "Babalon5" }, - new SceneNameModel { SeriesId = 83714, Name = "Genius" }, - new SceneNameModel { SeriesId = 83714, Name = "Genius With Dave Gormand" }, - new SceneNameModel { SeriesId = 212571, Name = "Come Fly With Me 2010" }, - new SceneNameModel { SeriesId = 81563, Name = "Border Security" }, - new SceneNameModel { SeriesId = 81563, Name = "Border Security Australias Frontline" }, - new SceneNameModel { SeriesId = 172381, Name = "Silent Library US" }, - new SceneNameModel { SeriesId = 131791, Name = "Sci-Fi Science" }, - new SceneNameModel { SeriesId = 80646, Name = "Frontline" }, - new SceneNameModel { SeriesId = 80646, Name = "Frontline US" }, - new SceneNameModel { SeriesId = 189931, Name = "RBT AU" }, - new SceneNameModel { SeriesId = 73255, Name = "House" }, - new SceneNameModel { SeriesId = 73255, Name = "House MD" }, - new SceneNameModel { SeriesId = 73244, Name = "The Office" }, - new SceneNameModel { SeriesId = 73244, Name = "The Office US" }, - }; + { + new SceneNameModel + {SeriesId = 72546, Name = "CSI"}, + new SceneNameModel + { + SeriesId = 73696, + Name = "CSI New York" + }, + new SceneNameModel + {SeriesId = 73696, Name = "CSI NY"}, + new SceneNameModel + { + SeriesId = 110381, + Name = "Archer" + }, + new SceneNameModel + { + SeriesId = 83897, + Name = + "Life After People The Series" + }, + new SceneNameModel + { + SeriesId = 83897, + Name = "Life After People" + }, + new SceneNameModel + { + SeriesId = 80552, + Name = "Kitchen Nightmares US" + }, + new SceneNameModel + { + SeriesId = 71256, + Name = "The Daily Show" + }, + new SceneNameModel + { + SeriesId = 71256, + Name = + "The Daily Show with Jon Stewart" + }, + new SceneNameModel + { + SeriesId = 75692, + Name = "Law and Order SVU" + }, + new SceneNameModel + { + SeriesId = 75692, + Name = + "Law and Order Special Victims Unit" + }, + new SceneNameModel + { + SeriesId = 71489, + Name = + "Law and Order Criminal Intent" + }, + new SceneNameModel + { + SeriesId = 71489, + Name = "Law and Order CI" + }, + new SceneNameModel + { + SeriesId = 79590, + Name = "Dancing With The Stars US" + }, + new SceneNameModel + { + SeriesId = 73387, + Name = "Craig Ferguson" + }, + new SceneNameModel + { + SeriesId = 85355, + Name = "Jimmy Fallon" + }, + new SceneNameModel + { + SeriesId = 75088, + Name = "David Letterman" + }, + new SceneNameModel + { + SeriesId = 76706, + Name = "Big Brother US" + }, + new SceneNameModel + { + SeriesId = 105521, + Name = "The Colony" + }, + new SceneNameModel + { + SeriesId = 105521, + Name = "The Colony US" + }, + new SceneNameModel + { + SeriesId = 76235, + Name = + "Americas Funniest Home Videos" + }, + new SceneNameModel + {SeriesId = 76235, Name = "AFHV"}, + new SceneNameModel + { + SeriesId = 139941, + Name = "Childrens Hospital US" + }, + new SceneNameModel + { + SeriesId = 139941, + Name = "Childrens Hospital" + }, + new SceneNameModel + {SeriesId = 83123, Name = "Merlin"}, + new SceneNameModel + { + SeriesId = 83123, + Name = "Merlin 2008" + }, + new SceneNameModel + { + SeriesId = 76779, + Name = "WWE Monday Night RAW" + }, + new SceneNameModel + { + SeriesId = 164951, + Name = "Shit My Dad Says" + }, + new SceneNameModel + { + SeriesId = 83714, + Name = "Genius with Dave Gorman" + }, + new SceneNameModel + { + SeriesId = 168161, + Name = "Law and Order Los Angeles" + }, + new SceneNameModel + { + SeriesId = 168161, + Name = "Law and Order LA" + }, + new SceneNameModel + { + SeriesId = 77526, + Name = "Star Trek TOS" + }, + new SceneNameModel + { + SeriesId = 72073, + Name = "Star Trek DS9" + }, + new SceneNameModel + { + SeriesId = 72194, + Name = "Ellen Degeneres" + }, + new SceneNameModel + { + SeriesId = 72194, + Name = "Ellen Degeneres" + }, + new SceneNameModel + { + SeriesId = 195831, + Name = "Drinking Made Easy" + }, + new SceneNameModel + { + SeriesId = 195831, + Name = + "Zane Lampreys Drinking Made Easy" + }, + new SceneNameModel + {SeriesId = 76133, Name = "Poirot"}, + new SceneNameModel + { + SeriesId = 76133, + Name = "Agatha Christies Poirot" + }, + new SceneNameModel + { + SeriesId = 70870, + Name = + "The Real World Road Rules Challenge" + }, + new SceneNameModel + { + SeriesId = 70870, + Name = "The Challenge Cutthroat" + }, + new SceneNameModel + { + SeriesId = 77444, + Name = "This Old House Program" + }, + new SceneNameModel + { + SeriesId = 73290, + Name = "60 Minutes US" + }, + new SceneNameModel + {SeriesId = 194751, Name = "Conan"}, + new SceneNameModel + { + SeriesId = 194751, + Name = "Conan 2010" + }, + new SceneNameModel + { + SeriesId = 164451, + Name = "Carlos 2010" + }, + new SceneNameModel + { + SeriesId = 70726, + Name = "Babalon 5" + }, + new SceneNameModel + { + SeriesId = 70726, + Name = "Babalon5" + }, + new SceneNameModel + {SeriesId = 83714, Name = "Genius"}, + new SceneNameModel + { + SeriesId = 83714, + Name = "Genius With Dave Gormand" + }, + new SceneNameModel + { + SeriesId = 212571, + Name = "Come Fly With Me 2010" + }, + new SceneNameModel + { + SeriesId = 81563, + Name = "Border Security" + }, + new SceneNameModel + { + SeriesId = 81563, + Name = + "Border Security Australias Frontline" + }, + new SceneNameModel + { + SeriesId = 172381, + Name = "Silent Library US" + }, + new SceneNameModel + { + SeriesId = 131791, + Name = "Sci-Fi Science" + }, + new SceneNameModel + { + SeriesId = 80646, + Name = "Frontline" + }, + new SceneNameModel + { + SeriesId = 80646, + Name = "Frontline US" + }, + new SceneNameModel + { + SeriesId = 189931, + Name = "RBT AU" + }, + new SceneNameModel + {SeriesId = 73255, Name = "House"}, + new SceneNameModel + { + SeriesId = 73255, + Name = "House MD" + }, + new SceneNameModel + { + SeriesId = 73244, + Name = "The Office" + }, + new SceneNameModel + { + SeriesId = 73244, + Name = "The Office US" + }, + }; public static int FindByName(string cleanSeriesName) { @@ -95,6 +326,5 @@ namespace NzbDrone.Core.Helpers return results; } - } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Helpers/ServerHelper.cs b/NzbDrone.Core/Helpers/ServerHelper.cs index aeb91bb42..88b23ffde 100644 --- a/NzbDrone.Core/Helpers/ServerHelper.cs +++ b/NzbDrone.Core/Helpers/ServerHelper.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; namespace NzbDrone.Core.Helpers { @@ -15,4 +11,4 @@ namespace NzbDrone.Core.Helpers //return Dns.GetHostName(); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs b/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs index c0d233b10..8fac9e123 100644 --- a/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs +++ b/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs @@ -11,17 +11,18 @@ namespace NzbDrone.Core.Instrumentation protected override void Write(LogEventInfo logEvent) { if (logEvent.Exception == null) - throw new InvalidOperationException(@"Missing Exception Object.. Please Use Logger.FatalException() or Logger.ErrorException() rather + throw new InvalidOperationException( + @"Missing Exception Object.. Please Use Logger.FatalException() or Logger.ErrorException() rather than Logger.Fatal() and Logger.Error()"); if (!Debugger.IsAttached) { new Client - { - ApiKey = "43BBF60A-EB2A-4C1C-B09E-422ADF637265", - ApplicationName = "NZBDrone", - CurrentException = logEvent.Exception - }.Submit(); + { + ApiKey = "43BBF60A-EB2A-4C1C-B09E-422ADF637265", + ApplicationName = "NZBDrone", + CurrentException = logEvent.Exception + }.Submit(); } } } diff --git a/NzbDrone.Core/Instrumentation/Log.cs b/NzbDrone.Core/Instrumentation/Log.cs index 46d202e31..1ee9905d6 100644 --- a/NzbDrone.Core/Instrumentation/Log.cs +++ b/NzbDrone.Core/Instrumentation/Log.cs @@ -38,4 +38,4 @@ namespace NzbDrone.Core.Instrumentation get { return Level.ToString(); } } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/LogConfiguration.cs b/NzbDrone.Core/Instrumentation/LogConfiguration.cs index 19e0f84ff..b678e8966 100644 --- a/NzbDrone.Core/Instrumentation/LogConfiguration.cs +++ b/NzbDrone.Core/Instrumentation/LogConfiguration.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using System.IO; +using Ninject; using NLog; using NLog.Config; -using Ninject; namespace NzbDrone.Core.Instrumentation { @@ -15,7 +15,8 @@ namespace NzbDrone.Core.Instrumentation LogManager.ThrowExceptions = true; } - LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false); + LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), + false); LogManager.ConfigurationReloaded += ((s, e) => BindCustomLoggers()); BindCustomLoggers(); } @@ -35,9 +36,5 @@ namespace NzbDrone.Core.Instrumentation LogManager.Configuration.Reload(); } - } -} - - - +} \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/LogProvider.cs b/NzbDrone.Core/Instrumentation/LogProvider.cs index 9f207e4a1..931ed5084 100644 --- a/NzbDrone.Core/Instrumentation/LogProvider.cs +++ b/NzbDrone.Core/Instrumentation/LogProvider.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using NLog; using SubSonic.Repository; namespace NzbDrone.Core.Instrumentation { - public class LogProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -29,4 +25,4 @@ namespace NzbDrone.Core.Instrumentation Logger.Info("Cleared Log History"); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/NlogWriter.cs b/NzbDrone.Core/Instrumentation/NlogWriter.cs index 9fe0733e4..c0329f6f5 100644 --- a/NzbDrone.Core/Instrumentation/NlogWriter.cs +++ b/NzbDrone.Core/Instrumentation/NlogWriter.cs @@ -8,6 +8,11 @@ namespace NzbDrone.Core.Instrumentation { private static readonly Logger Logger = LogManager.GetLogger("NzbDrone.SubSonic"); + public override Encoding Encoding + { + get { return Encoding.Default; } + } + public override void Write(char[] buffer, int index, int count) { @@ -23,10 +28,5 @@ namespace NzbDrone.Core.Instrumentation { Logger.Trace(value); } - - public override Encoding Encoding - { - get { return Encoding.Default; } - } } } \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/SubsonicTarget.cs b/NzbDrone.Core/Instrumentation/SubsonicTarget.cs index b744de9fa..6e10f0f3a 100644 --- a/NzbDrone.Core/Instrumentation/SubsonicTarget.cs +++ b/NzbDrone.Core/Instrumentation/SubsonicTarget.cs @@ -1,11 +1,7 @@ using System; -using System.Diagnostics; -using Exceptioneer.WindowsFormsClient; using NLog; using NLog.Targets; using SubSonic.Repository; -using Ninject; -using NzbDrone.Core.Repository; namespace NzbDrone.Core.Instrumentation { diff --git a/NzbDrone.Core/Model/EpisodeParseResult.cs b/NzbDrone.Core/Model/EpisodeParseResult.cs index f52ef7ad5..cf6532e55 100644 --- a/NzbDrone.Core/Model/EpisodeParseResult.cs +++ b/NzbDrone.Core/Model/EpisodeParseResult.cs @@ -19,8 +19,8 @@ namespace NzbDrone.Core.Model public override string ToString() { - return string.Format("Series:{0} Season:{1} Episode:{2}", SeriesTitle, SeasonNumber, String.Join(",", Episodes)); + return string.Format("Series:{0} Season:{1} Episode:{2}", SeriesTitle, SeasonNumber, + String.Join(",", Episodes)); } - } } \ No newline at end of file diff --git a/NzbDrone.Core/Model/EpisodeRenameModel.cs b/NzbDrone.Core/Model/EpisodeRenameModel.cs index 9a965a8e1..9b262b63b 100644 --- a/NzbDrone.Core/Model/EpisodeRenameModel.cs +++ b/NzbDrone.Core/Model/EpisodeRenameModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NzbDrone.Core.Repository; +using NzbDrone.Core.Repository; namespace NzbDrone.Core.Model { @@ -13,4 +9,4 @@ namespace NzbDrone.Core.Model public EpisodeFile EpisodeFile { get; set; } public bool NewDownload { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/EpisodeSortingType.cs b/NzbDrone.Core/Model/EpisodeSortingType.cs index 678b0aa59..b162428e6 100644 --- a/NzbDrone.Core/Model/EpisodeSortingType.cs +++ b/NzbDrone.Core/Model/EpisodeSortingType.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Model +namespace NzbDrone.Core.Model { public class EpisodeSortingType { @@ -11,4 +6,4 @@ namespace NzbDrone.Core.Model public string Name { get; set; } public string Pattern { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/EpisodeStatusType.cs b/NzbDrone.Core/Model/EpisodeStatusType.cs index 5d5a5d54b..d1addd0e3 100644 --- a/NzbDrone.Core/Model/EpisodeStatusType.cs +++ b/NzbDrone.Core/Model/EpisodeStatusType.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Model +namespace NzbDrone.Core.Model { public enum EpisodeStatusType { @@ -11,4 +6,4 @@ namespace NzbDrone.Core.Model Grabbed = 1, Downloaded = 2 } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/Notification/BasicNotification.cs b/NzbDrone.Core/Model/Notification/BasicNotification.cs index 3291763c9..f06172336 100644 --- a/NzbDrone.Core/Model/Notification/BasicNotification.cs +++ b/NzbDrone.Core/Model/Notification/BasicNotification.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Model.Notification } /// - /// Gets or sets the unique id. + /// Gets or sets the unique id. /// /// The Id. public Guid Id { get; private set; } @@ -20,7 +20,7 @@ namespace NzbDrone.Core.Model.Notification public BasicNotificationType Type { get; set; } /// - /// Gets or sets a value indicating whether or not this message should be automatically dismissed after a period of time. + /// Gets or sets a value indicating whether or not this message should be automatically dismissed after a period of time. /// /// true if [auto dismiss]; otherwise, false. public bool AutoDismiss { get; set; } diff --git a/NzbDrone.Core/Model/Notification/ProgressNotification.cs b/NzbDrone.Core/Model/Notification/ProgressNotification.cs index ef4539e30..d9e876eae 100644 --- a/NzbDrone.Core/Model/Notification/ProgressNotification.cs +++ b/NzbDrone.Core/Model/Notification/ProgressNotification.cs @@ -18,53 +18,52 @@ namespace NzbDrone.Core.Model.Notification /// - /// Gets or sets the unique id. + /// Gets or sets the unique id. /// /// The Id. public Guid Id { get; private set; } /// - /// Gets or sets the title for this notification. + /// Gets or sets the title for this notification. /// /// The title. public String Title { get; set; } /// - /// Gets or sets the current status of this task. this field could be use to show the currently processing item in a long running task. + /// Gets or sets the current status of this task. this field could be use to show the currently processing item in a long running task. /// /// The current status. public String CurrentStatus { get; set; } /// - /// Gets or sets the completion status in percent. + /// Gets or sets the completion status in percent. /// /// The percent complete. public int PercentComplete { - get - { - return Convert.ToInt32(Convert.ToDouble(ProgressValue) / Convert.ToDouble(ProgressMax) * 100); - } + get { return Convert.ToInt32(Convert.ToDouble(ProgressValue)/Convert.ToDouble(ProgressMax)*100); } } /// - /// Gets or sets the total number of items that need to be completed + /// Gets or sets the total number of items that need to be completed /// /// The progress max. public int ProgressMax { get; set; } /// - /// Gets or sets the number of items successfully completed. + /// Gets or sets the number of items successfully completed. /// /// The progress value. public int ProgressValue { get; set; } /// - /// Gets or sets the status. + /// Gets or sets the status. /// /// The status. public ProgressNotificationStatus Status { get; set; } + #region IDisposable Members + public void Dispose() { if (Status == ProgressNotificationStatus.InProgress) @@ -73,5 +72,7 @@ namespace NzbDrone.Core.Model.Notification Status = ProgressNotificationStatus.Failed; } } + + #endregion } } \ No newline at end of file diff --git a/NzbDrone.Core/Model/NzbInfoModel.cs b/NzbDrone.Core/Model/NzbInfoModel.cs index 7722d3f3b..7f3264740 100644 --- a/NzbDrone.Core/Model/NzbInfoModel.cs +++ b/NzbDrone.Core/Model/NzbInfoModel.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core.Model { @@ -17,4 +12,4 @@ namespace NzbDrone.Core.Model return Title.EndsWith("(Passworded)", StringComparison.InvariantCultureIgnoreCase); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/SabnzbdPriorityType.cs b/NzbDrone.Core/Model/SabnzbdPriorityType.cs index a81db61a5..3df44877f 100644 --- a/NzbDrone.Core/Model/SabnzbdPriorityType.cs +++ b/NzbDrone.Core/Model/SabnzbdPriorityType.cs @@ -9,4 +9,4 @@ High = 1, Top = 2 } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/SceneNameModel.cs b/NzbDrone.Core/Model/SceneNameModel.cs index 595abd3a3..9a008fa1c 100644 --- a/NzbDrone.Core/Model/SceneNameModel.cs +++ b/NzbDrone.Core/Model/SceneNameModel.cs @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Model +namespace NzbDrone.Core.Model { public class SceneNameModel { public string Name { get; set; } public int SeriesId { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Model/SeasonParseResult.cs b/NzbDrone.Core/Model/SeasonParseResult.cs index 6c259c837..059850bff 100644 --- a/NzbDrone.Core/Model/SeasonParseResult.cs +++ b/NzbDrone.Core/Model/SeasonParseResult.cs @@ -14,6 +14,5 @@ namespace NzbDrone.Core.Model { return string.Format("Series:{0} Season:{1}", SeriesTitle, SeasonNumber); } - } } \ No newline at end of file diff --git a/NzbDrone.Core/Model/UpcomingEpisodesModel.cs b/NzbDrone.Core/Model/UpcomingEpisodesModel.cs index e1e6889bf..b03cc35f4 100644 --- a/NzbDrone.Core/Model/UpcomingEpisodesModel.cs +++ b/NzbDrone.Core/Model/UpcomingEpisodesModel.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using NzbDrone.Core.Repository; namespace NzbDrone.Core.Model @@ -12,4 +9,4 @@ namespace NzbDrone.Core.Model public List Today { get; set; } public List Week { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 312be2c62..b9b995f55 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -1,12 +1,9 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; using System.Text.RegularExpressions; using NLog; using NzbDrone.Core.Model; -using NzbDrone.Core.Providers; using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core @@ -16,22 +13,31 @@ namespace NzbDrone.Core private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Regex[] ReportTitleRegex = new[] - { - new Regex(@"(?.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?<episode>\d{2})\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports 103/113 naming - }; + { + new Regex( + @"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + new Regex( + @"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?<episode>\d{2})\W(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled) + //Supports 103/113 naming + }; private static readonly Regex[] SeasonReportTitleRegex = new[] - { - new Regex(@"(?<title>.+?)?\W?(?<year>\d{4}?)?\W(?:S|Season)?\W?(?<season>\d+)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - }; + { + new Regex( + @"(?<title>.+?)?\W?(?<year>\d{4}?)?\W(?:S|Season)?\W?(?<season>\d+)(?!\\)", + RegexOptions.IgnoreCase | + RegexOptions.Compiled), + }; - private static readonly Regex NormalizeRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex NormalizeRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", + RegexOptions.IgnoreCase | RegexOptions.Compiled); /// <summary> - /// Parses a post title into list of episodes it contains + /// Parses a post title into list of episodes it contains /// </summary> - /// <param name="title">Title of the report</param> + /// <param name = "title">Title of the report</param> /// <returns>List of episodes contained to the post</returns> internal static EpisodeParseResult ParseEpisodeInfo(string title) { @@ -53,18 +59,17 @@ namespace NzbDrone.Core } var parsedEpisode = new EpisodeParseResult - { - Proper = title.ToLower().Contains("proper"), - SeriesTitle = seriesName, - SeasonNumber = Convert.ToInt32(match[0].Groups["season"].Value), - Year = year, - Episodes = new List<int>() - }; + { + Proper = title.ToLower().Contains("proper"), + SeriesTitle = seriesName, + SeasonNumber = Convert.ToInt32(match[0].Groups["season"].Value), + Year = year, + Episodes = new List<int>() + }; foreach (Match matchGroup in match) { parsedEpisode.Episodes.Add(Convert.ToInt32(matchGroup.Groups["episode"].Value)); - } parsedEpisode.Quality = ParseQuality(title); @@ -79,9 +84,9 @@ namespace NzbDrone.Core } /// <summary> - /// Parses a post title into season it contains + /// Parses a post title into season it contains /// </summary> - /// <param name="title">Title of the report</param> + /// <param name = "title">Title of the report</param> /// <returns>Season information contained in the post</returns> internal static SeasonParseResult ParseSeasonInfo(string title) { @@ -105,11 +110,11 @@ namespace NzbDrone.Core var seasonNumber = Convert.ToInt32(match[0].Groups["season"].Value); var result = new SeasonParseResult - { - SeriesTitle = seriesName, - SeasonNumber = seasonNumber, - Year = year - }; + { + SeriesTitle = seriesName, + SeasonNumber = seasonNumber, + Year = year + }; result.Quality = ParseQuality(title); @@ -123,9 +128,9 @@ namespace NzbDrone.Core } /// <summary> - /// Parses a post title to find the series that relates to it + /// Parses a post title to find the series that relates to it /// </summary> - /// <param name="title">Title of the report</param> + /// <param name = "title">Title of the report</param> /// <returns>Normalized Series Name</returns> internal static string ParseSeriesName(string title) { @@ -155,9 +160,9 @@ namespace NzbDrone.Core } /// <summary> - /// Parses proper status out of a report title + /// Parses proper status out of a report title /// </summary> - /// <param name="title">Title of the report</param> + /// <param name = "title">Title of the report</param> /// <returns></returns> internal static bool ParseProper(string title) { @@ -229,10 +234,10 @@ namespace NzbDrone.Core } /// <summary> - /// Normalizes the title. removing all non-word characters as well as common tokens - /// such as 'the' and 'and' + /// Normalizes the title. removing all non-word characters as well as common tokens + /// such as 'the' and 'and' /// </summary> - /// <param name="title">title</param> + /// <param name = "title">title</param> /// <returns></returns> internal static string NormalizeTitle(string title) { @@ -255,7 +260,5 @@ namespace NzbDrone.Core return info.FullName.Trim('/', '\\', ' '); } - - } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/BacklogProvider.cs b/NzbDrone.Core/Providers/BacklogProvider.cs index 3c36c82e4..06e7fc9b6 100644 --- a/NzbDrone.Core/Providers/BacklogProvider.cs +++ b/NzbDrone.Core/Providers/BacklogProvider.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace NzbDrone.Core.Providers { @@ -13,6 +10,7 @@ namespace NzbDrone.Core.Providers { throw new NotImplementedException(); } + public virtual bool StartSearch(int seriesId) { throw new NotImplementedException(); diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index e8e48c4c8..6fdf61bde 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -238,10 +238,10 @@ namespace NzbDrone.Core.Providers.Core if (dbValue == null) { _sonicRepo.Add(new Config - { - Key = key, - Value = value - }); + { + Key = key, + Value = value + }); } else { diff --git a/NzbDrone.Core/Providers/Core/DiskProvider.cs b/NzbDrone.Core/Providers/Core/DiskProvider.cs index feb1daa71..b83cd1ee3 100644 --- a/NzbDrone.Core/Providers/Core/DiskProvider.cs +++ b/NzbDrone.Core/Providers/Core/DiskProvider.cs @@ -5,8 +5,6 @@ namespace NzbDrone.Core.Providers.Core { public class DiskProvider { - #region IDiskProvider Members - public virtual bool FolderExists(string path) { return Directory.Exists(path); @@ -48,7 +46,5 @@ namespace NzbDrone.Core.Providers.Core { File.Move(sourcePath, destinationPath); } - - #endregion } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Core/HttpProvider.cs b/NzbDrone.Core/Providers/Core/HttpProvider.cs index 8424a5de7..75b2ebceb 100644 --- a/NzbDrone.Core/Providers/Core/HttpProvider.cs +++ b/NzbDrone.Core/Providers/Core/HttpProvider.cs @@ -47,7 +47,6 @@ namespace NzbDrone.Core.Providers.Core { var webClient = new WebClient(); webClient.DownloadFile(request, filename); - } catch (Exception ex) { @@ -55,8 +54,6 @@ namespace NzbDrone.Core.Providers.Core Logger.TraceException(ex.Message, ex); throw; } - - } public virtual void DownloadFile(string request, string filename, string username, string password) diff --git a/NzbDrone.Core/Providers/EpisodeProvider.cs b/NzbDrone.Core/Providers/EpisodeProvider.cs index 18518c956..f333854a3 100644 --- a/NzbDrone.Core/Providers/EpisodeProvider.cs +++ b/NzbDrone.Core/Providers/EpisodeProvider.cs @@ -1,7 +1,6 @@ using System; -using System.Linq; using System.Collections.Generic; -using System.Text.RegularExpressions; +using System.Linq; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; @@ -13,17 +12,17 @@ namespace NzbDrone.Core.Providers { //TODO: Remove parsing of the series name, it should be done in series provider - private readonly IRepository _sonicRepo; - private readonly SeriesProvider _series; - private readonly SeasonProvider _seasons; - private readonly TvDbProvider _tvDb; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly HistoryProvider _history; private readonly QualityProvider _quality; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly SeasonProvider _seasons; + private readonly SeriesProvider _series; + private readonly IRepository _sonicRepo; + private readonly TvDbProvider _tvDb; public EpisodeProvider(IRepository sonicRepo, SeriesProvider seriesProvider, - SeasonProvider seasonProvider, TvDbProvider tvDbProvider, - HistoryProvider history, QualityProvider quality) + SeasonProvider seasonProvider, TvDbProvider tvDbProvider, + HistoryProvider history, QualityProvider quality) { _sonicRepo = sonicRepo; _series = seriesProvider; @@ -35,7 +34,6 @@ namespace NzbDrone.Core.Providers public EpisodeProvider() { - } public virtual Episode GetEpisode(long id) @@ -45,7 +43,9 @@ namespace NzbDrone.Core.Providers public virtual Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber) { - return _sonicRepo.Single<Episode>(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber && c.EpisodeNumber == episodeNumber); + return + _sonicRepo.Single<Episode>( + c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber && c.EpisodeNumber == episodeNumber); } public virtual IList<Episode> GetEpisodeBySeries(long seriesId) @@ -68,9 +68,9 @@ namespace NzbDrone.Core.Providers } /// <summary> - /// Comprehensive check on whether or not this episode is needed. + /// Comprehensive check on whether or not this episode is needed. /// </summary> - /// <param name="parsedReport">Episode that needs to be checked</param> + /// <param name = "parsedReport">Episode that needs to be checked</param> /// <returns></returns> public virtual bool IsNeeded(EpisodeParseResult parsedReport) { @@ -112,11 +112,10 @@ namespace NzbDrone.Core.Providers continue; } - return true;//If we get to this point and the file has not yet been rejected then accept it + return true; //If we get to this point and the file has not yet been rejected then accept it } return false; - } public virtual void RefreshEpisodeInfo(int seriesId) @@ -130,7 +129,7 @@ namespace NzbDrone.Core.Providers var newList = new List<Episode>(); Logger.Debug("Updating season info for series:{0}", targetSeries.SeriesName); - targetSeries.Episodes.Select(e => new { e.SeasonId, e.SeasonNumber }) + targetSeries.Episodes.Select(e => new {e.SeasonId, e.SeasonNumber}) .Distinct().ToList() .ForEach(s => _seasons.EnsureSeason(seriesId, s.SeasonId, s.SeasonNumber)); @@ -145,19 +144,20 @@ namespace NzbDrone.Core.Providers if (episode.FirstAired < new DateTime(1753, 1, 1)) episode.FirstAired = new DateTime(1753, 1, 1); - Logger.Trace("Updating info for series:{0} - episode:{1}", targetSeries.SeriesName, episode.EpisodeNumber); - var newEpisode = new Episode() - { - AirDate = episode.FirstAired, - EpisodeId = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - Language = episode.Language.Abbriviation, - Overview = episode.Overview, - SeasonId = episode.SeasonId, - SeasonNumber = episode.SeasonNumber, - SeriesId = seriesId, - Title = episode.EpisodeName - }; + Logger.Trace("Updating info for series:{0} - episode:{1}", targetSeries.SeriesName, + episode.EpisodeNumber); + var newEpisode = new Episode + { + AirDate = episode.FirstAired, + EpisodeId = episode.Id, + EpisodeNumber = episode.EpisodeNumber, + Language = episode.Language.Abbriviation, + Overview = episode.Overview, + SeasonId = episode.SeasonId, + SeasonNumber = episode.SeasonNumber, + SeriesId = seriesId, + Title = episode.EpisodeName + }; if (_sonicRepo.Exists<Episode>(e => e.EpisodeId == newEpisode.EpisodeId)) { @@ -172,7 +172,8 @@ namespace NzbDrone.Core.Providers } catch (Exception e) { - Logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}", seriesId), e); + Logger.FatalException( + String.Format("An error has occurred while updating episode info for series {0}", seriesId), e); failCount++; } } @@ -180,12 +181,14 @@ namespace NzbDrone.Core.Providers _sonicRepo.AddMany(newList); _sonicRepo.UpdateMany(updateList); - Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount); + Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", + targetSeries.SeriesName, successCount, failCount); } public virtual void RefreshEpisodeInfo(Season season) { - Logger.Info("Starting episode info refresh for season {0} of series:{1}", season.SeasonNumber, season.SeriesId); + Logger.Info("Starting episode info refresh for season {0} of series:{1}", season.SeasonNumber, + season.SeriesId); int successCount = 0; int failCount = 0; var targetSeries = _tvDb.GetSeries(season.SeriesId, true); @@ -204,19 +207,20 @@ namespace NzbDrone.Core.Providers if (episode.FirstAired < new DateTime(1753, 1, 1)) episode.FirstAired = new DateTime(1753, 1, 1); - Logger.Trace("Updating info for series:{0} - episode:{1}", targetSeries.SeriesName, episode.EpisodeNumber); - var newEpisode = new Episode() - { - AirDate = episode.FirstAired, - EpisodeId = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - Language = episode.Language.Abbriviation, - Overview = episode.Overview, - SeasonId = episode.SeasonId, - SeasonNumber = episode.SeasonNumber, - SeriesId = season.SeriesId, - Title = episode.EpisodeName - }; + Logger.Trace("Updating info for series:{0} - episode:{1}", targetSeries.SeriesName, + episode.EpisodeNumber); + var newEpisode = new Episode + { + AirDate = episode.FirstAired, + EpisodeId = episode.Id, + EpisodeNumber = episode.EpisodeNumber, + Language = episode.Language.Abbriviation, + Overview = episode.Overview, + SeasonId = episode.SeasonId, + SeasonNumber = episode.SeasonNumber, + SeriesId = season.SeriesId, + Title = episode.EpisodeName + }; if (_sonicRepo.Exists<Episode>(e => e.EpisodeId == newEpisode.EpisodeId)) { @@ -231,7 +235,9 @@ namespace NzbDrone.Core.Providers } catch (Exception e) { - Logger.FatalException(String.Format("An error has occurred while updating episode info for season {0} of series {1}", season.SeasonNumber, season.SeriesId), e); + Logger.FatalException( + String.Format("An error has occurred while updating episode info for season {0} of series {1}", + season.SeasonNumber, season.SeriesId), e); failCount++; } } @@ -239,7 +245,8 @@ namespace NzbDrone.Core.Providers _sonicRepo.AddMany(newList); _sonicRepo.UpdateMany(updateList); - Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount); + Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", + targetSeries.SeriesName, successCount, failCount); } public virtual void DeleteEpisode(int episodeId) @@ -251,6 +258,5 @@ namespace NzbDrone.Core.Providers { _sonicRepo.Update(episode); } - } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/ExternalNotificationProvider.cs b/NzbDrone.Core/Providers/ExternalNotificationProvider.cs index e0d762512..3468470b5 100644 --- a/NzbDrone.Core/Providers/ExternalNotificationProvider.cs +++ b/NzbDrone.Core/Providers/ExternalNotificationProvider.cs @@ -1,29 +1,23 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; -using NzbDrone.Core.Repository; namespace NzbDrone.Core.Providers { public class ExternalNotificationProvider { + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _configProvider; private readonly XbmcProvider _xbmcProvider; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public ExternalNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider) { _configProvider = configProvider; _xbmcProvider = xbmcProvider; } - #region ExternalNotificationProvider Members public virtual void OnGrab(string message) { var header = "NzbDrone [TV] - Grabbed"; @@ -100,6 +94,5 @@ namespace NzbDrone.Core.Providers throw new NotImplementedException(); } - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs index 3165e7de1..9d5be038a 100644 --- a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs +++ b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs @@ -4,24 +4,19 @@ using NzbDrone.Core.Model.Notification; namespace NzbDrone.Core.Providers.Fakes { - class FakeNotificationProvider + internal class FakeNotificationProvider { - private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>(); - private readonly Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>(); + private readonly Dictionary<Guid, BasicNotification> _basicNotifications = + new Dictionary<Guid, BasicNotification>(); + private readonly Object _lock = new object(); + private readonly Dictionary<Guid, ProgressNotification> _progressNotification = + new Dictionary<Guid, ProgressNotification>(); - ProgressNotification fakeNotification = new ProgressNotification("Updating Series"); - ProgressNotification fakeNotification2 = new ProgressNotification("Updating Series2"); - public void Register(ProgressNotification notification) - { - _progressNotification.Add(notification.Id, notification); - } - public void Register(BasicNotification notification) - { - _basicNotifications.Add(notification.Id, notification); - } + private readonly ProgressNotification fakeNotification = new ProgressNotification("Updating Series"); + private readonly ProgressNotification fakeNotification2 = new ProgressNotification("Updating Series2"); public List<BasicNotification> BasicNotifications { @@ -30,17 +25,26 @@ namespace NzbDrone.Core.Providers.Fakes public List<ProgressNotification> GetProgressNotifications { - get { fakeNotification.Status = ProgressNotificationStatus.InProgress; fakeNotification.Status = ProgressNotificationStatus.InProgress; fakeNotification2.CurrentStatus = DateTime.UtcNow.ToString(); fakeNotification.CurrentStatus = DateTime.Now.ToString(); - return new List<ProgressNotification> { fakeNotification }; + return new List<ProgressNotification> {fakeNotification}; } } + public void Register(ProgressNotification notification) + { + _progressNotification.Add(notification.Id, notification); + } + + public void Register(BasicNotification notification) + { + _basicNotifications.Add(notification.Id, notification); + } + public void Dismiss(Guid notificationId) { lock (_lock) diff --git a/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs b/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs index c1d05a820..665b4f0f2 100644 --- a/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs +++ b/NzbDrone.Core/Providers/Feed/FeedProviderBase.cs @@ -1,5 +1,4 @@ using System.ServiceModel.Syndication; -using System.Xml; using NLog; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; @@ -8,15 +7,16 @@ namespace NzbDrone.Core.Providers.Feed { public abstract class FeedProviderBase { - protected readonly SeriesProvider _seriesProvider; - protected readonly SeasonProvider _seasonProvider; - protected readonly EpisodeProvider _episodeProvider; + protected static readonly Logger Logger = LogManager.GetCurrentClassLogger(); protected readonly ConfigProvider _configProvider; + protected readonly EpisodeProvider _episodeProvider; private readonly HttpProvider _httpProvider; - protected static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + protected readonly SeasonProvider _seasonProvider; + protected readonly SeriesProvider _seriesProvider; public FeedProviderBase(SeriesProvider seriesProvider, SeasonProvider seasonProvider, - EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider) + EpisodeProvider episodeProvider, ConfigProvider configProvider, + HttpProvider httpProvider) { _seriesProvider = seriesProvider; _seasonProvider = seasonProvider; @@ -27,28 +27,28 @@ namespace NzbDrone.Core.Providers.Feed /// <summary> - /// Gets the source URL for the feed + /// Gets the source URL for the feed /// </summary> protected abstract string[] URL { get; } /// <summary> - /// Gets the name for this feed + /// Gets the name for this feed /// </summary> protected abstract string Name { get; } /// <summary> - /// Generates direct link to download an NZB + /// Generates direct link to download an NZB /// </summary> - /// <param name="item">RSS Feed item to generate the link for</param> + /// <param name = "item">RSS Feed item to generate the link for</param> /// <returns>Download link URL</returns> protected abstract string NzbDownloadUrl(SyndicationItem item); /// <summary> - /// Parses the RSS feed item and. + /// Parses the RSS feed item and. /// </summary> - /// <param name="item">RSS feed item to parse</param> + /// <param name = "item">RSS feed item to parse</param> /// <returns>Detailed episode info</returns> protected EpisodeParseResult ParseFeed(SyndicationItem item) { @@ -66,13 +66,11 @@ namespace NzbDrone.Core.Providers.Feed Logger.Debug("Unable to map {0} to any of series in database", episodeParseResult.SeriesTitle); return null; - } - /// <summary> - /// Fetches RSS feed and process each news item. + /// Fetches RSS feed and process each news item. /// </summary> public void Fetch() { @@ -122,5 +120,4 @@ namespace NzbDrone.Core.Providers.Feed } } } - -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs b/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs index a5440c67a..46ef3bef8 100644 --- a/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs +++ b/NzbDrone.Core/Providers/Feed/NzbsOrgFeedProvider.cs @@ -1,15 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.ServiceModel.Syndication; -using System.Text; +using System.ServiceModel.Syndication; using NzbDrone.Core.Providers.Core; namespace NzbDrone.Core.Providers.Feed { - class NzbsOrgFeedProvider : FeedProviderBase + internal class NzbsOrgFeedProvider : FeedProviderBase { - public NzbsOrgFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider) + public NzbsOrgFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, + EpisodeProvider episodeProvider, ConfigProvider configProvider, + HttpProvider httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) { } @@ -18,7 +16,11 @@ namespace NzbDrone.Core.Providers.Feed { get { - return new[] { string.Format("http://nzbs.org/rss.php?type=1&i={0}&h={1}", _configProvider.NzbsOrgUId, _configProvider.NzbsOrgHash) }; + return new[] + { + string.Format("http://nzbs.org/rss.php?type=1&i={0}&h={1}", _configProvider.NzbsOrgUId, + _configProvider.NzbsOrgHash) + }; } } @@ -32,4 +34,4 @@ namespace NzbDrone.Core.Providers.Feed return item.Id.Replace("action=view", "action=getnzb"); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/HistoryProvider.cs b/NzbDrone.Core/Providers/HistoryProvider.cs index a0b1edfb7..f3f32771f 100644 --- a/NzbDrone.Core/Providers/HistoryProvider.cs +++ b/NzbDrone.Core/Providers/HistoryProvider.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using NLog; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; @@ -11,9 +10,8 @@ namespace NzbDrone.Core.Providers { public class HistoryProvider { - private readonly IRepository _sonicRepo; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly IRepository _sonicRepo; public HistoryProvider(IRepository sonicRepo) { @@ -24,8 +22,6 @@ namespace NzbDrone.Core.Providers { } - #region HistoryProvider Members - public virtual List<History> AllItems() { return _sonicRepo.All<History>().ToList(); @@ -54,13 +50,11 @@ namespace NzbDrone.Core.Providers public virtual bool Exists(int episodeId, QualityTypes quality, bool proper) { //Looks for the existance of this episode in History - if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && (QualityTypes)h.Quality == quality && h.IsProper == proper)) + if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && h.Quality == quality && h.IsProper == proper)) return true; Logger.Debug("Episode not in History: {0}", episodeId); return false; } - - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/IndexerProvider.cs b/NzbDrone.Core/Providers/IndexerProvider.cs index 69e2efc7c..cd86f1b08 100644 --- a/NzbDrone.Core/Providers/IndexerProvider.cs +++ b/NzbDrone.Core/Providers/IndexerProvider.cs @@ -1,21 +1,17 @@ -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using NLog; -using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; -using SubSonic.Repository; using NzbDrone.Core.Repository; +using SubSonic.Repository; namespace NzbDrone.Core.Providers { public class IndexerProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private readonly IRepository _sonicRepo; private readonly ConfigProvider _configProvider; + private readonly IRepository _sonicRepo; public IndexerProvider(IRepository sonicRepo, ConfigProvider configProvider) { @@ -23,8 +19,6 @@ namespace NzbDrone.Core.Providers _configProvider = configProvider; } - #region IndexerProvider Members - public virtual List<Indexer> AllIndexers() { return _sonicRepo.All<Indexer>().OrderBy(i => i.Order).ToList(); @@ -44,7 +38,5 @@ namespace NzbDrone.Core.Providers { return _sonicRepo.Single<Indexer>(indexerId); } - - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index da093bd02..b265e35ca 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -2,10 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using System.Text.RegularExpressions; using NLog; -using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -14,31 +11,28 @@ namespace NzbDrone.Core.Providers { public class MediaFileProvider { - private readonly IRepository _repository; - private readonly ConfigProvider _configProvider; - private readonly DiskProvider _diskProvider; - private readonly EpisodeProvider _episodeProvider; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" }; + private readonly DiskProvider _diskProvider; + private readonly EpisodeProvider _episodeProvider; + private readonly IRepository _repository; - public MediaFileProvider(IRepository repository, ConfigProvider configProvider, DiskProvider diskProvider, EpisodeProvider episodeProvider) + public MediaFileProvider(IRepository repository, DiskProvider diskProvider, + EpisodeProvider episodeProvider) { _repository = repository; - _configProvider = configProvider; _diskProvider = diskProvider; _episodeProvider = episodeProvider; } public MediaFileProvider() { - } /// <summary> - /// Scans the specified series folder for media files + /// Scans the specified series folder for media files /// </summary> - /// <param name="series">The series to be scanned</param> + /// <param name = "series">The series to be scanned</param> public List<EpisodeFile> Scan(Series series) { var mediaFileList = GetMediaFileList(series.Path); @@ -54,9 +48,9 @@ namespace NzbDrone.Core.Providers } /// <summary> - /// Scans the specified series folder for media files + /// Scans the specified series folder for media files /// </summary> - /// <param name="series">The series to be scanned</param> + /// <param name = "series">The series to be scanned</param> public List<EpisodeFile> Scan(Series series, string path) { var mediaFileList = GetMediaFileList(path); @@ -84,7 +78,8 @@ namespace NzbDrone.Core.Providers foreach (var episodeNumber in episodesInFile.Episodes) { - var episode = _episodeProvider.GetEpisode(series.SeriesId, episodesInFile.SeasonNumber, episodeNumber); + var episode = _episodeProvider.GetEpisode(series.SeriesId, episodesInFile.SeasonNumber, + episodeNumber); if (episode != null) { @@ -92,7 +87,8 @@ namespace NzbDrone.Core.Providers } else - Logger.Warn("Unable to find Series:{0} Season:{1} Episode:{2} in the database. File:{3}", series.Title, episodesInFile.SeasonNumber, episodeNumber, filePath); + Logger.Warn("Unable to find Series:{0} Season:{1} Episode:{2} in the database. File:{3}", + series.Title, episodesInFile.SeasonNumber, episodeNumber, filePath); } //Return null if no Episodes exist in the DB for the parsed episodes from file @@ -125,7 +121,8 @@ namespace NzbDrone.Core.Providers _episodeProvider.UpdateEpisode(ep); episodeList += String.Format(", {0}", ep.EpisodeId).Trim(' ', ','); } - Logger.Trace("File {0}:{1} attached to episode(s): '{2}'", episodeFile.EpisodeFileId, filePath, episodeList); + Logger.Trace("File {0}:{1} attached to episode(s): '{2}'", episodeFile.EpisodeFileId, filePath, + episodeList); return episodeFile; } @@ -135,9 +132,9 @@ namespace NzbDrone.Core.Providers } /// <summary> - /// Removes files that no longer exist from the database + /// Removes files that no longer exist from the database /// </summary> - /// <param name="files">list of files to verify</param> + /// <param name = "files">list of files to verify</param> public void CleanUp(List<EpisodeFile> files) { foreach (var episodeFile in files) @@ -192,4 +189,4 @@ namespace NzbDrone.Core.Providers return mediaFileList; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/NotificationProvider.cs b/NzbDrone.Core/Providers/NotificationProvider.cs index 72a23fb36..924856199 100644 --- a/NzbDrone.Core/Providers/NotificationProvider.cs +++ b/NzbDrone.Core/Providers/NotificationProvider.cs @@ -1,25 +1,19 @@ using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; using NzbDrone.Core.Model.Notification; namespace NzbDrone.Core.Providers { public class NotificationProvider { - private readonly Dictionary<Guid, BasicNotification> _basicNotifications = new Dictionary<Guid, BasicNotification>(); - private Dictionary<Guid, ProgressNotification> _progressNotification = new Dictionary<Guid, ProgressNotification>(); - private readonly Object _lock = new object(); + private readonly Dictionary<Guid, BasicNotification> _basicNotifications = + new Dictionary<Guid, BasicNotification>(); - public virtual void Register(ProgressNotification notification) - { - _progressNotification.Add(notification.Id, notification); - } + private readonly Object _lock = new object(); - public virtual void Register(BasicNotification notification) - { - _basicNotifications.Add(notification.Id, notification); - } + private readonly Dictionary<Guid, ProgressNotification> _progressNotification = + new Dictionary<Guid, ProgressNotification>(); public virtual List<BasicNotification> BasicNotifications { @@ -30,10 +24,22 @@ namespace NzbDrone.Core.Providers { get { - return new List<ProgressNotification>(_progressNotification.Values.Where(p => p.Status == ProgressNotificationStatus.InProgress)); + return + new List<ProgressNotification>( + _progressNotification.Values.Where(p => p.Status == ProgressNotificationStatus.InProgress)); } } + public virtual void Register(ProgressNotification notification) + { + _progressNotification.Add(notification.Id, notification); + } + + public virtual void Register(BasicNotification notification) + { + _basicNotifications.Add(notification.Id, notification); + } + public virtual void Dismiss(Guid notificationId) { lock (_lock) diff --git a/NzbDrone.Core/Providers/PostProcessingProvider.cs b/NzbDrone.Core/Providers/PostProcessingProvider.cs index b4ed878d8..1ffe45f74 100644 --- a/NzbDrone.Core/Providers/PostProcessingProvider.cs +++ b/NzbDrone.Core/Providers/PostProcessingProvider.cs @@ -1,30 +1,19 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Xml.Linq; -using NzbDrone.Core.Helpers; -using NzbDrone.Core.Providers.Core; - -namespace NzbDrone.Core.Providers +namespace NzbDrone.Core.Providers { public class PostProcessingProvider { - private readonly SeriesProvider _seriesProvider; private readonly MediaFileProvider _mediaFileProvider; private readonly RenameProvider _renameProvider; + private readonly SeriesProvider _seriesProvider; public PostProcessingProvider(SeriesProvider seriesProvider, - MediaFileProvider mediaFileProvider, RenameProvider renameProvider) + MediaFileProvider mediaFileProvider, RenameProvider renameProvider) { _seriesProvider = seriesProvider; - _mediaFileProvider = mediaFileProvider; + _mediaFileProvider = mediaFileProvider; _renameProvider = renameProvider; } - #region PostProcessingProvider Members - public virtual void ProcessEpisode(string dir, string nzbName) { var parsedSeries = Parser.ParseSeriesName(nzbName); @@ -42,7 +31,5 @@ namespace NzbDrone.Core.Providers _renameProvider.RenameEpisodeFile(file.EpisodeFileId, true); } } - - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/QualityProvider.cs b/NzbDrone.Core/Providers/QualityProvider.cs index 99f716797..e7ced8ee8 100644 --- a/NzbDrone.Core/Providers/QualityProvider.cs +++ b/NzbDrone.Core/Providers/QualityProvider.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using System.Text; using NLog; using NzbDrone.Core.Repository.Quality; using SubSonic.Repository; @@ -11,12 +9,11 @@ namespace NzbDrone.Core.Providers { public class QualityProvider { - private IRepository _sonicRepo; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly IRepository _sonicRepo; public QualityProvider() { - } public QualityProvider(IRepository sonicRepo) @@ -24,8 +21,6 @@ namespace NzbDrone.Core.Providers _sonicRepo = sonicRepo; } - #region IQualityProvider Members - public virtual void Add(QualityProfile profile) { _sonicRepo.Add(profile); @@ -58,7 +53,5 @@ namespace NzbDrone.Core.Providers { return _sonicRepo.Single<QualityProfile>(q => q.QualityProfileId == profileId); } - - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/RenameProvider.cs b/NzbDrone.Core/Providers/RenameProvider.cs index af07a7de0..e139f1fbc 100644 --- a/NzbDrone.Core/Providers/RenameProvider.cs +++ b/NzbDrone.Core/Providers/RenameProvider.cs @@ -2,35 +2,32 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Threading; using NLog; using NzbDrone.Core.Helpers; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.Core; -using NzbDrone.Core.Repository; namespace NzbDrone.Core.Providers { public class RenameProvider { - private readonly SeriesProvider _seriesProvider; - private readonly SeasonProvider _seasonProvider; - private readonly EpisodeProvider _episodeProvider; - private readonly MediaFileProvider _mediaFileProvider; - private readonly DiskProvider _diskProvider; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _configProvider; + private readonly DiskProvider _diskProvider; + private readonly EpisodeProvider _episodeProvider; + private readonly List<EpisodeRenameModel> _epsToRename = new List<EpisodeRenameModel>(); private readonly ExternalNotificationProvider _externalNotificationProvider; + private readonly MediaFileProvider _mediaFileProvider; + private readonly SeasonProvider _seasonProvider; + private readonly SeriesProvider _seriesProvider; private Thread _renameThread; - private List<EpisodeRenameModel> _epsToRename = new List<EpisodeRenameModel>(); - - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); public RenameProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, - EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider, - DiskProvider diskProvider, ConfigProvider configProvider, - ExternalNotificationProvider extenalNotificationProvider) + EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider, + DiskProvider diskProvider, ConfigProvider configProvider, + ExternalNotificationProvider extenalNotificationProvider) { _seriesProvider = seriesProvider; _seasonProvider = seasonProvider; @@ -41,7 +38,6 @@ namespace NzbDrone.Core.Providers _externalNotificationProvider = extenalNotificationProvider; } - #region RenameProvider Members public virtual void RenameAll() { //Get a list of all episode files/episodes and rename them @@ -49,12 +45,14 @@ namespace NzbDrone.Core.Providers foreach (var episodeFile in _mediaFileProvider.GetEpisodeFiles()) { var series = _seriesProvider.GetSeries(episodeFile.SeriesId); - var erm = new EpisodeRenameModel(); - erm.SeriesName = series.Title; - erm.Folder = series.Path; + var erm = new EpisodeRenameModel {SeriesName = series.Title, Folder = series.Path}; if (series.SeasonFolder) - erm.Folder += Path.DirectorySeparatorChar + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true)); + erm.Folder += Path.DirectorySeparatorChar + + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, + _configProvider.GetValue( + "Sorting_SeasonFolderFormat", "Season %s", + true)); erm.EpisodeFile = episodeFile; _epsToRename.Add(erm); @@ -70,13 +68,14 @@ namespace NzbDrone.Core.Providers foreach (var episodeFile in _mediaFileProvider.GetEpisodeFiles().Where(s => s.SeriesId == seriesId)) { - var erm = new EpisodeRenameModel(); - erm.SeriesName = series.Title; - - erm.Folder = series.Path; + var erm = new EpisodeRenameModel {SeriesName = series.Title, Folder = series.Path}; if (series.SeasonFolder) - erm.Folder += Path.DirectorySeparatorChar + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true)); + erm.Folder += Path.DirectorySeparatorChar + + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, + _configProvider.GetValue( + "Sorting_SeasonFolderFormat", "Season %s", + true)); erm.EpisodeFile = episodeFile; _epsToRename.Add(erm); @@ -90,15 +89,17 @@ namespace NzbDrone.Core.Providers var season = _seasonProvider.GetSeason(seasonId); var series = _seriesProvider.GetSeries(season.SeriesId); - foreach (var episodeFile in _mediaFileProvider.GetEpisodeFiles().Where(s => s.Episodes[0].SeasonId == seasonId)) + foreach ( + var episodeFile in _mediaFileProvider.GetEpisodeFiles().Where(s => s.Episodes[0].SeasonId == seasonId)) { - var erm = new EpisodeRenameModel(); - erm.SeriesName = series.Title; - - erm.Folder = series.Path; + var erm = new EpisodeRenameModel {SeriesName = series.Title, Folder = series.Path}; if (series.SeasonFolder) - erm.Folder += Path.DirectorySeparatorChar + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true)); + erm.Folder += Path.DirectorySeparatorChar + + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, + _configProvider.GetValue( + "Sorting_SeasonFolderFormat", "Season %s", + true)); erm.EpisodeFile = episodeFile; _epsToRename.Add(erm); @@ -112,15 +113,16 @@ namespace NzbDrone.Core.Providers var episode = _episodeProvider.GetEpisode(episodeId); var series = _seriesProvider.GetSeries(episode.SeriesId); - var episodeFile = _mediaFileProvider.GetEpisodeFiles().Where(s => s.Episodes.Contains(episode)).FirstOrDefault(); + var episodeFile = + _mediaFileProvider.GetEpisodeFiles().Where(s => s.Episodes.Contains(episode)).FirstOrDefault(); - var erm = new EpisodeRenameModel(); - erm.SeriesName = series.Title; - - erm.Folder = series.Path; + var erm = new EpisodeRenameModel {SeriesName = series.Title, Folder = series.Path}; if (series.SeasonFolder) - erm.Folder += Path.DirectorySeparatorChar + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true)); + erm.Folder += Path.DirectorySeparatorChar + + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, + _configProvider.GetValue( + "Sorting_SeasonFolderFormat", "Season %s", true)); erm.EpisodeFile = episodeFile; _epsToRename.Add(erm); @@ -133,21 +135,19 @@ namespace NzbDrone.Core.Providers var episodeFile = _mediaFileProvider.GetEpisodeFile(episodeFileId); var series = _seriesProvider.GetSeries(episodeFile.Series.SeriesId); - var erm = new EpisodeRenameModel(); - erm.SeriesName = series.Title; - - erm.Folder = series.Path; + var erm = new EpisodeRenameModel {SeriesName = series.Title, Folder = series.Path}; if (series.SeasonFolder) - erm.Folder += Path.DirectorySeparatorChar + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true)); + erm.Folder += Path.DirectorySeparatorChar + + EpisodeRenameHelper.GetSeasonFolder(episodeFile.Episodes[0].SeasonNumber, + _configProvider.GetValue( + "Sorting_SeasonFolderFormat", "Season %s", true)); erm.EpisodeFile = episodeFile; _epsToRename.Add(erm); StartRename(); } - #endregion - private void StartRename() { Logger.Debug("Episode Rename Starting"); @@ -155,10 +155,10 @@ namespace NzbDrone.Core.Providers { Logger.Debug("Initializing background rename of episodes"); _renameThread = new Thread(RenameProcessor) - { - Name = "RenameEpisodes", - Priority = ThreadPriority.Lowest - }; + { + Name = "RenameEpisodes", + Priority = ThreadPriority.Lowest + }; _renameThread.Start(); } @@ -203,7 +203,6 @@ namespace NzbDrone.Core.Providers else _externalNotificationProvider.OnRename(erm); - } catch (Exception ex) { @@ -212,4 +211,4 @@ namespace NzbDrone.Core.Providers } } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/RootDirProvider.cs b/NzbDrone.Core/Providers/RootDirProvider.cs index a1557cb19..e8e351f0a 100644 --- a/NzbDrone.Core/Providers/RootDirProvider.cs +++ b/NzbDrone.Core/Providers/RootDirProvider.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -27,17 +25,17 @@ namespace NzbDrone.Core.Providers { _sonioRepo.Add(rootDir); } - + public virtual void Remove(int rootDirId) { _sonioRepo.Delete<RootDir>(rootDirId); } - + public virtual void Update(RootDir rootDir) { _sonioRepo.Update(rootDir); } - + public virtual RootDir GetRootDir(int rootDirId) { return _sonioRepo.Single<RootDir>(rootDirId); @@ -45,4 +43,4 @@ namespace NzbDrone.Core.Providers #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/RssSyncProvider.cs b/NzbDrone.Core/Providers/RssSyncProvider.cs index d8cd33398..3da8aa058 100644 --- a/NzbDrone.Core/Providers/RssSyncProvider.cs +++ b/NzbDrone.Core/Providers/RssSyncProvider.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Providers +namespace NzbDrone.Core.Providers { public class RssSyncProvider { public virtual void Begin() { - } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/SabProvider.cs b/NzbDrone.Core/Providers/SabProvider.cs index 3f5078df9..ca667a280 100644 --- a/NzbDrone.Core/Providers/SabProvider.cs +++ b/NzbDrone.Core/Providers/SabProvider.cs @@ -9,19 +9,16 @@ namespace NzbDrone.Core.Providers { public class SabProvider { + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _config; private readonly HttpProvider _http; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public SabProvider(ConfigProvider config, HttpProvider http) { _config = config; _http = http; } - #region IDownloadProvider Members - public virtual bool AddByUrl(string url, string title) { const string mode = "addurl"; @@ -31,7 +28,8 @@ namespace NzbDrone.Core.Providers string name = url.Replace("&", "%26"); string nzbName = HttpUtility.UrlEncode(title); - string action = string.Format("mode={0}&name={1}&priority={2}&cat={3}&nzbname={4}", mode, name, priority, cat, nzbName); + string action = string.Format("mode={0}&name={1}&priority={2}&cat={3}&nzbname={4}", mode, name, priority, + cat, nzbName); string request = GetSabRequest(action); Logger.Debug("Adding report [{0}] to the queue.", nzbName); @@ -61,7 +59,10 @@ namespace NzbDrone.Core.Providers return false; //Get the Count of Items in Queue where 'filename' is Equal to goodName, if not zero, return true (isInQueue))) - if ((xDoc.Descendants("slot").Where(s => s.Element("filename").Value.Equals(title, StringComparison.InvariantCultureIgnoreCase))).Count() != 0) + if ( + (xDoc.Descendants("slot").Where( + s => s.Element("filename").Value.Equals(title, StringComparison.InvariantCultureIgnoreCase))).Count() != + 0) { Logger.Debug("Episode in queue - '{0}'", title); @@ -81,7 +82,8 @@ namespace NzbDrone.Core.Providers string priority = _config.GetValue("SabTvPriority", String.Empty, false); string nzbName = HttpUtility.UrlEncode(title); - string action = string.Format("mode={0}&name={1}&priority={2}&cat={3}&nzbname={4}", mode, id, priority, cat, nzbName); + string action = string.Format("mode={0}&name={1}&priority={2}&cat={3}&nzbname={4}", mode, id, priority, cat, + nzbName); string request = GetSabRequest(action); Logger.Debug("Adding report [{0}] to the queue.", nzbName); @@ -95,16 +97,17 @@ namespace NzbDrone.Core.Providers return false; } - #endregion - private string GetSabRequest(string action) { - string sabnzbdInfo = _config.GetValue("SabHost", String.Empty, false) + ":" + _config.GetValue("SabPort", String.Empty, false); + string sabnzbdInfo = _config.GetValue("SabHost", String.Empty, false) + ":" + + _config.GetValue("SabPort", String.Empty, false); string username = _config.GetValue("SabUsername", String.Empty, false); string password = _config.GetValue("SabPassword", String.Empty, false); string apiKey = _config.GetValue("SabApiKey", String.Empty, false); - return string.Format(@"http://{0}/api?$Action&apikey={1}&ma_username={2}&ma_password={3}", sabnzbdInfo, apiKey, username, password).Replace("$Action", action); + return + string.Format(@"http://{0}/api?$Action&apikey={1}&ma_username={2}&ma_password={3}", sabnzbdInfo, apiKey, + username, password).Replace("$Action", action); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/SeasonProvider.cs b/NzbDrone.Core/Providers/SeasonProvider.cs index 6b3e9f94b..a2a82bf28 100644 --- a/NzbDrone.Core/Providers/SeasonProvider.cs +++ b/NzbDrone.Core/Providers/SeasonProvider.cs @@ -1,29 +1,24 @@ using System; using System.Collections.Generic; +using System.Linq; using NLog; -using NzbDrone.Core.Model; using NzbDrone.Core.Repository; using SubSonic.Repository; -using System.Linq; namespace NzbDrone.Core.Providers { public class SeasonProvider { - private readonly IRepository _sonicRepo; - private readonly SeriesProvider _seriesProvider; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly IRepository _sonicRepo; - public SeasonProvider(IRepository dataRepository, SeriesProvider seriesProvider) + public SeasonProvider(IRepository dataRepository) { _sonicRepo = dataRepository; - _seriesProvider = seriesProvider; } public SeasonProvider() { - } public virtual Season GetSeason(int seasonId) @@ -51,16 +46,17 @@ namespace NzbDrone.Core.Providers if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId)) return; //TODO: Calculate Season Folder - Logger.Trace("Adding Season To DB. [SeriesID:{0} SeasonID:{1} SeasonNumber:{2}]", seriesId, seasonId, seasonNumber, "????"); - - var newSeason = new Season() - { - Monitored = true, - SeasonId = seasonId, - SeasonNumber = seasonNumber, - SeriesId = seriesId - }; - _sonicRepo.Add<Season>(newSeason); + Logger.Trace("Adding Season To DB. [SeriesID:{0} SeasonID:{1} SeasonNumber:{2}]", seriesId, seasonId, + seasonNumber, "????"); + + var newSeason = new Season + { + Monitored = true, + SeasonId = seasonId, + SeasonNumber = seasonNumber, + SeriesId = seriesId + }; + _sonicRepo.Add(newSeason); } public virtual int SaveSeason(Season season) diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 75b44ddd5..4be836443 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text.RegularExpressions; -using Ninject; using NLog; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; @@ -19,14 +16,14 @@ namespace NzbDrone.Core.Providers //Trims all white spaces and separators from the end of the title. + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _config; + private readonly QualityProvider _quality; private readonly IRepository _sonioRepo; private readonly TvDbProvider _tvDb; - private readonly QualityProvider _quality; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); public SeriesProvider(ConfigProvider configProvider, - IRepository dataRepository, TvDbProvider tvDbProvider, QualityProvider quality) + IRepository dataRepository, TvDbProvider tvDbProvider, QualityProvider quality) { _config = configProvider; _sonioRepo = dataRepository; @@ -38,8 +35,6 @@ namespace NzbDrone.Core.Providers { } - #region SeriesProvider Members - public virtual IQueryable<Series> GetAllSeries() { return _sonioRepo.All<Series>(); @@ -51,9 +46,9 @@ namespace NzbDrone.Core.Providers } /// <summary> - /// Determines if a series is being actively watched. + /// Determines if a series is being actively watched. /// </summary> - /// <param name="id">The TVDB ID of the series</param> + /// <param name = "id">The TVDB ID of the series</param> /// <returns>Whether or not the show is monitored</returns> public virtual bool IsMonitored(long id) { @@ -149,7 +144,6 @@ namespace NzbDrone.Core.Providers _sonioRepo.Delete<Series>(seriesId); Logger.Info("Successfully deleted Series [{0}]", seriesId); - } catch (Exception e) { @@ -165,8 +159,5 @@ namespace NzbDrone.Core.Providers return false; } - - #endregion - } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/SyncProvider.cs b/NzbDrone.Core/Providers/SyncProvider.cs index 480ea7b22..d7ef9c225 100644 --- a/NzbDrone.Core/Providers/SyncProvider.cs +++ b/NzbDrone.Core/Providers/SyncProvider.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Threading; using NLog; -using NzbDrone.Core.Model; using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Core; @@ -13,20 +11,19 @@ namespace NzbDrone.Core.Providers { public class SyncProvider { - private readonly SeriesProvider _seriesProvider; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly DiskProvider _diskProvider; private readonly EpisodeProvider _episodeProvider; private readonly MediaFileProvider _mediaFileProvider; private readonly NotificationProvider _notificationProvider; - private readonly DiskProvider _diskProvider; + private readonly SeriesProvider _seriesProvider; private ProgressNotification _seriesSyncNotification; private Thread _seriesSyncThread; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public SyncProvider(SeriesProvider seriesProvider, EpisodeProvider episodeProvider, - MediaFileProvider mediaFileProvider, NotificationProvider notificationProvider, - DiskProvider diskProvider) + MediaFileProvider mediaFileProvider, NotificationProvider notificationProvider, + DiskProvider diskProvider) { _seriesProvider = seriesProvider; _episodeProvider = episodeProvider; @@ -35,8 +32,6 @@ namespace NzbDrone.Core.Providers _diskProvider = diskProvider; } - #region ISyncProvider Members - public List<String> GetUnmappedFolders(string path) { Logger.Debug("Generating list of unmapped folders"); @@ -64,8 +59,6 @@ namespace NzbDrone.Core.Providers return results; } - #endregion - public bool BeginUpdateNewSeries() { Logger.Debug("User has requested a scan of new series"); @@ -73,10 +66,10 @@ namespace NzbDrone.Core.Providers { Logger.Debug("Initializing background scan thread"); _seriesSyncThread = new Thread(SyncNewSeries) - { - Name = "SyncNewSeries", - Priority = ThreadPriority.Lowest - }; + { + Name = "SyncNewSeries", + Priority = ThreadPriority.Lowest + }; _seriesSyncThread.Start(); } @@ -120,8 +113,6 @@ namespace NzbDrone.Core.Providers private void ScanSeries() { - - var syncList = _seriesProvider.GetAllSeries().Where(s => s.LastInfoSync == null).ToList(); if (syncList.Count == 0) return; @@ -131,13 +122,16 @@ namespace NzbDrone.Core.Providers { try { - _seriesSyncNotification.CurrentStatus = String.Format("Searching For: {0}", new DirectoryInfo(currentSeries.Path).Name); + _seriesSyncNotification.CurrentStatus = String.Format("Searching For: {0}", + new DirectoryInfo(currentSeries.Path).Name); var updatedSeries = _seriesProvider.UpdateSeriesInfo(currentSeries.SeriesId); - _seriesSyncNotification.CurrentStatus = String.Format("Downloading episode info For: {0}", updatedSeries.Title); + _seriesSyncNotification.CurrentStatus = String.Format("Downloading episode info For: {0}", + updatedSeries.Title); _episodeProvider.RefreshEpisodeInfo(updatedSeries.SeriesId); - _seriesSyncNotification.CurrentStatus = String.Format("Scanning series folder {0}", updatedSeries.Path); + _seriesSyncNotification.CurrentStatus = String.Format("Scanning series folder {0}", + updatedSeries.Path); _mediaFileProvider.Scan(_seriesProvider.GetSeries(updatedSeries.SeriesId)); //Todo: Launch Backlog search for this series _backlogProvider.StartSearch(mappedSeries.Id); @@ -154,4 +148,4 @@ namespace NzbDrone.Core.Providers ScanSeries(); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/TimerProvider.cs b/NzbDrone.Core/Providers/TimerProvider.cs index 928e9abf3..a976ec663 100644 --- a/NzbDrone.Core/Providers/TimerProvider.cs +++ b/NzbDrone.Core/Providers/TimerProvider.cs @@ -1,27 +1,25 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Timers; using NLog; -using NzbDrone.Core.Model.Notification; namespace NzbDrone.Core.Providers { public class TimerProvider { - private readonly RssSyncProvider _rssSyncProvider; - private readonly SeriesProvider _seriesProvider; - private readonly SeasonProvider _seasonProvider; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly EpisodeProvider _episodeProvider; private readonly MediaFileProvider _mediaFileProvider; - private Timer _rssSyncTimer; - private Timer _minuteTimer; + private readonly Timer _minuteTimer; + private readonly RssSyncProvider _rssSyncProvider; + private readonly Timer _rssSyncTimer; + private readonly SeasonProvider _seasonProvider; + private readonly SeriesProvider _seriesProvider; private DateTime _rssSyncNextInterval; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider) + public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, + SeasonProvider seasonProvider, EpisodeProvider episodeProvider, + MediaFileProvider mediaFileProvider) { _rssSyncProvider = rssSyncProvider; _seriesProvider = seriesProvider; @@ -33,8 +31,6 @@ namespace NzbDrone.Core.Providers _minuteTimer = new Timer(60000); } - #region TimerProvider Members - public virtual void ResetRssSyncTimer() { double interval = _rssSyncTimer.Interval; @@ -43,13 +39,14 @@ namespace NzbDrone.Core.Providers public virtual void StartRssSyncTimer() { - if (_rssSyncTimer.Interval < 900000) //If Timer is less than 15 minutes, throw an error! This should also be handled when saving the config, though a user could by-pass it by editing the DB directly... TNO (Trust No One) + if (_rssSyncTimer.Interval < 900000) + //If Timer is less than 15 minutes, throw an error! This should also be handled when saving the config, though a user could by-pass it by editing the DB directly... TNO (Trust No One) { Logger.Error("RSS Sync Frequency is invalid, please set the interval first"); throw new InvalidOperationException("RSS Sync Frequency Invalid"); } - _rssSyncTimer.Elapsed += new ElapsedEventHandler(RunRssSync); + _rssSyncTimer.Elapsed += RunRssSync; _rssSyncTimer.Start(); _rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval); } @@ -61,7 +58,7 @@ namespace NzbDrone.Core.Providers public virtual void SetRssSyncTimer(int minutes) { - long ms = minutes * 60 * 1000; + long ms = minutes*60*1000; _rssSyncTimer.Interval = ms; } @@ -77,7 +74,7 @@ namespace NzbDrone.Core.Providers public virtual void StartMinuteTimer() { - _minuteTimer.Elapsed += new ElapsedEventHandler(MinuteTimer_Elapsed); + _minuteTimer.Elapsed += MinuteTimer_Elapsed; _minuteTimer.Start(); } @@ -86,8 +83,6 @@ namespace NzbDrone.Core.Providers _minuteTimer.Stop(); } - #endregion - private void RunRssSync(object obj, ElapsedEventArgs args) { _rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval); @@ -132,4 +127,4 @@ namespace NzbDrone.Core.Providers throw new NotImplementedException(); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/TvDbProvider.cs b/NzbDrone.Core/Providers/TvDbProvider.cs index 256c63319..654e68238 100644 --- a/NzbDrone.Core/Providers/TvDbProvider.cs +++ b/NzbDrone.Core/Providers/TvDbProvider.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Text.RegularExpressions; using NLog; using TvdbLib; @@ -11,10 +10,12 @@ namespace NzbDrone.Core.Providers { public class TvDbProvider { + private const string TVDB_APIKEY = "5D2D188E86E07F4F"; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private static readonly Regex CleanUpRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private const string TVDB_APIKEY = "5D2D188E86E07F4F"; + private static readonly Regex CleanUpRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", + RegexOptions.IgnoreCase | RegexOptions.Compiled); + private readonly TvdbHandler _handler; public TvDbProvider() @@ -22,8 +23,6 @@ namespace NzbDrone.Core.Providers _handler = new TvdbHandler(new XmlCacheProvider(CentralDispatch.AppPath + @"\cache\tvdb"), TVDB_APIKEY); } - #region TvDbProvider Members - public virtual IList<TvdbSearchResult> SearchSeries(string title) { Logger.Debug("Searching TVDB for '{0}'", title); @@ -76,17 +75,15 @@ namespace NzbDrone.Core.Providers } /// <summary> - /// Determines whether a title in a search result is equal to the title searched for. + /// Determines whether a title in a search result is equal to the title searched for. /// </summary> - /// <param name="directoryName">Name of the directory.</param> - /// <param name="tvdbTitle">The TVDB title.</param> + /// <param name = "directoryName">Name of the directory.</param> + /// <param name = "tvdbTitle">The TVDB title.</param> /// <returns> - /// <c>true</c> if the titles are found to be same; otherwise, <c>false</c>. + /// <c>true</c> if the titles are found to be same; otherwise, <c>false</c>. /// </returns> public static bool IsTitleMatch(string directoryName, string tvdbTitle) { - - var result = false; if (String.IsNullOrEmpty(directoryName)) @@ -98,14 +95,13 @@ namespace NzbDrone.Core.Providers { result = true; } - else if (String.Equals(CleanUpRegex.Replace(directoryName, ""), CleanUpRegex.Replace(tvdbTitle, ""), StringComparison.InvariantCultureIgnoreCase)) + else if (String.Equals(CleanUpRegex.Replace(directoryName, ""), CleanUpRegex.Replace(tvdbTitle, ""), + StringComparison.InvariantCultureIgnoreCase)) result = true; Logger.Debug("Match between '{0}' and '{1}' was {2}", tvdbTitle, directoryName, result); return result; } - - #endregion } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs index de24334a2..8707c94c6 100644 --- a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs +++ b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using NzbDrone.Core.Model; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -10,18 +9,18 @@ namespace NzbDrone.Core.Providers { public class UpcomingEpisodesProvider { - private IRepository _sonicRepo; + private readonly IRepository _sonicRepo; public UpcomingEpisodesProvider(IRepository sonicRepo) { _sonicRepo = sonicRepo; } - #region UpcomingEpisodesProvider Members - public virtual UpcomingEpisodesModel Upcoming() { - var allEps = _sonicRepo.All<Episode>().Where(e => e.AirDate >= DateTime.Today.AddDays(-1) && e.AirDate < DateTime.Today.AddDays(8)); + var allEps = + _sonicRepo.All<Episode>().Where( + e => e.AirDate >= DateTime.Today.AddDays(-1) && e.AirDate < DateTime.Today.AddDays(8)); var yesterday = allEps.Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList(); var today = allEps.Where(e => e.AirDate == DateTime.Today).ToList(); @@ -42,9 +41,9 @@ namespace NzbDrone.Core.Providers public virtual List<Episode> Week() { - return _sonicRepo.All<Episode>().Where(e => e.AirDate > DateTime.Today && e.AirDate < DateTime.Today.AddDays(8)).ToList(); + return + _sonicRepo.All<Episode>().Where(e => e.AirDate > DateTime.Today && e.AirDate < DateTime.Today.AddDays(8)) + .ToList(); } - - #endregion } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/XbmcProvider.cs b/NzbDrone.Core/Providers/XbmcProvider.cs index 851d1dd7c..4d61f03a1 100644 --- a/NzbDrone.Core/Providers/XbmcProvider.cs +++ b/NzbDrone.Core/Providers/XbmcProvider.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Xml.Linq; using NLog; using NzbDrone.Core.Helpers; @@ -12,23 +10,20 @@ namespace NzbDrone.Core.Providers { public class XbmcProvider { + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly ConfigProvider _configProvider; private readonly HttpProvider _httpProvider; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - public XbmcProvider(ConfigProvider configProvider, HttpProvider httpProvider) { _configProvider = configProvider; _httpProvider = httpProvider; } - #region XbmcProvider Members - public virtual void Notify(string header, string message) { //Get time in seconds and convert to ms - var time = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", "3", true)) * 1000; + var time = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", "3", true))*1000; var command = String.Format("ExecBuiltIn(Notification({0},{1},{2}))", header, message, time); if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotificationImage", false, true))) @@ -55,7 +50,8 @@ namespace NzbDrone.Core.Providers var xbmcSeriesPath = GetXbmcSeriesPath(host, seriesId); //If the path is not found & the user wants to update the entire library, do it now. - if (String.IsNullOrEmpty(xbmcSeriesPath) && Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true))) + if (String.IsNullOrEmpty(xbmcSeriesPath) && + Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true))) { //Update the entire library Logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", seriesId, host); @@ -78,8 +74,6 @@ namespace NzbDrone.Core.Providers } } - #endregion - private string SendCommand(string host, string command) { var username = _configProvider.GetValue("XbmcUsername", String.Empty, true); @@ -90,16 +84,20 @@ namespace NzbDrone.Core.Providers { return _httpProvider.DownloadString(url, username, password); } - + return _httpProvider.DownloadString(url); } private string GetXbmcSeriesPath(string host, int seriesId) { - var query = String.Format("select path.strPath from path, tvshow, tvshowlinkpath where tvshow.c12 = {0} and tvshowlinkpath.idShow = tvshow.idShow and tvshowlinkpath.idPath = path.idPath", seriesId); + var query = + String.Format( + "select path.strPath from path, tvshow, tvshowlinkpath where tvshow.c12 = {0} and tvshowlinkpath.idShow = tvshow.idShow and tvshowlinkpath.idPath = path.idPath", + seriesId); var command = String.Format("QueryVideoDatabase({0})", query); - var setResponseCommand = "SetResponseFormat(webheader;false;webfooter;false;header;<xml>;footer;</xml>;opentag;<tag>;closetag;</tag>;closefinaltag;false)"; + var setResponseCommand = + "SetResponseFormat(webheader;false;webfooter;false;header;<xml>;footer;</xml>;opentag;<tag>;closetag;</tag>;closefinaltag;false)"; var resetResponseCommand = "SetResponseFormat()"; SendCommand(host, setResponseCommand); @@ -123,4 +121,4 @@ namespace NzbDrone.Core.Providers return field.Value; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Episode.cs b/NzbDrone.Core/Repository/Episode.cs index f7197bc02..517cf5f02 100644 --- a/NzbDrone.Core/Repository/Episode.cs +++ b/NzbDrone.Core/Repository/Episode.cs @@ -9,6 +9,7 @@ namespace NzbDrone.Core.Repository { [SubSonicPrimaryKey(false)] public virtual int EpisodeId { get; set; } + public virtual int SeriesId { get; set; } public virtual int EpisodeFileId { get; set; } public virtual int SeasonId { get; set; } @@ -16,8 +17,10 @@ namespace NzbDrone.Core.Repository public int EpisodeNumber { get; set; } public string Title { get; set; } public DateTime AirDate { get; set; } + [SubSonicLongString] public string Overview { get; set; } + public string Language { get; set; } public EpisodeStatusType Status { get; set; } @@ -37,4 +40,4 @@ namespace NzbDrone.Core.Repository [SubSonicToManyRelation] public virtual List<History> Histories { get; private set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/EpisodeFile.cs b/NzbDrone.Core/Repository/EpisodeFile.cs index e3f96fda2..336b19c7f 100644 --- a/NzbDrone.Core/Repository/EpisodeFile.cs +++ b/NzbDrone.Core/Repository/EpisodeFile.cs @@ -9,6 +9,7 @@ namespace NzbDrone.Core.Repository { [SubSonicPrimaryKey] public virtual int EpisodeFileId { get; set; } + public virtual int SeriesId { get; set; } public string Path { get; set; } public QualityTypes Quality { get; set; } @@ -22,4 +23,4 @@ namespace NzbDrone.Core.Repository [SubSonicToOneRelation(ThisClassContainsJoinKey = true)] public virtual Series Series { get; private set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/History.cs b/NzbDrone.Core/Repository/History.cs index 6faec0e7c..dafbee7f8 100644 --- a/NzbDrone.Core/Repository/History.cs +++ b/NzbDrone.Core/Repository/History.cs @@ -8,6 +8,7 @@ namespace NzbDrone.Core.Repository { [SubSonicPrimaryKey] public virtual int HistoryId { get; set; } + public virtual int EpisodeId { get; set; } public virtual int IndexerId { get; set; } public string NzbTitle { get; set; } @@ -21,4 +22,4 @@ namespace NzbDrone.Core.Repository [SubSonicToOneRelation(ThisClassContainsJoinKey = true)] public virtual Indexer Indexer { get; private set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Indexer.cs b/NzbDrone.Core/Repository/Indexer.cs index cc04180e4..b788bb07f 100644 --- a/NzbDrone.Core/Repository/Indexer.cs +++ b/NzbDrone.Core/Repository/Indexer.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; using SubSonic.SqlGeneration.Schema; namespace NzbDrone.Core.Repository @@ -19,10 +15,11 @@ namespace NzbDrone.Core.Repository [SubSonicNullStringAttribute] [DisplayFormat(ConvertEmptyStringToNull = false)] public string ApiUrl { get; set; } + public bool Enabled { get; set; } public int Order { get; set; } [SubSonicToManyRelation] public virtual List<History> Histories { get; private set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Quality/QualityProfile.cs b/NzbDrone.Core/Repository/Quality/QualityProfile.cs index b34d62fef..3afb914f3 100644 --- a/NzbDrone.Core/Repository/Quality/QualityProfile.cs +++ b/NzbDrone.Core/Repository/Quality/QualityProfile.cs @@ -15,6 +15,7 @@ namespace NzbDrone.Core.Repository.Quality [DisplayName("Name")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string Name { get; set; } + public bool UserProfile { get; set; } //Allows us to tell the difference between default and user profiles [SubSonicIgnore] @@ -37,10 +38,10 @@ namespace NzbDrone.Core.Repository.Quality { string result = String.Empty; if (Allowed == null) return result; - + foreach (var q in Allowed) { - result += (int)q + "|"; + result += (int) q + "|"; } return result.Trim('|'); } @@ -50,7 +51,7 @@ namespace NzbDrone.Core.Repository.Quality Allowed = new List<QualityTypes>(qualities.Length); foreach (var quality in qualities) { - Allowed.Add((QualityTypes)Convert.ToInt32(quality)); + Allowed.Add((QualityTypes) Convert.ToInt32(quality)); } } } @@ -58,4 +59,4 @@ namespace NzbDrone.Core.Repository.Quality [SubSonicToManyRelation] public virtual List<string> Series { get; private set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/RootDir.cs b/NzbDrone.Core/Repository/RootDir.cs index e6503492c..f06bb2b44 100644 --- a/NzbDrone.Core/Repository/RootDir.cs +++ b/NzbDrone.Core/Repository/RootDir.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using SubSonic.SqlGeneration.Schema; +using SubSonic.SqlGeneration.Schema; namespace NzbDrone.Core.Repository { @@ -13,4 +9,4 @@ namespace NzbDrone.Core.Repository public string Path { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Season.cs b/NzbDrone.Core/Repository/Season.cs index d8fadd580..ee1d3def0 100644 --- a/NzbDrone.Core/Repository/Season.cs +++ b/NzbDrone.Core/Repository/Season.cs @@ -8,10 +8,11 @@ namespace NzbDrone.Core.Repository { [SubSonicPrimaryKey(false)] public virtual int SeasonId { get; set; } + public virtual int SeriesId { get; set; } public virtual int SeasonNumber { get; set; } public bool Monitored { get; set; } - + public DayOfWeek? LastInfoSync { get; set; } public DayOfWeek? LastDiskSync { get; set; } diff --git a/NzbDrone.PostProcessor/Program.cs b/NzbDrone.PostProcessor/Program.cs index e425832c8..90428187d 100644 --- a/NzbDrone.PostProcessor/Program.cs +++ b/NzbDrone.PostProcessor/Program.cs @@ -1,21 +1,18 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Text; -using System.Xml; using System.Xml.Linq; namespace NzbDrone.PostProcessor { - class Program + internal class Program { private static string _host = "localhost"; private static int _port = 8989; private static string _apiKey = String.Empty; - static void Main(string[] args) + private static void Main(string[] args) { try { @@ -35,7 +32,8 @@ namespace NzbDrone.PostProcessor var hostString = _host + ":" + _port; - var url = String.Format("http://{0}/?apiKey={1}&dir={2}&nzbName={3}&category={4}", hostString, _apiKey, dir, nzbName, category); + var url = String.Format("http://{0}/?apiKey={1}&dir={2}&nzbName={3}&category={4}", hostString, _apiKey, + dir, nzbName, category); var webClient = new WebClient(); webClient.DownloadString(url); @@ -46,7 +44,7 @@ namespace NzbDrone.PostProcessor } } - static bool LoadConfig() + private static bool LoadConfig() { var configFile = "PostProcessor.xml"; if (!File.Exists(configFile)) @@ -65,8 +63,10 @@ namespace NzbDrone.PostProcessor } var hostNode = config.Descendants("Host").FirstOrDefault(); - var portNode = config.Descendants("Port").FirstOrDefault(); ; - var apiKeyNode = config.Descendants("ApiKey").FirstOrDefault(); ; + var portNode = config.Descendants("Port").FirstOrDefault(); + ; + var apiKeyNode = config.Descendants("ApiKey").FirstOrDefault(); + ; if (hostNode == null || portNode == null || apiKeyNode == null) { @@ -81,4 +81,4 @@ namespace NzbDrone.PostProcessor return true; } } -} +} \ No newline at end of file diff --git a/NzbDrone.PostProcessor/Properties/AssemblyInfo.cs b/NzbDrone.PostProcessor/Properties/AssemblyInfo.cs index d9889c15e..3b75749fa 100644 --- a/NzbDrone.PostProcessor/Properties/AssemblyInfo.cs +++ b/NzbDrone.PostProcessor/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. + [assembly: AssemblyTitle("NzbDrone.PostProcessor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. + [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM + [assembly: Guid("6521fcb0-15dc-4324-b08a-f18f87d78859")] // Version information for an assembly consists of the following four values: @@ -32,5 +34,6 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] + [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 8cfe4dbf3..ac2ba8bbc 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Web; using System.Web.Mvc; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; @@ -12,16 +10,17 @@ namespace NzbDrone.Web.Controllers { public class AddSeriesController : Controller { - - private readonly SyncProvider _syncProvider; - private readonly RootDirProvider _rootFolderProvider; private readonly ConfigProvider _configProvider; private readonly QualityProvider _qualityProvider; - private readonly TvDbProvider _tvDbProvider; + private readonly RootDirProvider _rootFolderProvider; private readonly SeriesProvider _seriesProvider; + private readonly SyncProvider _syncProvider; + private readonly TvDbProvider _tvDbProvider; - public AddSeriesController(SyncProvider syncProvider, RootDirProvider rootFolderProvider, ConfigProvider configProvider, - QualityProvider qualityProvider, TvDbProvider tvDbProvider, SeriesProvider seriesProvider) + public AddSeriesController(SyncProvider syncProvider, RootDirProvider rootFolderProvider, + ConfigProvider configProvider, + QualityProvider qualityProvider, TvDbProvider tvDbProvider, + SeriesProvider seriesProvider) { _syncProvider = syncProvider; _rootFolderProvider = rootFolderProvider; @@ -48,12 +47,12 @@ namespace NzbDrone.Web.Controllers var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile); var model = new AddNewSeriesModel - { - DirectorySeparatorChar = Path.DirectorySeparatorChar.ToString(), - RootDirectories = _rootFolderProvider.GetAll(), - QualityProfileId = defaultQuality, - QualitySelectList = selectList - }; + { + DirectorySeparatorChar = Path.DirectorySeparatorChar.ToString(), + RootDirectories = _rootFolderProvider.GetAll(), + QualityProfileId = defaultQuality, + QualitySelectList = selectList + }; return View(model); } @@ -78,7 +77,6 @@ namespace NzbDrone.Web.Controllers public ActionResult RenderPartial(string path) { - var suggestions = GetSuggestionList(new DirectoryInfo(path).Name); ViewData["guid"] = Guid.NewGuid(); @@ -92,10 +90,10 @@ namespace NzbDrone.Web.Controllers qualityProfiles, "QualityProfileId", "Name", - defaultQuality); ; + defaultQuality); + ; return PartialView("AddSeriesItem", suggestions); - } public JsonResult AddSeries(string path, int seriesId, int qualityProfileId) @@ -104,9 +102,11 @@ namespace NzbDrone.Web.Controllers //Create new folder for series //Add the new series to the Database - _seriesProvider.AddSeries(path.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar), seriesId, qualityProfileId); + _seriesProvider.AddSeries( + path.Replace('|', Path.DirectorySeparatorChar).Replace('^', Path.VolumeSeparatorChar), seriesId, + qualityProfileId); ScanNewSeries(); - return new JsonResult() { Data = "ok" }; + return new JsonResult {Data = "ok"}; } [HttpPost] @@ -115,10 +115,10 @@ namespace NzbDrone.Web.Controllers var suggestions = GetSuggestionList(text); return new JsonResult - { - JsonRequestBehavior = JsonRequestBehavior.AllowGet, - Data = suggestions - }; + { + JsonRequestBehavior = JsonRequestBehavior.AllowGet, + Data = suggestions + }; } public SelectList GetSuggestionList(string searchString) @@ -133,6 +133,5 @@ namespace NzbDrone.Web.Controllers return new SelectList(dataVal, "Id", "SeriesName", selectId); } - } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/ApiController.cs b/NzbDrone.Web/Controllers/ApiController.cs index 4346cb7bd..5baade17c 100644 --- a/NzbDrone.Web/Controllers/ApiController.cs +++ b/NzbDrone.Web/Controllers/ApiController.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Xml.Linq; +using System.Web.Mvc; using NLog; -using NzbDrone.Core; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; @@ -13,10 +7,9 @@ namespace NzbDrone.Web.Controllers { public class ApiController : Controller { - private readonly PostProcessingProvider _postProcessingProvider; - private readonly ConfigProvider _configProvider; - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly ConfigProvider _configProvider; + private readonly PostProcessingProvider _postProcessingProvider; public ApiController(PostProcessingProvider postProcessingProvider, ConfigProvider configProvider) { @@ -41,4 +34,4 @@ namespace NzbDrone.Web.Controllers return Content("Category doesn't match what was configured for SAB TV Category..."); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/HistoryController.cs b/NzbDrone.Web/Controllers/HistoryController.cs index 3465f000c..8b526ba49 100644 --- a/NzbDrone.Web/Controllers/HistoryController.cs +++ b/NzbDrone.Web/Controllers/HistoryController.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; +using System.Linq; using System.Web.Mvc; using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Web.Models; using Telerik.Web.Mvc; @@ -12,7 +8,7 @@ namespace NzbDrone.Web.Controllers { public class HistoryController : Controller { - private HistoryProvider _historyProvider; + private readonly HistoryProvider _historyProvider; public HistoryController(HistoryProvider historyProvider) { @@ -59,4 +55,4 @@ namespace NzbDrone.Web.Controllers return View(new GridModel(history)); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/LogController.cs b/NzbDrone.Web/Controllers/LogController.cs index 6a1421525..e17915924 100644 --- a/NzbDrone.Web/Controllers/LogController.cs +++ b/NzbDrone.Web/Controllers/LogController.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using NzbDrone.Core.Instrumentation; -using SubSonic.Repository; using Telerik.Web.Mvc; namespace NzbDrone.Web.Controllers @@ -28,7 +23,6 @@ namespace NzbDrone.Web.Controllers { _logProvider.DeleteAll(); return RedirectToAction("Index"); - } [GridAction] @@ -37,4 +31,4 @@ namespace NzbDrone.Web.Controllers return View(new GridModel(_logProvider.GetAllLogs())); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index 12118727f..4aef9c82e 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using NzbDrone.Core.Providers; namespace NzbDrone.Web.Controllers @@ -29,6 +25,5 @@ namespace NzbDrone.Web.Controllers return Json(message, JsonRequestBehavior.AllowGet); } - } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 34ee60cd7..b37badb47 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -1,43 +1,36 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using System.Linq; -using System.Threading; -using System.Web; using System.Web.Mvc; -using NzbDrone.Core.Model; using NzbDrone.Core.Providers; -using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Web.Models; using Telerik.Web.Mvc; using TvdbLib.Data; -using EpisodeModel = NzbDrone.Web.Models.EpisodeModel; namespace NzbDrone.Web.Controllers { [HandleError] public class SeriesController : Controller { - private readonly SeriesProvider _seriesProvider; private readonly EpisodeProvider _episodeProvider; - private readonly SyncProvider _syncProvider; - private readonly RssSyncProvider _rssSyncProvider; - private readonly QualityProvider _qualityProvider; private readonly MediaFileProvider _mediaFileProvider; + private readonly QualityProvider _qualityProvider; private readonly RenameProvider _renameProvider; private readonly RootDirProvider _rootDirProvider; + private readonly RssSyncProvider _rssSyncProvider; + private readonly SeriesProvider _seriesProvider; + private readonly SyncProvider _syncProvider; private readonly TvDbProvider _tvDbProvider; // // GET: /Series/ public SeriesController(SyncProvider syncProvider, SeriesProvider seriesProvider, - EpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider, - QualityProvider qualityProvider, MediaFileProvider mediaFileProvider, - RenameProvider renameProvider, RootDirProvider rootDirProvider, - TvDbProvider tvDbProvider) + EpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider, + QualityProvider qualityProvider, MediaFileProvider mediaFileProvider, + RenameProvider renameProvider, RootDirProvider rootDirProvider, + TvDbProvider tvDbProvider) { _seriesProvider = seriesProvider; _episodeProvider = episodeProvider; @@ -57,9 +50,6 @@ namespace NzbDrone.Web.Controllers } - - - public ActionResult RssSync() { _rssSyncProvider.Begin(); @@ -68,33 +58,41 @@ namespace NzbDrone.Web.Controllers public ActionResult UnMapped(string path) { - return View(_syncProvider.GetUnmappedFolders(path).Select(c => new MappingModel() { Id = 1, Path = c }).ToList()); + return View(_syncProvider.GetUnmappedFolders(path).Select(c => new MappingModel {Id = 1, Path = c}).ToList()); } public ActionResult LoadEpisodes(int seriesId) { _episodeProvider.RefreshEpisodeInfo(seriesId); return RedirectToAction("Details", new - { - seriesId = seriesId - }); + { + seriesId + }); } [GridAction] public ActionResult _AjaxSeasonGrid(int seasonId) { - var episodes = _episodeProvider.GetEpisodeBySeason(seasonId).Select(c => new EpisodeModel() - { - EpisodeId = c.EpisodeId, - EpisodeNumber = c.EpisodeNumber, - SeasonNumber = c.SeasonNumber, - Title = c.Title, - Overview = c.Overview, - AirDate = c.AirDate, - Path = GetEpisodePath(c.EpisodeFile), - Quality = c.EpisodeFile == null ? String.Empty : c.EpisodeFile.Quality.ToString() - - }); + var episodes = _episodeProvider.GetEpisodeBySeason(seasonId).Select(c => new EpisodeModel + { + EpisodeId = c.EpisodeId, + EpisodeNumber = + c.EpisodeNumber, + SeasonNumber = + c.SeasonNumber, + Title = c.Title, + Overview = c.Overview, + AirDate = c.AirDate, + Path = + GetEpisodePath( + c.EpisodeFile), + Quality = + c.EpisodeFile == null + ? String.Empty + : c.EpisodeFile. + Quality. + ToString() + }); return View(new GridModel(episodes)); } @@ -103,10 +101,10 @@ namespace NzbDrone.Web.Controllers { IEnumerable<Episode> data = GetData(command); return View(new GridModel - { - Data = data, - Total = data.Count() - }); + { + Data = data, + Total = data.Count() + }); } [GridAction] @@ -123,16 +121,16 @@ namespace NzbDrone.Web.Controllers //We still want to show this series as unmapped, but we don't know what it will be when mapped //Todo: Provide the user with a way to manually map a folder to a TvDb series (or make them rename the folder...) if (tvDbSeries == null) - tvDbSeries = new TvdbSeries { Id = 0, SeriesName = String.Empty }; + tvDbSeries = new TvdbSeries {Id = 0, SeriesName = String.Empty}; unmappedList.Add(new AddExistingSeriesModel - { - IsWanted = true, - Path = unmappedFolder, - PathEncoded = Url.Encode(unmappedFolder), - TvDbId = tvDbSeries.Id, - TvDbName = tvDbSeries.SeriesName - }); + { + IsWanted = true, + Path = unmappedFolder, + PathEncoded = Url.Encode(unmappedFolder), + TvDbId = tvDbSeries.Id, + TvDbName = tvDbSeries.SeriesName + }); } } @@ -163,7 +161,6 @@ namespace NzbDrone.Web.Controllers private IEnumerable<Episode> GetData(GridCommand command) { - return null; /* IQueryable<Episode> data = .Orders; @@ -266,7 +263,7 @@ namespace NzbDrone.Web.Controllers var series = _seriesProvider.GetSeries(seriesId); _mediaFileProvider.Scan(series); - return RedirectToAction("Details", new { seriesId }); + return RedirectToAction("Details", new {seriesId}); } public ActionResult RenameAll() @@ -278,7 +275,7 @@ namespace NzbDrone.Web.Controllers public ActionResult RenameSeries(int seriesId) { _renameProvider.RenameSeries(seriesId); - return RedirectToAction("Details", new { seriesId }); + return RedirectToAction("Details", new {seriesId}); } public ActionResult RenameSeason(int seasonId) @@ -305,4 +302,4 @@ namespace NzbDrone.Web.Controllers return file.Path.Replace(file.Series.Path, "").Trim(Path.DirectorySeparatorChar); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index ceed83c29..91423b3bc 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -1,11 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading; -using System.Web; using System.Web.Mvc; using NLog; -using NzbDrone.Core; using NzbDrone.Core.Helpers; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; @@ -19,17 +16,16 @@ namespace NzbDrone.Web.Controllers [HandleError] public class SettingsController : Controller { - private ConfigProvider _configProvider; - private IndexerProvider _indexerProvider; - private QualityProvider _qualityProvider; - private RootDirProvider _rootDirProvider; - - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private const string SETTINGS_SAVED = "Settings Saved."; private const string SETTINGS_FAILED = "Error Saving Settings, please fix any errors"; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private readonly ConfigProvider _configProvider; + private readonly IndexerProvider _indexerProvider; + private readonly QualityProvider _qualityProvider; + private readonly RootDirProvider _rootDirProvider; public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider, - QualityProvider qualityProvider, RootDirProvider rootDirProvider) + QualityProvider qualityProvider, RootDirProvider rootDirProvider) { _configProvider = configProvider; _indexerProvider = indexerProvider; @@ -63,8 +59,10 @@ namespace NzbDrone.Web.Controllers ViewData["viewName"] = "Indexers"; return View("Index", new IndexerSettingsModel { - NzbMatrixUsername = _configProvider.GetValue("NzbMatrixUsername", String.Empty, true), - NzbMatrixApiKey = _configProvider.GetValue("NzbMatrixApiKey", String.Empty, true), + NzbMatrixUsername = + _configProvider.GetValue("NzbMatrixUsername", String.Empty, true), + NzbMatrixApiKey = + _configProvider.GetValue("NzbMatrixApiKey", String.Empty, true), NzbsOrgUId = _configProvider.GetValue("NzbsOrgUId", String.Empty, true), NzbsOrgHash = _configProvider.GetValue("NzbsOrgHash", String.Empty, true), NzbsrusUId = _configProvider.GetValue("NzbsrusUId", String.Empty, true), @@ -80,7 +78,8 @@ namespace NzbDrone.Web.Controllers var model = new DownloadSettingsModel { SyncFrequency = Convert.ToInt32(_configProvider.GetValue("SyncFrequency", "15", true)), - DownloadPropers = Convert.ToBoolean(_configProvider.GetValue("DownloadPropers", "false", true)), + DownloadPropers = + Convert.ToBoolean(_configProvider.GetValue("DownloadPropers", "false", true)), Retention = Convert.ToInt32(_configProvider.GetValue("Retention", "500", true)), SabHost = _configProvider.GetValue("SabHost", "localhost", true), SabPort = Convert.ToInt32(_configProvider.GetValue("SabPort", "8080", true)), @@ -88,7 +87,10 @@ namespace NzbDrone.Web.Controllers SabUsername = _configProvider.GetValue("SabUsername", String.Empty, true), SabPassword = _configProvider.GetValue("SabPassword", String.Empty, true), SabTvCategory = _configProvider.GetValue("SabTvCategory", String.Empty, true), - SabTvPriority = (SabnzbdPriorityType)Enum.Parse(typeof(SabnzbdPriorityType), _configProvider.GetValue("SabTvPriority", "Normal", true)), + SabTvPriority = + (SabnzbdPriorityType) + Enum.Parse(typeof (SabnzbdPriorityType), + _configProvider.GetValue("SabTvPriority", "Normal", true)), UseBlackHole = Convert.ToBoolean(_configProvider.GetValue("UseBlackHole", true, true)), BlackholeDirectory = _configProvider.GetValue("BlackholeDirectory", String.Empty, true) }; @@ -102,7 +104,7 @@ namespace NzbDrone.Web.Controllers var qualityTypes = new List<QualityTypes>(); - foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes))) + foreach (QualityTypes qual in Enum.GetValues(typeof (QualityTypes))) { qualityTypes.Add(qual); } @@ -112,17 +114,18 @@ namespace NzbDrone.Web.Controllers var userProfiles = _qualityProvider.GetAllProfiles().Where(q => q.UserProfile).ToList(); var profiles = _qualityProvider.GetAllProfiles().ToList(); - var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); + var defaultQualityQualityProfileId = + Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); var selectList = new SelectList(profiles, "QualityProfileId", "Name"); var model = new QualityModel - { - Profiles = profiles, - UserProfiles = userProfiles, - DefaultQualityProfileId = defaultQualityQualityProfileId, - SelectList = selectList - }; + { + Profiles = profiles, + UserProfiles = userProfiles, + DefaultQualityProfileId = defaultQualityQualityProfileId, + SelectList = selectList + }; return View("Index", model); } @@ -132,22 +135,31 @@ namespace NzbDrone.Web.Controllers ViewData["viewName"] = "Notifications"; var model = new NotificationSettingsModel - { - XbmcEnabled = Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)), - XbmcNotifyOnGrab = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)), - XbmcNotifyOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)), - XbmcNotifyOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)), - XbmcNotificationImage = Convert.ToBoolean(_configProvider.GetValue("XbmcNotificationImage", false, true)), - XbmcDisplayTime = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", 3, true)), - XbmcUpdateOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload ", false, true)), - XbmcUpdateOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)), - XbmcFullUpdate = Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true)), - XbmcCleanOnDownload = Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)), - XbmcCleanOnRename = Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)), - XbmcHosts = _configProvider.GetValue("XbmcHosts", "localhost:80", true), - XbmcUsername = _configProvider.GetValue("XbmcUsername", String.Empty, true), - XbmcPassword = _configProvider.GetValue("XbmcPassword", String.Empty, true) - }; + { + XbmcEnabled = Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)), + XbmcNotifyOnGrab = + Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)), + XbmcNotifyOnDownload = + Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)), + XbmcNotifyOnRename = + Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)), + XbmcNotificationImage = + Convert.ToBoolean(_configProvider.GetValue("XbmcNotificationImage", false, true)), + XbmcDisplayTime = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", 3, true)), + XbmcUpdateOnDownload = + Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload ", false, true)), + XbmcUpdateOnRename = + Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)), + XbmcFullUpdate = + Convert.ToBoolean(_configProvider.GetValue("XbmcFullUpdate", false, true)), + XbmcCleanOnDownload = + Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)), + XbmcCleanOnRename = + Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)), + XbmcHosts = _configProvider.GetValue("XbmcHosts", "localhost:80", true), + XbmcUsername = _configProvider.GetValue("XbmcUsername", String.Empty, true), + XbmcPassword = _configProvider.GetValue("XbmcPassword", String.Empty, true) + }; return View("Index", model); } @@ -180,14 +192,14 @@ namespace NzbDrone.Web.Controllers { var qualityTypes = new List<QualityTypes>(); - foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes))) + foreach (QualityTypes qual in Enum.GetValues(typeof (QualityTypes))) { qualityTypes.Add(qual); } ViewData["Qualities"] = qualityTypes; - return View("UserProfileSection", new QualityProfile { Name = "New Profile", UserProfile = true }); + return View("UserProfileSection", new QualityProfile {Name = "New Profile", UserProfile = true}); } public ViewResult AddRootDir() @@ -203,10 +215,11 @@ namespace NzbDrone.Web.Controllers public QualityModel GetUpdatedProfileList() { var profiles = _qualityProvider.GetAllProfiles().ToList(); - var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); + var defaultQualityQualityProfileId = + Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); var selectList = new SelectList(profiles, "QualityProfileId", "Name"); - return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, SelectList = selectList }; + return new QualityModel {DefaultQualityProfileId = defaultQualityQualityProfileId, SelectList = selectList}; } [HttpPost] @@ -315,7 +328,7 @@ namespace NzbDrone.Web.Controllers profile.Allowed = new List<QualityTypes>(); foreach (var quality in profile.AllowedString.Split(',')) { - var qType = (QualityTypes)Enum.Parse(typeof(QualityTypes), quality); + var qType = (QualityTypes) Enum.Parse(typeof (QualityTypes), quality); profile.Allowed.Add(qType); } @@ -385,4 +398,4 @@ namespace NzbDrone.Web.Controllers return Content(SETTINGS_FAILED); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/SharedController.cs b/NzbDrone.Web/Controllers/SharedController.cs index 79e235a05..5cc16ce1e 100644 --- a/NzbDrone.Web/Controllers/SharedController.cs +++ b/NzbDrone.Web/Controllers/SharedController.cs @@ -1,15 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using NzbDrone.Core.Providers; namespace NzbDrone.Web.Controllers { public class SharedController : Controller { - private TimerProvider _timerProvider; + private readonly TimerProvider _timerProvider; public SharedController(TimerProvider timerProvider) { @@ -29,4 +25,4 @@ namespace NzbDrone.Web.Controllers return PartialView(); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/UpcomingController.cs b/NzbDrone.Web/Controllers/UpcomingController.cs index dcf66cf55..f0b5af4fe 100644 --- a/NzbDrone.Web/Controllers/UpcomingController.cs +++ b/NzbDrone.Web/Controllers/UpcomingController.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; +using System.Linq; using System.Web.Mvc; using NzbDrone.Core.Providers; using NzbDrone.Web.Models; @@ -11,7 +8,7 @@ namespace NzbDrone.Web.Controllers { public class UpcomingController : Controller { - private UpcomingEpisodesProvider _upcomingEpisodesProvider; + private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider; public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider) { @@ -30,16 +27,16 @@ namespace NzbDrone.Web.Controllers public ActionResult _AjaxBindingYesterday() { var upcoming = _upcomingEpisodesProvider.Yesterday().Select(e => new UpcomingEpisodeModel - { - SeriesId = e.Series.SeriesId, - SeriesName = e.Series.Title, - SeasonNumber = e.SeasonNumber, - EpisodeNumber = e.EpisodeNumber, - Title = e.Title, - Overview = e.Overview, - AirDate = e.AirDate - }); - + { + SeriesId = e.Series.SeriesId, + SeriesName = e.Series.Title, + SeasonNumber = e.SeasonNumber, + EpisodeNumber = e.EpisodeNumber, + Title = e.Title, + Overview = e.Overview, + AirDate = e.AirDate + }); + return View(new GridModel(upcoming)); } @@ -47,15 +44,15 @@ namespace NzbDrone.Web.Controllers public ActionResult _AjaxBindingToday() { var upcoming = _upcomingEpisodesProvider.Today().Select(e => new UpcomingEpisodeModel - { - SeriesId = e.Series.SeriesId, - SeriesName = e.Series.Title, - SeasonNumber = e.SeasonNumber, - EpisodeNumber = e.EpisodeNumber, - Title = e.Title, - Overview = e.Overview, - AirDate = e.AirDate - }); + { + SeriesId = e.Series.SeriesId, + SeriesName = e.Series.Title, + SeasonNumber = e.SeasonNumber, + EpisodeNumber = e.EpisodeNumber, + Title = e.Title, + Overview = e.Overview, + AirDate = e.AirDate + }); return View(new GridModel(upcoming)); } @@ -64,17 +61,17 @@ namespace NzbDrone.Web.Controllers public ActionResult _AjaxBindingWeek() { var upcoming = _upcomingEpisodesProvider.Week().Select(e => new UpcomingEpisodeModel - { - SeriesId = e.Series.SeriesId, - SeriesName = e.Series.Title, - SeasonNumber = e.SeasonNumber, - EpisodeNumber = e.EpisodeNumber, - Title = e.Title, - Overview = e.Overview, - AirDate = e.AirDate - }); + { + SeriesId = e.Series.SeriesId, + SeriesName = e.Series.Title, + SeasonNumber = e.SeasonNumber, + EpisodeNumber = e.EpisodeNumber, + Title = e.Title, + Overview = e.Overview, + AirDate = e.AirDate + }); return View(new GridModel(upcoming)); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Global.asax.cs b/NzbDrone.Web/Global.asax.cs index cfb2de05f..945468bfe 100644 --- a/NzbDrone.Web/Global.asax.cs +++ b/NzbDrone.Web/Global.asax.cs @@ -1,6 +1,5 @@ using System; using System.Data.SQLite; -using System.Diagnostics; using System.Reflection; using System.Threading; using System.Web; @@ -11,7 +10,6 @@ using Ninject.Web.Mvc; using NLog; using NzbDrone.Core; using NzbDrone.Core.Instrumentation; -using SubSonic.Repository; namespace NzbDrone.Web { @@ -21,17 +19,16 @@ namespace NzbDrone.Web public static void RegisterRoutes(RouteCollection routes) { - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - routes.IgnoreRoute("{*robotstxt}", new { robotstxt = @"(.*/)?robots.txt(/.*)?" }); - routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); + routes.IgnoreRoute("{*robotstxt}", new {robotstxt = @"(.*/)?robots.txt(/.*)?"}); + routes.IgnoreRoute("{*favicon}", new {favicon = @"(.*/)?favicon.ico(/.*)?"}); routes.MapRoute( - "Default", // Route name - "{controller}/{action}/{id}", // URL with parameters - new { controller = "Series", action = "Index", id = UrlParameter.Optional } // Parameter defaults - ); + "Default", // Route name + "{controller}/{action}/{id}", // URL with parameters + new {controller = "Series", action = "Index", id = UrlParameter.Optional} // Parameter defaults + ); } protected override void OnApplicationStarted() @@ -85,15 +82,11 @@ namespace NzbDrone.Web Logger.Warn("Restarting application"); HttpRuntime.UnloadAppDomain(); } - } protected void Application_BeginRequest() { Thread.CurrentThread.Name = "UI"; } - - - } } \ No newline at end of file diff --git a/NzbDrone.Web/Helpers/HtmlPrefixScopeExtensions.cs b/NzbDrone.Web/Helpers/HtmlPrefixScopeExtensions.cs index 41a380bf1..e985bc591 100644 --- a/NzbDrone.Web/Helpers/HtmlPrefixScopeExtensions.cs +++ b/NzbDrone.Web/Helpers/HtmlPrefixScopeExtensions.cs @@ -1,7 +1,7 @@ using System; -using System.Web.Mvc; -using System.Web; using System.Collections.Generic; +using System.Web; +using System.Web.Mvc; namespace NzbDrone.Web.Helpers { @@ -15,7 +15,9 @@ namespace NzbDrone.Web.Helpers string itemIndex = idsToReuse.Count > 0 ? idsToReuse.Dequeue() : Guid.NewGuid().ToString(); // autocomplete="off" is needed to work around a very annoying Chrome behaviour whereby it reuses old values after the user clicks "Back", which causes the xyz.index and xyz[...] values to get out of sync. - html.ViewContext.Writer.WriteLine(string.Format("<input type=\"hidden\" name=\"{0}.index\" autocomplete=\"off\" value=\"{1}\" />", collectionName, itemIndex)); + html.ViewContext.Writer.WriteLine( + string.Format("<input type=\"hidden\" name=\"{0}.index\" autocomplete=\"off\" value=\"{1}\" />", + collectionName, itemIndex)); return BeginHtmlFieldPrefixScope(html, string.Format("{0}[{1}]", collectionName, itemIndex)); } @@ -30,8 +32,9 @@ namespace NzbDrone.Web.Helpers // We need to use the same sequence of IDs following a server-side validation failure, // otherwise the framework won't render the validation error messages next to each item. string key = idsToReuseKey + collectionName; - var queue = (Queue<string>)httpContext.Items[key]; - if (queue == null) { + var queue = (Queue<string>) httpContext.Items[key]; + if (queue == null) + { httpContext.Items[key] = queue = new Queue<string>(); var previouslyUsedIds = httpContext.Request[collectionName + ".index"]; if (!string.IsNullOrEmpty(previouslyUsedIds)) @@ -41,10 +44,12 @@ namespace NzbDrone.Web.Helpers return queue; } + #region Nested type: HtmlFieldPrefixScope + private class HtmlFieldPrefixScope : IDisposable { - private readonly TemplateInfo templateInfo; private readonly string previousHtmlFieldPrefix; + private readonly TemplateInfo templateInfo; public HtmlFieldPrefixScope(TemplateInfo templateInfo, string htmlFieldPrefix) { @@ -54,10 +59,16 @@ namespace NzbDrone.Web.Helpers templateInfo.HtmlFieldPrefix = htmlFieldPrefix; } + #region IDisposable Members + public void Dispose() { templateInfo.HtmlFieldPrefix = previousHtmlFieldPrefix; } + + #endregion } + + #endregion } } \ No newline at end of file diff --git a/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs b/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs index 5aa7316a3..0f6b579a0 100644 --- a/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs +++ b/NzbDrone.Web/Helpers/IsCurrentActionHelper.cs @@ -1,14 +1,14 @@ using System; using System.Web.Mvc; using System.Web.Mvc.Html; + namespace Helpers { public static class IsCurrentActionHelper { - private static bool IsCurrentController(HtmlHelper helper, string actionName, string controllerName) { - var currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"]; + var currentControllerName = (string) helper.ViewContext.RouteData.Values["controller"]; if (currentControllerName.Equals(controllerName, StringComparison.CurrentCultureIgnoreCase)) return true; @@ -16,7 +16,8 @@ namespace Helpers return false; } - public static string CurrentActionLink(this HtmlHelper helper, string text, string actionName, string controllerName) + public static string CurrentActionLink(this HtmlHelper helper, string text, string actionName, + string controllerName) { string result; @@ -30,7 +31,6 @@ namespace Helpers } return result + helper.ActionLink(text, actionName, controllerName).ToHtmlString() + @"</li>"; - } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Models/AccountModels.cs b/NzbDrone.Web/Models/AccountModels.cs index ff223d20d..98b1d99c2 100644 --- a/NzbDrone.Web/Models/AccountModels.cs +++ b/NzbDrone.Web/Models/AccountModels.cs @@ -1,18 +1,16 @@ using System; -using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Globalization; -using System.Linq; -using System.Web; -using System.Web.Mvc; using System.Web.Security; namespace NzbDrone.Web.Models { #region Models - [PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "The new password and confirmation password do not match.")] + + [PropertiesMustMatch("NewPassword", "ConfirmPassword", + ErrorMessage = "The new password and confirmation password do not match.")] public class ChangePasswordModel { [Required] @@ -47,7 +45,8 @@ namespace NzbDrone.Web.Models public bool RememberMe { get; set; } } - [PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessage = "The password and confirmation password do not match.")] + [PropertiesMustMatch("Password", "ConfirmPassword", + ErrorMessage = "The password and confirmation password do not match.")] public class RegisterModel { [Required] @@ -70,9 +69,11 @@ namespace NzbDrone.Web.Models [DisplayName("Confirm password")] public string ConfirmPassword { get; set; } } + #endregion #region Services + // The FormsAuthentication type is sealed and contains static members, so it is difficult to // unit test code that calls its members. The interface and helper class below demonstrate // how to create an abstract wrapper around such a type in order to make the AccountController @@ -101,26 +102,29 @@ namespace NzbDrone.Web.Models _provider = provider ?? Membership.Provider; } + #region IMembershipService Members + public int MinPasswordLength { - get - { - return _provider.MinRequiredPasswordLength; - } + get { return _provider.MinRequiredPasswordLength; } } public bool ValidateUser(string userName, string password) { - if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); - if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password"); + if (String.IsNullOrEmpty(userName)) + throw new ArgumentException("Value cannot be null or empty.", "userName"); + if (String.IsNullOrEmpty(password)) + throw new ArgumentException("Value cannot be null or empty.", "password"); return _provider.ValidateUser(userName, password); } public MembershipCreateStatus CreateUser(string userName, string password, string email) { - if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); - if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password"); + if (String.IsNullOrEmpty(userName)) + throw new ArgumentException("Value cannot be null or empty.", "userName"); + if (String.IsNullOrEmpty(password)) + throw new ArgumentException("Value cannot be null or empty.", "password"); if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email"); MembershipCreateStatus status; @@ -130,9 +134,12 @@ namespace NzbDrone.Web.Models public bool ChangePassword(string userName, string oldPassword, string newPassword) { - if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); - if (String.IsNullOrEmpty(oldPassword)) throw new ArgumentException("Value cannot be null or empty.", "oldPassword"); - if (String.IsNullOrEmpty(newPassword)) throw new ArgumentException("Value cannot be null or empty.", "newPassword"); + if (String.IsNullOrEmpty(userName)) + throw new ArgumentException("Value cannot be null or empty.", "userName"); + if (String.IsNullOrEmpty(oldPassword)) + throw new ArgumentException("Value cannot be null or empty.", "oldPassword"); + if (String.IsNullOrEmpty(newPassword)) + throw new ArgumentException("Value cannot be null or empty.", "newPassword"); // The underlying ChangePassword() will throw an exception rather // than return false in certain failure scenarios. @@ -150,6 +157,8 @@ namespace NzbDrone.Web.Models return false; } } + + #endregion } public interface IFormsAuthenticationService @@ -160,9 +169,12 @@ namespace NzbDrone.Web.Models public class FormsAuthenticationService : IFormsAuthenticationService { + #region IFormsAuthenticationService Members + public void SignIn(string userName, bool createPersistentCookie) { - if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); + if (String.IsNullOrEmpty(userName)) + throw new ArgumentException("Value cannot be null or empty.", "userName"); FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); } @@ -171,10 +183,14 @@ namespace NzbDrone.Web.Models { FormsAuthentication.SignOut(); } + + #endregion } + #endregion #region Validation + public static class AccountValidation { public static string ErrorCodeToString(MembershipCreateStatus createStatus) @@ -205,13 +221,16 @@ namespace NzbDrone.Web.Models return "The user name provided is invalid. Please check the value and try again."; case MembershipCreateStatus.ProviderError: - return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + return + "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; case MembershipCreateStatus.UserRejected: - return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + return + "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; default: - return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + return + "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator."; } } } @@ -234,16 +253,13 @@ namespace NzbDrone.Web.Models public override object TypeId { - get - { - return _typeId; - } + get { return _typeId; } } public override string FormatErrorMessage(string name) { return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString, - OriginalProperty, ConfirmProperty); + OriginalProperty, ConfirmProperty); } public override bool IsValid(object value) @@ -251,7 +267,7 @@ namespace NzbDrone.Web.Models PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); object originalValue = properties.Find(OriginalProperty, true /* ignoreCase */).GetValue(value); object confirmValue = properties.Find(ConfirmProperty, true /* ignoreCase */).GetValue(value); - return Object.Equals(originalValue, confirmValue); + return Equals(originalValue, confirmValue); } } @@ -269,7 +285,7 @@ namespace NzbDrone.Web.Models public override string FormatErrorMessage(string name) { return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString, - name, _minCharacters); + name, _minCharacters); } public override bool IsValid(object value) @@ -278,6 +294,6 @@ namespace NzbDrone.Web.Models return (valueAsString != null && valueAsString.Length >= _minCharacters); } } - #endregion -} + #endregion +} \ No newline at end of file diff --git a/NzbDrone.Web/Models/AddExistingManualModel.cs b/NzbDrone.Web/Models/AddExistingManualModel.cs index 0b612a486..5a529e219 100644 --- a/NzbDrone.Web/Models/AddExistingManualModel.cs +++ b/NzbDrone.Web/Models/AddExistingManualModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Web; +using System.ComponentModel; using System.Web.Mvc; namespace NzbDrone.Web.Models diff --git a/NzbDrone.Web/Models/AddExistingSeriesModel.cs b/NzbDrone.Web/Models/AddExistingSeriesModel.cs index 0c64da56d..ef9fb98de 100644 --- a/NzbDrone.Web/Models/AddExistingSeriesModel.cs +++ b/NzbDrone.Web/Models/AddExistingSeriesModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace NzbDrone.Web.Models +namespace NzbDrone.Web.Models { public class AddExistingSeriesModel { diff --git a/NzbDrone.Web/Models/AddNewSeriesModel.cs b/NzbDrone.Web/Models/AddNewSeriesModel.cs index b79dacaff..0431704eb 100644 --- a/NzbDrone.Web/Models/AddNewSeriesModel.cs +++ b/NzbDrone.Web/Models/AddNewSeriesModel.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; using System.Web.Mvc; using NzbDrone.Core.Repository; diff --git a/NzbDrone.Web/Models/DownloadSettingsModel.cs b/NzbDrone.Web/Models/DownloadSettingsModel.cs index 368aaf9fd..675064ed7 100644 --- a/NzbDrone.Web/Models/DownloadSettingsModel.cs +++ b/NzbDrone.Web/Models/DownloadSettingsModel.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; using System.Web.Mvc; using NzbDrone.Core.Model; @@ -11,110 +8,63 @@ namespace NzbDrone.Web.Models { public class DownloadSettingsModel { + public SelectList PrioritySelectList = + new SelectList(new[] {"Default", "Paused", "Low", "Normal", "High", "Top"}); + [Required] [Range(15, 120, ErrorMessage = "Must be between 15 and 120 minutes")] [DataType(DataType.Text)] [DisplayName("Sync Frequency")] - public int SyncFrequency - { - get; - set; - } + public int SyncFrequency { get; set; } [DisplayName("Download Propers")] - public bool DownloadPropers - { - get; - set; - } + public bool DownloadPropers { get; set; } - [Required (ErrorMessage = "Please enter a valid number")] + [Required(ErrorMessage = "Please enter a valid number")] [DataType(DataType.Text)] [DisplayName("Retention")] - public int Retention - { - get; - set; - } + public int Retention { get; set; } - [Required (ErrorMessage = "Please enter a valid host")] + [Required(ErrorMessage = "Please enter a valid host")] [DataType(DataType.Text)] [DisplayName("SABnzbd Host")] - public String SabHost - { - get; - set; - } + public String SabHost { get; set; } [Required(ErrorMessage = "Please enter a valid port")] [DataType(DataType.Text)] [DisplayName("SABnzbd Port")] - public int SabPort - { - get; - set; - } + public int SabPort { get; set; } [DataType(DataType.Text)] [DisplayName("SABnzbd API Key")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String SabApiKey - { - get; - set; - } + public String SabApiKey { get; set; } [DataType(DataType.Text)] [DisplayName("SABnzbd Username")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String SabUsername - { - get; - set; - } + public String SabUsername { get; set; } [DataType(DataType.Text)] [DisplayName("SABnzbd Password")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String SabPassword - { - get; - set; - } + public String SabPassword { get; set; } [DataType(DataType.Text)] [DisplayFormat(ConvertEmptyStringToNull = false)] [DisplayName("SABnzbd TV Category")] - public String SabTvCategory - { - get; - set; - } + public String SabTvCategory { get; set; } [Required(ErrorMessage = "Please select a valid priority")] [DisplayName("SABnzbd Priority")] - public SabnzbdPriorityType SabTvPriority - { - get; - set; - } + public SabnzbdPriorityType SabTvPriority { get; set; } [DisplayName("Use Blackhole")] - public bool UseBlackHole - { - get; - set; - } + public bool UseBlackHole { get; set; } [DataType(DataType.Text)] [DisplayFormat(ConvertEmptyStringToNull = false)] [DisplayName("Blackhole Directory")] - public String BlackholeDirectory - { - get; - set; - } - - public SelectList PrioritySelectList = new SelectList(new string[] { "Default", "Paused", "Low", "Normal", "High", "Top" }); + public String BlackholeDirectory { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Models/EpisodeModel.cs b/NzbDrone.Web/Models/EpisodeModel.cs index b1644ae2a..f43e60a27 100644 --- a/NzbDrone.Web/Models/EpisodeModel.cs +++ b/NzbDrone.Web/Models/EpisodeModel.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/EpisodeSortingModel.cs b/NzbDrone.Web/Models/EpisodeSortingModel.cs index 82469a92a..beaf0c216 100644 --- a/NzbDrone.Web/Models/EpisodeSortingModel.cs +++ b/NzbDrone.Web/Models/EpisodeSortingModel.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; using System.Web.Mvc; -using NzbDrone.Core.Model; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/HistoryModel.cs b/NzbDrone.Web/Models/HistoryModel.cs index 7a47c0f57..be5e6fd3f 100644 --- a/NzbDrone.Web/Models/HistoryModel.cs +++ b/NzbDrone.Web/Models/HistoryModel.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/IndexerSettingsModel.cs b/NzbDrone.Web/Models/IndexerSettingsModel.cs index 487fb8d05..79c62deca 100644 --- a/NzbDrone.Web/Models/IndexerSettingsModel.cs +++ b/NzbDrone.Web/Models/IndexerSettingsModel.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; using NzbDrone.Core.Repository; namespace NzbDrone.Web.Models @@ -13,61 +11,33 @@ namespace NzbDrone.Web.Models [DataType(DataType.Text)] [DisplayName("NZBMatrix Username")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbMatrixUsername - { - get; - set; - } + public String NzbMatrixUsername { get; set; } [DataType(DataType.Text)] [DisplayName("NZBMatrix API Key")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbMatrixApiKey - { - get; - set; - } + public String NzbMatrixApiKey { get; set; } [DataType(DataType.Text)] [DisplayName("NZBs.Org UID")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbsOrgUId - { - get; - set; - } + public String NzbsOrgUId { get; set; } [DataType(DataType.Text)] [DisplayName("NZBs.Org Hash")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbsOrgHash - { - get; - set; - } + public String NzbsOrgHash { get; set; } [DataType(DataType.Text)] [DisplayName("NZBsRus UID")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbsrusUId - { - get; - set; - } + public String NzbsrusUId { get; set; } [DataType(DataType.Text)] [DisplayName("NZBsRus Hash")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public String NzbsrusHash - { - get; - set; - } + public String NzbsrusHash { get; set; } - public List<Indexer> Indexers - { - get; - set; - } + public List<Indexer> Indexers { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Models/MappingModel.cs b/NzbDrone.Web/Models/MappingModel.cs index bd8ea84b2..47dd56ed4 100644 --- a/NzbDrone.Web/Models/MappingModel.cs +++ b/NzbDrone.Web/Models/MappingModel.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/NotificationSettingsModel.cs b/NzbDrone.Web/Models/NotificationSettingsModel.cs index 8a27fc99a..e8f3abca3 100644 --- a/NzbDrone.Web/Models/NotificationSettingsModel.cs +++ b/NzbDrone.Web/Models/NotificationSettingsModel.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/QualityModel.cs b/NzbDrone.Web/Models/QualityModel.cs index ce6f91848..9329a1679 100644 --- a/NzbDrone.Web/Models/QualityModel.cs +++ b/NzbDrone.Web/Models/QualityModel.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; using System.Web.Mvc; using NzbDrone.Core.Repository.Quality; diff --git a/NzbDrone.Web/Models/SeriesSearchResultModel.cs b/NzbDrone.Web/Models/SeriesSearchResultModel.cs index ec5195700..3c9a1672a 100644 --- a/NzbDrone.Web/Models/SeriesSearchResultModel.cs +++ b/NzbDrone.Web/Models/SeriesSearchResultModel.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Models/SettingsModels.cs b/NzbDrone.Web/Models/SettingsModels.cs index 441b1c8ed..8430fb842 100644 --- a/NzbDrone.Web/Models/SettingsModels.cs +++ b/NzbDrone.Web/Models/SettingsModels.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using NzbDrone.Core.Model; using NzbDrone.Core.Repository; namespace NzbDrone.Web.Models { - public class SettingsModel { [DisplayName("TV Series Root Folder(s)")] public List<RootDir> Directories { get; set; } } -} +} \ No newline at end of file diff --git a/NzbDrone.Web/Models/TestModel.cs b/NzbDrone.Web/Models/TestModel.cs index 666e80e4c..0a9e13b7c 100644 --- a/NzbDrone.Web/Models/TestModel.cs +++ b/NzbDrone.Web/Models/TestModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace NzbDrone.Web.Models +namespace NzbDrone.Web.Models { public class TestModel { diff --git a/NzbDrone.Web/Models/UpcomingEpisodeModel.cs b/NzbDrone.Web/Models/UpcomingEpisodeModel.cs index a5be43084..7138dff9f 100644 --- a/NzbDrone.Web/Models/UpcomingEpisodeModel.cs +++ b/NzbDrone.Web/Models/UpcomingEpisodeModel.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; namespace NzbDrone.Web.Models { diff --git a/NzbDrone.Web/Properties/AssemblyInfo.cs b/NzbDrone.Web/Properties/AssemblyInfo.cs index c41130501..5cce0429f 100644 --- a/NzbDrone.Web/Properties/AssemblyInfo.cs +++ b/NzbDrone.Web/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. + [assembly: AssemblyTitle("NZBDrone.Web")] [assembly: AssemblyDescription("NZBDrone Web Interface")] [assembly: AssemblyConfiguration("")] @@ -17,9 +17,11 @@ using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. + [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM + [assembly: Guid("1ec2c814-7c1e-470d-bbae-59b129b720fd")] // Version information for an assembly consists of the following four values: @@ -31,4 +33,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: + [assembly: AssemblyVersion("0.2.0.*")] \ No newline at end of file diff --git a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx b/NzbDrone.Web/Views/AddSeries/AddExisting.aspx index cd6972573..eabe101b0 100644 --- a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx +++ b/NzbDrone.Web/Views/AddSeries/AddExisting.aspx @@ -1,7 +1,4 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<String>>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> -<%@ Import Namespace="NzbDrone.Web.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Add Existing Series </asp:Content> @@ -9,21 +6,24 @@ <% if (Model.Count() == 0) Html.DisplayText("No Series to Add"); - %> +%> - <%: Html.DropDownList("masterDropbox", (SelectList)ViewData["qualities"], new { style = "width: 100px;", id = "masterDropboxId" })%> + <%:Html.DropDownList("masterDropbox", (SelectList) ViewData["qualities"], + new {style = "width: 100px;", id = "masterDropboxId"})%> - <%: @Html.Telerik().DropDownList().Name("tester").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })%> + <%: + @Html.Telerik().DropDownList().Name("tester").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes( + new {style = "width: 100px", @class = "qualityDropbox"})%> <% foreach (var path in Model) { - Html.RenderAction("RenderPartial", "AddSeries", new { path }); + Html.RenderAction("RenderPartial", "AddSeries", new {path}); } - - %> + +%> <script type="text/javascript"> diff --git a/NzbDrone.Web/Views/AddSeries/AddNew.aspx b/NzbDrone.Web/Views/AddSeries/AddNew.aspx index c2f72eaef..995b545c8 100644 --- a/NzbDrone.Web/Views/AddSeries/AddNew.aspx +++ b/NzbDrone.Web/Views/AddSeries/AddNew.aspx @@ -1,8 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AddNewSeriesModel>" %> - -<%@ Import Namespace="NzbDrone.Web.Models" %> -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> -<%@ Import Namespace="NzbDrone.Core.Repository" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Web.Models.AddNewSeriesModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Add New Series <script type="text/javascript"> @@ -14,14 +10,14 @@ <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div style="width: 60%"> <div style="display: inline"> - <%= Html.Label("Enter a Series Name") %> - <%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %> + <%=Html.Label("Enter a Series Name")%> + <%=Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})%> <button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()"> Search</button> </div> <div style="display: inline; float: right;"> - <%= Html.LabelFor(m => m.QualityProfileId)%> - <%: Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%> + <%=Html.LabelFor(m => m.QualityProfileId)%> + <%:Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%> </div> </div> <div id="result"> @@ -29,12 +25,16 @@ <div id="RootDirectories" class="rootDirectories" style="display: none"> <fieldset> <legend>Root TV Folders</legend> - <% int d = 0; %> - <% foreach (var dir in Model.RootDirectories) - { %> - <%: Html.RadioButton("selectedRootDir", dir.Path, d ==0 , new { @class="dirList examplePart", id="dirRadio_" + d }) %> - <%: Html.Label(dir.Path) %> - <% } %> + <% + int d = 0;%> + <% + foreach (var dir in Model.RootDirectories) + {%> + <%:Html.RadioButton("selectedRootDir", dir.Path, d == 0, + new {@class = "dirList examplePart", id = "dirRadio_" + d})%> + <%:Html.Label(dir.Path)%> + <% + }%> </fieldset> <div id="example"> </div> @@ -56,7 +56,7 @@ $("#result").text("Searching..."); - $("#result").load('<%=Url.Action("SearchForSeries", "Series") %>', { + $("#result").load('<%=Url.Action("SearchForSeries", "Series")%>', { seriesName: seriesSearch.val() }); @@ -78,7 +78,7 @@ var seriesName = $(id).val(); var qualityProfileId = $("#QualityProfileId").val(); - $("#addResult").load('<%=Url.Action("AddSeries", "Series") %>', { + $("#addResult").load('<%=Url.Action("AddSeries", "Series")%>', { dir: checkedDir, seriesId: checkedSeries, seriesName: seriesName, diff --git a/NzbDrone.Web/Views/History/Index.aspx b/NzbDrone.Web/Views/History/Index.aspx index 54cb6abf6..2deae10c5 100644 --- a/NzbDrone.Web/Views/History/Index.aspx +++ b/NzbDrone.Web/Views/History/Index.aspx @@ -1,6 +1,4 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<NzbDrone.Web.Models.HistoryModel>>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="NzbDrone.Web.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="Scripts" runat="server"> @@ -30,35 +28,40 @@ <% Html.Telerik().Menu().Name("historyMenu").Items(items => { - items.Add().Text("Trim History").Action("Trim", "History"); - items.Add().Text("Purge History").Action("Purge", "History"); + items.Add().Text("Trim History").Action("Trim", + "History"); + items.Add().Text("Purge History").Action("Purge", + "History"); }).Render(); - %> +%> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server"> - <%Html.Telerik().Grid<HistoryModel>().Name("history") - .Columns(columns => - { - columns.Bound(c => c.SeriesTitle).Title("Series Name").Width(120); - columns.Bound(c => c.SeasonNumber).Title("Season #").Width(10); - columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(10); - columns.Bound(c => c.EpisodeTitle).Title("Episode Title").Width(140); - columns.Bound(c => c.Quality).Title("Quality").Width(30); - columns.Bound(c => c.Date).Title("Date Grabbed").Width(60); - }) - .DetailView(detailView => detailView.ClientTemplate( - "<fieldset>" + - "<div><b>Overview: </b><#= EpisodeOverview #></div>" + - "<div><b>NZB Title: </b><#= NzbTitle #></div>" + - "<div><b>Proper: </b><#= IsProper #></div>" + - "</fieldset>" - - )) - .DataBinding(data => data.Ajax().Select("_AjaxBinding", "History")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Date).Descending()).Enabled(true)) - .Pageable(c => c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPreviousAndNumeric)) - //.Filterable() - //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); - %> + <% + Html.Telerik().Grid<HistoryModel>().Name("history") + .Columns(columns => + { + columns.Bound(c => c.SeriesTitle).Title("Series Name").Width(120); + columns.Bound(c => c.SeasonNumber).Title("Season #").Width(10); + columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(10); + columns.Bound(c => c.EpisodeTitle).Title("Episode Title").Width(140); + columns.Bound(c => c.Quality).Title("Quality").Width(30); + columns.Bound(c => c.Date).Title("Date Grabbed").Width(60); + }) + .DetailView(detailView => detailView.ClientTemplate( + "<fieldset>" + + "<div><b>Overview: </b><#= EpisodeOverview #></div>" + + "<div><b>NZB Title: </b><#= NzbTitle #></div>" + + "<div><b>Proper: </b><#= IsProper #></div>" + + "</fieldset>" + )) + .DataBinding(data => data.Ajax().Select("_AjaxBinding", "History")) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Date).Descending()).Enabled(true)) + .Pageable( + c => + c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | + GridPagerStyles.NextPreviousAndNumeric)) + //.Filterable() + //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) + .Render(); +%> </asp:Content> diff --git a/NzbDrone.Web/Views/Log/Index.aspx b/NzbDrone.Web/Views/Log/Index.aspx index 6e331f120..7d1c9d694 100644 --- a/NzbDrone.Web/Views/Log/Index.aspx +++ b/NzbDrone.Web/Views/Log/Index.aspx @@ -1,6 +1,4 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NzbDrone.Core.Instrumentation.Log>>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <asp:Content ContentPlaceHolderID="Scripts" runat="server"> <script type="text/javascript"> function onRowDataBound(e) { @@ -26,29 +24,32 @@ </asp:Content> <asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server"> <% - Html.Telerik().Menu().Name("logMenu").Items(items => items.Add().Text("Clear Logs").Action("Clear", "Log")).Render(); - %> + Html.Telerik().Menu().Name("logMenu").Items(items => items.Add().Text("Clear Logs").Action("Clear", "Log")). + Render(); +%> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> - <%Html.Telerik().Grid(Model).Name("logs") - .Columns(columns => - { - columns.Bound(c => c.Time).Title("Time").Width(190); - columns.Bound(c => c.DisplayLevel).Title("Level").Width(0); - columns.Bound(c => c.Message); - }) - .DetailView(detailView => detailView.ClientTemplate( - + <% + Html.Telerik().Grid(Model).Name("logs") + .Columns(columns => + { + columns.Bound(c => c.Time).Title("Time").Width(190); + columns.Bound(c => c.DisplayLevel).Title("Level").Width(0); + columns.Bound(c => c.Message); + }) + .DetailView(detailView => detailView.ClientTemplate( "<div><#= Logger #></div>" + "<div><#= ExceptionType #></div>" + "<div><#= ExceptionMessage #></div>" + "<div class='stackframe'><#= ExceptionString #></div>" - - )).DataBinding(data => data.Ajax().Select("_AjaxBinding", "Log")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true)) - .Pageable(c => c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPreviousAndNumeric)) - .Filterable() - .ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); - %> + )).DataBinding(data => data.Ajax().Select("_AjaxBinding", "Log")) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true)) + .Pageable( + c => + c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | + GridPagerStyles.NextPreviousAndNumeric)) + .Filterable() + .ClientEvents(c => c.OnRowDataBound("onRowDataBound")) + .Render(); +%> </asp:Content> diff --git a/NzbDrone.Web/Views/Series/Details.aspx b/NzbDrone.Web/Views/Series/Details.aspx index 662c4778a..e6c41b0ca 100644 --- a/NzbDrone.Web/Views/Series/Details.aspx +++ b/NzbDrone.Web/Views/Series/Details.aspx @@ -1,84 +1,105 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Core.Repository.Series>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="NzbDrone.Core.Repository" %> <%@ Import Namespace="NzbDrone.Web.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> - <%: Model.Title %> + <%:Model.Title%> </asp:Content> <asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server"> <% Html.Telerik().Menu().Name("SeriesMenu").Items(items => - { - items.Add().Text("Edit").Action("Edit", "Series", new { seriesId = Model.SeriesId }); - items.Add().Text("Back to Series List").Action("Index", "Series"); - items.Add().Text("Scan For Episodes on Disk").Action("SyncEpisodesOnDisk", "Series", new { seriesId = Model.SeriesId }); - items.Add().Text("Rename Series").Action("RenameSeries", "Series", new { seriesId = Model.SeriesId }); - }).Render(); - %> + { + items.Add().Text("Edit").Action("Edit", "Series", + new + { + seriesId = + Model.SeriesId + }); + items.Add().Text("Back to Series List").Action("Index", + "Series"); + items.Add().Text("Scan For Episodes on Disk").Action( + "SyncEpisodesOnDisk", "Series", + new {seriesId = Model.SeriesId}); + items.Add().Text("Rename Series").Action("RenameSeries", + "Series", + new + { + seriesId + = + Model. + SeriesId + }); + }).Render(); +%> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <fieldset> <div class="display-label"> ID</div> <div class="display-field"> - <%: Model.SeriesId %></div> + <%:Model.SeriesId%></div> <div class="display-label"> Overview</div> <div class="display-field"> - <%: Model.Overview %></div> + <%:Model.Overview%></div> <div class="display-label"> Status</div> <div class="display-field"> - <%: Model.Status %></div> + <%:Model.Status%></div> <div class="display-label"> AirTimes</div> <div class="display-field"> - <%: Model.AirTimes %></div> + <%:Model.AirTimes%></div> <div class="display-label"> Language</div> <div class="display-field"> - <%: Model.Language.ToUpper() %></div> + <%:Model.Language.ToUpper()%></div> <div class="display-label"> Location</div> <div class="display-field"> - <%: Model.Path %></div> + <%:Model.Path%></div> </fieldset> - <% + <% //Todo: This breaks when using SQLServer... thoughts? //Normal Seasons foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse()) { - %> +%> <br /> <h3> Season - <%: season.SeasonNumber %></h3> + <%:season.SeasonNumber%></h3> <% Season season1 = season; Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber) - .Columns(columns => - { - columns.Bound(o => o.EpisodeId) - .ClientTemplate("<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />") - .Title("") - .Width(1) - .HtmlAttributes(new { style = "text-align:center" }); + .Columns(columns => + { + columns.Bound(o => o.EpisodeId) + .ClientTemplate( + "<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />") + .Title("") + .Width(1) + .HtmlAttributes(new {style = "text-align:center"}); - columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); - columns.Bound(c => c.Title).Title("Title").Width(300); - columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); - columns.Bound(c => c.Quality).Width(10); - columns.Bound(c => c.Path); - }) + columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); + columns.Bound(c => c.Title).Title("Title").Width(300); + columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); + columns.Bound(c => c.Quality).Width(10); + columns.Bound(c => c.Path); + }) //.DetailView(detailView => detailView.Template(e => Html.RenderPartial("EpisodeDetail", e))) - .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) - .Footer(false) - .DataBinding(d => d.Ajax().Select("_AjaxSeasonGrid", "Series", new RouteValueDictionary { { "seasonId", season1.SeasonId.ToString() } })) + .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Footer(false) + .DataBinding( + d => + d.Ajax().Select("_AjaxSeasonGrid", "Series", + new RouteValueDictionary {{"seasonId", season1.SeasonId.ToString()}})) //.EnableCustomBinding(true) //.ClientEvents(e => e.OnDetailViewExpand("episodeDetailExpanded")) //Causes issues displaying the episode detail multiple times... - .ToolBar(c => c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season1.SeasonId }).ButtonType(GridButtonType.Text)) + .ToolBar( + c => + c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new {seasonId = season1.SeasonId}) + .ButtonType(GridButtonType.Text)) .Render(); } @@ -87,25 +108,25 @@ if (specialSeasons != null) { - %> +%> <br /> <h3> Specials</h3> <% - + Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials") - .Columns(columns => + .Columns(columns => { columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); columns.Bound(c => c.Title); columns.Bound(c => c.AirDate).Format("{0:d}").Width(0); }) - .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #></div>")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) - .Footer(false) - .Render(); + .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #></div>")) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) + .Footer(false) + .Render(); } - %> +%> </asp:Content> <asp:Content ContentPlaceHolderID="Scripts" runat="server"> <script type="text/javascript"> diff --git a/NzbDrone.Web/Views/Series/Edit.aspx b/NzbDrone.Web/Views/Series/Edit.aspx index 040461e49..9290a69a5 100644 --- a/NzbDrone.Web/Views/Series/Edit.aspx +++ b/NzbDrone.Web/Views/Series/Edit.aspx @@ -33,68 +33,71 @@ <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> - <h2><%: Html.DisplayTextFor(model => model.Title) %></h2> + <h2><%:Html.DisplayTextFor(model => model.Title)%></h2> - <% Html.EnableClientValidation(); %> - <% using (Html.BeginForm("Edit", "Series", FormMethod.Post, new { id = "form", name = "form" })) - { %> + <% + Html.EnableClientValidation();%> + <% + using (Html.BeginForm("Edit", "Series", FormMethod.Post, new {id = "form", name = "form"})) + {%> <fieldset> <legend>Edit</legend> <div class="editor-label"> - <%: Html.LabelFor(model => model.Path) %> + <%:Html.LabelFor(model => model.Path)%> </div> <div class="editor-field"> - <%: Html.TextBoxFor(model => model.Path) %> - <%: Html.ValidationMessageFor(model => model.Path) %> + <%:Html.TextBoxFor(model => model.Path)%> + <%:Html.ValidationMessageFor(model => model.Path)%> </div> <div class="editor-label"> - <%: Html.LabelFor(model => model.Monitored) %> + <%:Html.LabelFor(model => model.Monitored)%> </div> <div class="editor-field"> - <%: Html.CheckBoxFor(model => model.Monitored) %> - <%: Html.ValidationMessageFor(model => model.Monitored) %> + <%:Html.CheckBoxFor(model => model.Monitored)%> + <%:Html.ValidationMessageFor(model => model.Monitored)%> </div> <div class="editor-label"> - <%: Html.LabelFor(model => model.SeasonFolder) %> + <%:Html.LabelFor(model => model.SeasonFolder)%> </div> <div class="editor-field"> - <%: Html.CheckBoxFor(model => model.SeasonFolder)%> - <%: Html.ValidationMessageFor(model => model.SeasonFolder)%> + <%:Html.CheckBoxFor(model => model.SeasonFolder)%> + <%:Html.ValidationMessageFor(model => model.SeasonFolder)%> </div> <div class="editor-label"> - <%: Html.LabelFor(model => model.QualityProfileId) %> + <%:Html.LabelFor(model => model.QualityProfileId)%> </div> <div class="editor-field"> - <%: Html.DropDownListFor(model => model.QualityProfileId, (SelectList)ViewData["SelectList"])%> - <%: Html.ValidationMessageFor(model => model.QualityProfileId) %> + <%:Html.DropDownListFor(model => model.QualityProfileId, (SelectList) ViewData["SelectList"])%> + <%:Html.ValidationMessageFor(model => model.QualityProfileId)%> </div> <div class="hidden" style="display:none;"> - <%: Html.TextBoxFor(model => model.SeriesId) %> - <%: Html.TextBoxFor(model => model.Title) %> - <%: Html.TextBoxFor(model => model.CleanTitle) %> - <%: Html.TextBoxFor(model => model.Status) %> - <%: Html.TextBoxFor(model => model.Overview) %> - <%: Html.TextBoxFor(model => model.AirsDayOfWeek) %> - <%: Html.TextBoxFor(model => model.AirTimes) %> - <%: Html.TextBoxFor(model => model.Language) %> + <%:Html.TextBoxFor(model => model.SeriesId)%> + <%:Html.TextBoxFor(model => model.Title)%> + <%:Html.TextBoxFor(model => model.CleanTitle)%> + <%:Html.TextBoxFor(model => model.Status)%> + <%:Html.TextBoxFor(model => model.Overview)%> + <%:Html.TextBoxFor(model => model.AirsDayOfWeek)%> + <%:Html.TextBoxFor(model => model.AirTimes)%> + <%:Html.TextBoxFor(model => model.Language)%> </div> <p> <input type="submit" id="save_button" value="Save" disabled="disabled" /> </p> </fieldset> - <% } %> + <% + }%> <div> - <%: Html.ActionLink("Back to Show", "Details", new { seriesId = Model.SeriesId }) %> | - <%: Html.ActionLink("Back to List", "Index") %> - <%: Html.ActionLink("Delete Series", "Delete", new { seriesId = Model.SeriesId })%> + <%:Html.ActionLink("Back to Show", "Details", new {seriesId = Model.SeriesId})%> | + <%:Html.ActionLink("Back to List", "Index")%> + <%:Html.ActionLink("Delete Series", "Delete", new {seriesId = Model.SeriesId})%> </div> <div id="result"></div> diff --git a/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx b/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx index ead246c5f..e2bc6a17a 100644 --- a/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx +++ b/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx @@ -1,25 +1,30 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %> -<%@ Import Namespace="NzbDrone.Core.Repository" %> <div id="searchResults"> <fieldset> <legend>Search Results</legend> - <% if (Model.Count == 0) - { %> + <% + if (Model.Count == 0) + {%> <b>No results found for the series name</b> - <% } - %> - <% int r = 0; %> - <% foreach (var result in Model) - { %> - <%: Html.RadioButton("selectedSeries", result.TvDbId, r ==0, new { @class="searchRadio examplePart", id="searchRadio_" + r }) %> + <% + } +%> + <% + int r = 0;%> + <% + foreach (var result in Model) + {%> + <%:Html.RadioButton("selectedSeries", result.TvDbId, r == 0, + new {@class = "searchRadio examplePart", id = "searchRadio_" + r})%> <b> <%:result.TvDbName + " (" + result.FirstAired.ToShortDateString()%>) - <%: Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style="display:none" }) %> - <% - - r++;%> + <%:Html.TextBox(result.TvDbName + "_text", result.TvDbName, + new {id = result.TvDbId + "_text", style = "display:none"})%> + <% + + r++;%> <br /> <% - } %> + }%> </fieldset> </div> diff --git a/NzbDrone.Web/Views/Series/SubMenu.ascx b/NzbDrone.Web/Views/Series/SubMenu.ascx index d7ddd8ebb..cfa5edc81 100644 --- a/NzbDrone.Web/Views/Series/SubMenu.ascx +++ b/NzbDrone.Web/Views/Series/SubMenu.ascx @@ -1,12 +1,21 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %> <%@ Import Namespace="NzbDrone.Web.Controllers" %> -<% Html.Telerik().Menu().Name("telerikGrid").Items(items => - { - items.Add().Text("Add Series") - .Items(subItem => subItem.Add().Text("New Series").Action<AddSeriesController>(c => c.AddNew())) - .Items(subItem => subItem.Add().Text("Existing Series").Action<AddSeriesController>(c => c.AddExisting())); +<% + Html.Telerik().Menu().Name("telerikGrid").Items(items => + { + items.Add().Text("Add Series") + .Items( + subItem => + subItem.Add().Text("New Series").Action + <AddSeriesController>(c => c.AddNew())) + .Items( + subItem => + subItem.Add().Text("Existing Series").Action + <AddSeriesController>(c => c.AddExisting())); - items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync()); - items.Add().Text("Rename All").Action<SeriesController>(c => c.RenameAll()); - }).Render(); + items.Add().Text("Start RSS Sync").Action<SeriesController>( + c => c.RssSync()); + items.Add().Text("Rename All").Action<SeriesController>( + c => c.RenameAll()); + }).Render(); %> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/index.aspx b/NzbDrone.Web/Views/Series/index.aspx index d103bd73c..a72599ec3 100644 --- a/NzbDrone.Web/Views/Series/index.aspx +++ b/NzbDrone.Web/Views/Series/index.aspx @@ -1,35 +1,33 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NzbDrone.Core.Repository.Series>>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> -<%@ Import Namespace="System.Globalization" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Series </asp:Content> <asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server"> <% Html.RenderPartial("SubMenu"); - %> +%> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Html.Telerik().Grid(Model) - .Name("Grid") - .Columns(columns => - { - columns.Template(c => - { - %> - <%:Html.ActionLink(c.Title??"New Series", "Details", new {seriesId =c.SeriesId}) %> + .Name("Grid") + .Columns(columns => + { + columns.Template(c => + { +%> + <%:Html.ActionLink(c.Title ?? "New Series", + "Details", + new {seriesId = c.SeriesId})%> <% - }).Title("Title"); - columns.Bound(o => o.Seasons.Count).Title("Seasons"); - columns.Bound(o => o.QualityProfile.Name).Title("Quality"); - columns.Bound(o => o.Status); - columns.Bound(o => o.AirsDayOfWeek); - columns.Bound(o => o.Path); - - }) - .Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(false)) - .Render(); - %> + }).Title("Title"); + columns.Bound(o => o.Seasons.Count).Title("Seasons"); + columns.Bound(o => o.QualityProfile.Name).Title("Quality"); + columns.Bound(o => o.Status); + columns.Bound(o => o.AirsDayOfWeek); + columns.Bound(o => o.Path); + }) + .Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(false)) + .Render(); +%> </asp:Content> diff --git a/NzbDrone.Web/Views/Settings/Downloads.ascx b/NzbDrone.Web/Views/Settings/Downloads.ascx index 1763d6021..c3aa27bde 100644 --- a/NzbDrone.Web/Views/Settings/Downloads.ascx +++ b/NzbDrone.Web/Views/Settings/Downloads.ascx @@ -43,10 +43,12 @@ }); </script> - <% Html.EnableClientValidation(); %> + <% + Html.EnableClientValidation();%> -<% using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> +<% + using (Html.BeginForm("SaveDownloads", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> <%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%> <fieldset> @@ -67,39 +69,39 @@ <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SyncFrequency) %></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SyncFrequency)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SyncFrequency)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SyncFrequency)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SyncFrequency)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SyncFrequency)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.DownloadPropers)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.DownloadPropers)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.DownloadPropers)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.DownloadPropers)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.DownloadPropers)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.DownloadPropers)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.Retention)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.Retention)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.Retention)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.Retention)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.Retention)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.Retention)%></div> </div> </fieldset> <div> <div> - <b><%= Html.LabelFor(m => m.UseBlackHole) %></b> + <b><%=Html.LabelFor(m => m.UseBlackHole)%></b> </div> <div> - <%= Html.RadioButtonFor(m => m.UseBlackHole, true, new { @class = "blackhole_radio" }) %>Blackhole + <%=Html.RadioButtonFor(m => m.UseBlackHole, true, new {@class = "blackhole_radio"})%>Blackhole </div> <div> - <%= Html.RadioButtonFor(m => m.UseBlackHole, false, new { @class = "blackhole_radio" })%>SABnzbd + <%=Html.RadioButtonFor(m => m.UseBlackHole, false, new {@class = "blackhole_radio"})%>SABnzbd </div> </div> @@ -109,58 +111,58 @@ <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabHost)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabHost)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabHost)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabHost)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabHost)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabHost)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabPort)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabPort)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabPort)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabPort)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabPort)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabPort)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabApiKey)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabApiKey)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabApiKey)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabApiKey)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabApiKey)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabApiKey)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabUsername)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabUsername)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabUsername)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabUsername)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabUsername)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabUsername)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabPassword)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabPassword)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabPassword)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabPassword)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabPassword)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabPassword)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabTvCategory)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SabTvCategory)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabTvCategory)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SabTvCategory)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabTvCategory)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabTvCategory)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SabTvPriority) %></div> - <div class="config-value"><%= Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SabTvPriority)%></div> + <div class="config-value"><%=Html.DropDownListFor(m => m.SabTvPriority, Model.PrioritySelectList)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SabTvPriority)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SabTvPriority)%></div> </div> </fieldset> </div> @@ -170,10 +172,10 @@ <legend>Blackhole</legend> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.BlackholeDirectory) %></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.BlackholeDirectory)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.BlackholeDirectory)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.BlackholeDirectory)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.BlackholeDirectory)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.BlackholeDirectory)%></div> </div> </fieldset> @@ -181,6 +183,7 @@ <input type="submit" id="save_button" value="Save" disabled="disabled" /> - <% } %> + <% + }%> </fieldset> <div id="result"></div> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/EpisodeSorting.ascx b/NzbDrone.Web/Views/Settings/EpisodeSorting.ascx index 3446f6997..0f13d0d05 100644 --- a/NzbDrone.Web/Views/Settings/EpisodeSorting.ascx +++ b/NzbDrone.Web/Views/Settings/EpisodeSorting.ascx @@ -24,10 +24,12 @@ } </script> - <% Html.EnableClientValidation(); %> + <% + Html.EnableClientValidation();%> -<% using (Html.BeginForm("SaveEpisodeSorting", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> +<% + using (Html.BeginForm("SaveEpisodeSorting", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> <%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%> <fieldset> @@ -35,92 +37,93 @@ <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.ShowName)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.ShowName)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.ShowName)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.ShowName)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.ShowName)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.ShowName)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.EpisodeName)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.EpisodeName)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.EpisodeName)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.EpisodeName)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.EpisodeName)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.EpisodeName)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.ReplaceSpaces)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.ReplaceSpaces)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.ReplaceSpaces)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.ReplaceSpaces)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.ReplaceSpaces)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.ReplaceSpaces)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.AppendQuality)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.AppendQuality)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.AppendQuality)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.AppendQuality)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.AppendQuality)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.AppendQuality)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.UseAirByDate)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.UseAirByDate)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.UseAirByDate)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.UseAirByDate)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.UseAirByDate)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.UseAirByDate)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SeasonFolders)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.SeasonFolders)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SeasonFolders)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.SeasonFolders)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SeasonFolders)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeasonFolders)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SeasonFolderFormat)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.SeasonFolderFormat)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SeasonFolderFormat)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.SeasonFolderFormat)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SeasonFolderFormat)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeasonFolderFormat)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.SeparatorStyle) %></div> - <div class="config-value"><%= Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.SeparatorStyle)%></div> + <div class="config-value"><%=Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.SeparatorStyle)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.SeparatorStyle)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.NumberStyle) %></div> - <div class="config-value"><%= Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.NumberStyle)%></div> + <div class="config-value"><%=Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.NumberStyle)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.NumberStyle)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.MultiEpisodeStyle) %></div> - <div class="config-value"><%= Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.MultiEpisodeStyle)%></div> + <div class="config-value"><%=Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.MultiEpisodeStyle)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.MultiEpisodeStyle)%></div> </div> <input type="submit" id="save_button" value="Save" disabled="disabled" /> - <% } %> + <% + }%> </fieldset> <div id="result"></div> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/General.ascx b/NzbDrone.Web/Views/Settings/General.ascx index 521b32dd1..706ebd794 100644 --- a/NzbDrone.Web/Views/Settings/General.ascx +++ b/NzbDrone.Web/Views/Settings/General.ascx @@ -24,23 +24,29 @@ } </script> -<% using (Html.BeginForm("SaveGeneral", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> -<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %> +<% + using (Html.BeginForm("SaveGeneral", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> +<%:Html.ValidationSummary(true, + "Unable to save your settings. Please correct the errors and try again.")%> <fieldset> <legend>General</legend> <div style="padding-top: 10px;"> <div style="padding-left: 7px; margin-bottom: 5px;"> - <a id="addItem" style="text-decoration:none;" href="<%: Url.Action("AddRootDir", "Settings") %>"> + <a id="addItem" style="text-decoration:none;" href="<%:Url.Action("AddRootDir", "Settings")%>"> <img src="../Content/Images/Plus.png" alt="Add New Profile" /> <h4 style="margin-left: 3px; display: inline; color: Black;">Add New Root Directory</h4></a> </div> <div id="root-dirs"> - <%foreach (var item in Model.Directories) { %> - <% Html.RenderPartial("RootDir", item); %> - <% } %> + <% + foreach (var item in Model.Directories) + {%> + <% + Html.RenderPartial("RootDir", item);%> + <% + }%> </div> </div> @@ -48,7 +54,9 @@ <input type="submit" id="save_button" value="Save" disabled="disabled" /> </p> </fieldset> -<% } Html.EndForm();%> +<% + } + Html.EndForm();%> <div id="result"></div> <script type="text/javascript"> diff --git a/NzbDrone.Web/Views/Settings/Index.aspx b/NzbDrone.Web/Views/Settings/Index.aspx index a7e8d1997..94128dffa 100644 --- a/NzbDrone.Web/Views/Settings/Index.aspx +++ b/NzbDrone.Web/Views/Settings/Index.aspx @@ -6,11 +6,13 @@ </asp:Content> <asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server"> - <% Html.RenderPartial("SubMenu"); %> + <% + Html.RenderPartial("SubMenu");%> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script> - <% Html.RenderPartial(ViewData["viewName"].ToString()); %> + <% + Html.RenderPartial(ViewData["viewName"].ToString());%> </asp:Content> diff --git a/NzbDrone.Web/Views/Settings/Indexers.ascx b/NzbDrone.Web/Views/Settings/Indexers.ascx index 7964b84dd..bc1fc7c3d 100644 --- a/NzbDrone.Web/Views/Settings/Indexers.ascx +++ b/NzbDrone.Web/Views/Settings/Indexers.ascx @@ -59,81 +59,90 @@ }); </script> -<% using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> -<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %> +<% + using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> +<%:Html.ValidationSummary(true, + "Unable to save your settings. Please correct the errors and try again.")%> <fieldset> <legend>Indexers</legend> <ul id="sortable"> - <%for (int i = 0; i < Model.Indexers.Count(); i++){%> - <li class="ui-state-default" id="<%= i %>"> - <%= Html.CheckBoxFor(c => c.Indexers[i].Enabled) %><%= Html.DisplayTextFor(c => c.Indexers[i].IndexerName) %></li> - <%}%> + <% + for (int i = 0; i < Model.Indexers.Count(); i++) + {%> + <li class="ui-state-default" id="<%=i%>"> + <%=Html.CheckBoxFor(c => c.Indexers[i].Enabled)%><%=Html.DisplayTextFor(c => c.Indexers[i].IndexerName)%></li> + <% + }%> </ul> - <%for (int i = 0; i < Model.Indexers.Count(); i++){%> - <%= Html.TextBoxFor(m => m.Indexers[i].IndexerName, new { @style = "display:none" })%> - <%= Html.TextBoxFor(m => m.Indexers[i].Order, new { @style = "display:none" })%> - <%= Html.TextBoxFor(m => m.Indexers[i].RssUrl, new { @style = "display:none" })%> - <%= Html.TextBoxFor(m => m.Indexers[i].ApiUrl, new { @style = "display:none" })%> - <%}%> + <% + for (int i = 0; i < Model.Indexers.Count(); i++) + {%> + <%=Html.TextBoxFor(m => m.Indexers[i].IndexerName, new {@style = "display:none"})%> + <%=Html.TextBoxFor(m => m.Indexers[i].Order, new {@style = "display:none"})%> + <%=Html.TextBoxFor(m => m.Indexers[i].RssUrl, new {@style = "display:none"})%> + <%=Html.TextBoxFor(m => m.Indexers[i].ApiUrl, new {@style = "display:none"})%> + <% + }%> <%--NZBMatrix--%> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbMatrixUsername) %> + <%=Html.LabelFor(m => m.NzbMatrixUsername)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbMatrixUsername)%> - <%= Html.ValidationMessageFor(m => m.NzbMatrixUsername)%> + <%=Html.TextBoxFor(m => m.NzbMatrixUsername)%> + <%=Html.ValidationMessageFor(m => m.NzbMatrixUsername)%> </div> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbMatrixApiKey) %> + <%=Html.LabelFor(m => m.NzbMatrixApiKey)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbMatrixApiKey)%> - <%= Html.ValidationMessageFor(m => m.NzbMatrixApiKey)%> + <%=Html.TextBoxFor(m => m.NzbMatrixApiKey)%> + <%=Html.ValidationMessageFor(m => m.NzbMatrixApiKey)%> </div> <br /> <%--NZBs.Org--%> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbsOrgUId) %> + <%=Html.LabelFor(m => m.NzbsOrgUId)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbsOrgUId)%> - <%= Html.ValidationMessageFor(m => m.NzbsOrgUId)%> + <%=Html.TextBoxFor(m => m.NzbsOrgUId)%> + <%=Html.ValidationMessageFor(m => m.NzbsOrgUId)%> </div> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbsOrgHash) %> + <%=Html.LabelFor(m => m.NzbsOrgHash)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbsOrgHash)%> - <%= Html.ValidationMessageFor(m => m.NzbsOrgHash)%> + <%=Html.TextBoxFor(m => m.NzbsOrgHash)%> + <%=Html.ValidationMessageFor(m => m.NzbsOrgHash)%> </div> <br /> <%--NZBsrus--%> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbsrusUId) %> + <%=Html.LabelFor(m => m.NzbsrusUId)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbsrusUId)%> - <%= Html.ValidationMessageFor(m => m.NzbsrusUId)%> + <%=Html.TextBoxFor(m => m.NzbsrusUId)%> + <%=Html.ValidationMessageFor(m => m.NzbsrusUId)%> </div> <div class="editor-label"> - <%= Html.LabelFor(m => m.NzbsrusHash) %> + <%=Html.LabelFor(m => m.NzbsrusHash)%> </div> <div class="editor-field"> - <%= Html.TextBoxFor(m => m.NzbsrusHash)%> - <%= Html.ValidationMessageFor(m => m.NzbsrusHash)%> + <%=Html.TextBoxFor(m => m.NzbsrusHash)%> + <%=Html.ValidationMessageFor(m => m.NzbsrusHash)%> </div> <br /> <input type="submit" id="save_button" value="Save" disabled="disabled" /> </fieldset> -<% } %> +<% + }%> <div id="result"></div> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Notifications.ascx b/NzbDrone.Web/Views/Settings/Notifications.ascx index bd6ce9c16..3d6aa96b8 100644 --- a/NzbDrone.Web/Views/Settings/Notifications.ascx +++ b/NzbDrone.Web/Views/Settings/Notifications.ascx @@ -24,10 +24,12 @@ } </script> - <% Html.EnableClientValidation(); %> + <% + Html.EnableClientValidation();%> -<% using (Html.BeginForm("SaveNotifications", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> +<% + using (Html.BeginForm("SaveNotifications", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> <%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%> <fieldset> @@ -37,129 +39,130 @@ <legend>XBMC</legend> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcEnabled)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcEnabled)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcEnabled)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcEnabled)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcEnabled)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcEnabled)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcNotifyOnGrab)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnGrab)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnGrab)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnGrab)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcNotifyOnDownload)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnDownload)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnDownload)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnDownload)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcNotifyOnRename)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcNotifyOnRename)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcNotifyOnRename)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotifyOnRename)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotifyOnRename)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcNotificationImage)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcNotificationImage)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcNotificationImage)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcNotificationImage)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcNotificationImage)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcNotificationImage)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcDisplayTime)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.XbmcDisplayTime)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcDisplayTime)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.XbmcDisplayTime)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcDisplayTime)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcDisplayTime)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcUpdateOnDownload)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcUpdateOnDownload)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcUpdateOnDownload)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUpdateOnDownload)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcUpdateOnRename)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcUpdateOnRename)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcUpdateOnRename)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcUpdateOnRename)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUpdateOnRename)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcFullUpdate)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcFullUpdate)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcFullUpdate)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcFullUpdate)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcFullUpdate)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcFullUpdate)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcCleanOnDownload)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcCleanOnDownload)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcCleanOnDownload)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcCleanOnDownload)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcCleanOnDownload)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcCleanOnRename)%></div> - <div class="config-value"><%= Html.CheckBoxFor(m => m.XbmcCleanOnRename)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcCleanOnRename)%></div> + <div class="config-value"><%=Html.CheckBoxFor(m => m.XbmcCleanOnRename)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcCleanOnRename)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcCleanOnRename)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcHosts)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.XbmcHosts)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcHosts)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.XbmcHosts)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcHosts)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcHosts)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcUsername)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.XbmcUsername)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcUsername)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.XbmcUsername)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcUsername)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcUsername)%></div> </div> <div class="config-section"> <div class="config-group"> - <div class="config-title"><%= Html.LabelFor(m => m.XbmcPassword)%></div> - <div class="config-value"><%= Html.TextBoxFor(m => m.XbmcPassword)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.XbmcPassword)%></div> + <div class="config-value"><%=Html.TextBoxFor(m => m.XbmcPassword)%></div> </div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.XbmcPassword)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.XbmcPassword)%></div> </div> </fieldset> <input type="submit" id="save_button" value="Save" disabled="disabled" /> - <% } %> + <% + }%> </fieldset> <div id="result"></div> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Quality.ascx b/NzbDrone.Web/Views/Settings/Quality.ascx index e33c63c52..e98c4f3b9 100644 --- a/NzbDrone.Web/Views/Settings/Quality.ascx +++ b/NzbDrone.Web/Views/Settings/Quality.ascx @@ -1,6 +1,4 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Web.Models.QualityModel>" %> -<%@ Import Namespace="NzbDrone.Core.Repository.Quality" %> -<%@ Import Namespace="NzbDrone.Web.Helpers" %> <script type="text/javascript"> $(document).ready(function () { @@ -27,10 +25,12 @@ </script> - <% Html.EnableClientValidation(); %> + <% + Html.EnableClientValidation();%> - <% using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" })) - {%> + <% + using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new {id = "form", name = "form"})) + {%> <fieldset> <legend>Quality</legend> <%--<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>--%> @@ -39,9 +39,9 @@ <div id="defaultQualityDiv" style="float: left; margin: 30px;"> <div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;"> - <div class="config-title"><%= Html.LabelFor(m => m.DefaultQualityProfileId)%></div> - <div class="config-value"><%: Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)%></div> - <div class="config-validation"><%= Html.ValidationMessageFor(m => m.DefaultQualityProfileId)%></div> + <div class="config-title"><%=Html.LabelFor(m => m.DefaultQualityProfileId)%></div> + <div class="config-value"><%:Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(m => m.DefaultQualityProfileId)%></div> </div> </div> </div> @@ -49,15 +49,19 @@ <div id="leftSide" style="width:35%;"> <div style="padding-top: 10px;"> <div style="padding-left: 7px; margin-bottom: 5px;"> - <a id="addItem" style="text-decoration:none;" href="<%: Url.Action("AddUserProfile", "Settings") %>"> + <a id="addItem" style="text-decoration:none;" href="<%:Url.Action("AddUserProfile", "Settings")%>"> <img src="../../Content/Images/Plus.png" alt="Add New Profile" /> <h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a> </div> <div id="user-profiles"> - <%foreach (var item in Model.UserProfiles) { %> - <% Html.RenderPartial("UserProfileSection", item); %> - <% } %> + <% + foreach (var item in Model.UserProfiles) + {%> + <% + Html.RenderPartial("UserProfileSection", item);%> + <% + }%> </div> </div> @@ -68,7 +72,8 @@ </fieldset> - <%}%> + <% + }%> <div id="result"></div> <script type="text/javascript"> diff --git a/NzbDrone.Web/Views/Settings/RootDir.ascx b/NzbDrone.Web/Views/Settings/RootDir.ascx index eed184e1b..def2bd947 100644 --- a/NzbDrone.Web/Views/Settings/RootDir.ascx +++ b/NzbDrone.Web/Views/Settings/RootDir.ascx @@ -1,10 +1,11 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.RootDir>" %> <%@ Import Namespace="NzbDrone.Web.Helpers" %> -<% using (Html.BeginCollectionItem("Directories")) - { %> <% - var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); - //string sortable1 = String.Format("{0}_sortable1", idClean); + using (Html.BeginCollectionItem("Directories")) + {%> +<% + var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); + //string sortable1 = String.Format("{0}_sortable1", idClean); %> <style type="text/css"> .root_dir_text @@ -16,16 +17,17 @@ <fieldset style="width: 350px; height: 16px; margin: 0px; margin-top: 0px; border-color: #CCCCCD; -khtml-border-radius: 8px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px;"> <div> - <%: Html.TextBoxFor(m => m.Path, new { @class="root_dir_text" }) %> + <%:Html.TextBoxFor(m => m.Path, new {@class = "root_dir_text"})%> <a href="#" class="deleteRow"> <img src="../Content/Images/X.png" alt="Delete" /></a> </div> <div> - <%: Html.ValidationMessageFor(m => m.Path) %> + <%:Html.ValidationMessageFor(m => m.Path)%> </div> <div class="hiddenProfileDetails"> - <%= Html.TextBoxFor(x => x.Id, new { @style = "display:none" })%> + <%=Html.TextBoxFor(x => x.Id, new {@style = "display:none"})%> </div> </fieldset> </div> -<% } %> \ No newline at end of file +<% + }%> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/SubMenu.ascx b/NzbDrone.Web/Views/Settings/SubMenu.ascx index 8a2dfb4c9..49cdfff10 100644 --- a/NzbDrone.Web/Views/Settings/SubMenu.ascx +++ b/NzbDrone.Web/Views/Settings/SubMenu.ascx @@ -1,7 +1,5 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %> -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> - <% Html.Telerik().Menu().Name("Menu").Items(items => { @@ -9,9 +7,11 @@ items.Add().Text("Indexers").Action("Indexers", "Settings"); items.Add().Text("Downloads").Action("Downloads", "Settings"); items.Add().Text("Quality").Action("Quality", "Settings"); - items.Add().Text("Episode Sorting").Action("EpisodeSorting", "Settings"); - items.Add().Text("Notifications").Action("Notifications", "Settings"); + items.Add().Text("Episode Sorting").Action("EpisodeSorting", + "Settings"); + items.Add().Text("Notifications").Action("Notifications", + "Settings"); }).Render(); - %> +%> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/UserProfileSection.ascx b/NzbDrone.Web/Views/Settings/UserProfileSection.ascx index 31a4132e0..2d94c6022 100644 --- a/NzbDrone.Web/Views/Settings/UserProfileSection.ascx +++ b/NzbDrone.Web/Views/Settings/UserProfileSection.ascx @@ -1,20 +1,21 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.Quality.QualityProfile>" %> -<%@ Import Namespace="NzbDrone.Web.Helpers" %> <%@ Import Namespace="NzbDrone.Core.Repository.Quality" %> +<%@ Import Namespace="NzbDrone.Web.Helpers" %> -<% using (Html.BeginCollectionItem("UserProfiles")) - { %> +<% + using (Html.BeginCollectionItem("UserProfiles")) + {%> <% - var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); + var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); - string sortable1 = String.Format("{0}_sortable1", idClean); - string sortable2 = String.Format("{0}_sortable2", idClean); - string allowedStringName = String.Format("{0}_AllowedString", idClean); - string connectedSortable = String.Format("connected{0}", idClean); - string title = String.Format("{0}_Title", idClean); - string nameBox = String.Format("{0}_Name", idClean); - %> + string sortable1 = String.Format("{0}_sortable1", idClean); + string sortable2 = String.Format("{0}_sortable2", idClean); + string allowedStringName = String.Format("{0}_AllowedString", idClean); + string connectedSortable = String.Format("connected{0}", idClean); + string title = String.Format("{0}_Title", idClean); + string nameBox = String.Format("{0}_Name", idClean); +%> <style type="text/css"> .sortable1, .sortable2 { list-style-type: none; margin-right: 10px; background: #eee; padding-left: 5px; padding-right: 5px; padding-top: 0px; padding-bottom: 6px; width: 107px; margin-bottom: 3px; } @@ -30,19 +31,19 @@ <script type="text/javascript"> $(function () { - $("#<%= sortable1 %>, #<%= sortable2 %>").sortable({ - connectWith: ".<%= connectedSortable %>", + $("#<%=sortable1%>, #<%=sortable2%>").sortable({ + connectWith: ".<%=connectedSortable%>", placeholder: "ui-state-highlight", dropOnEmpty: true, create: function (event, ui) { - var order = $('#<%= sortable1 %>').sortable("toArray"); - $("#<%= allowedStringName %>").val(order); + var order = $('#<%=sortable1%>').sortable("toArray"); + $("#<%=allowedStringName%>").val(order); }, update: function (event, ui) { - var order = $('#<%= sortable1 %>').sortable("toArray"); - $("#<%= allowedStringName %>").val(order); + var order = $('#<%=sortable1%>').sortable("toArray"); + $("#<%=allowedStringName%>").val(order); } }).disableSelection(); @@ -54,74 +55,85 @@ <fieldset style="width:275px; margin:5px; margin-top: 0px; border-color:#CCCCCD"> <div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;"> - <h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="<%= title %>"><%= Html.DisplayTextFor(m => m.Name) %></h2> + <h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="<%=title%>"><%=Html.DisplayTextFor(m => m.Name)%></h2> <a href="#" class="deleteRow"><img src="../../Content/Images/X.png" alt="Delete" /></a> </div> <div class="config-group" style="width: 250px; margin-bottom: 5px; margin-left: 5px;"> - <div class="config-title"><%= Html.LabelFor(x => x.Name)%></div> - <div class="config-value"><%= Html.TextBoxFor(x => x.Name)%></div> - <div class="config-validation"><%= Html.ValidationMessageFor(x => x.Name)%></div> + <div class="config-title"><%=Html.LabelFor(x => x.Name)%></div> + <div class="config-value"><%=Html.TextBoxFor(x => x.Name)%></div> + <div class="config-validation"><%=Html.ValidationMessageFor(x => x.Name)%></div> </div> <div id="sortablesDiv" style="margin: 0px;"> <div class="allowedQualities"> <h4 class="sortableHeader">Allowed</h4> - <ul id="<%= sortable1 %>" class="<%= connectedSortable %> sortable1"> - <% if (Model.Allowed != null) { %> - <%for (int i = 0; i < Model.Allowed.Count(); i++){%> - <li class="ui-state-default" id="<%= Model.Allowed[i].ToString() %>"> + <ul id="<%=sortable1%>" class="<%=connectedSortable%> sortable1"> + <% + if (Model.Allowed != null) + {%> + <% + for (int i = 0; i < Model.Allowed.Count(); i++) + {%> + <li class="ui-state-default" id="<%=Model.Allowed[i].ToString()%>"> <%=Html.RadioButtonFor(x => x.Cutoff, Model.Allowed[i])%> - <%= Html.DisplayTextFor(c => c.Allowed[i]) %> + <%=Html.DisplayTextFor(c => c.Allowed[i])%> </li> - <%}%> - <%}%> + <% + }%> + <% + }%> </ul> </div> <div class="otherQualities"> <h4 class="sortableHeader">Not-Allowed</h4> - <ul id="<%= sortable2 %>" class="<%= connectedSortable %> sortable2"> - <% var qualitiesList = (List<QualityTypes>) ViewData["Qualities"]; %> + <ul id="<%=sortable2%>" class="<%=connectedSortable%> sortable2"> + <% + var qualitiesList = (List<QualityTypes>) ViewData["Qualities"];%> - <%for (int i = 0; i < qualitiesList.Count(); i++){%> + <% + for (int i = 0; i < qualitiesList.Count(); i++) + {%> <% - //Skip Unknown and any item that is in the allowed list - if (qualitiesList[i].ToString() == "Unknown") - continue; - - if (Model.Allowed != null) - { - if (Model.Allowed.Contains(qualitiesList[i])) - continue; - } - %> - - <li class="ui-state-default" id="<%= qualitiesList[i].ToString() %>"> + //Skip Unknown and any item that is in the allowed list + if (qualitiesList[i].ToString() == "Unknown") + continue; + + if (Model.Allowed != null) + { + if (Model.Allowed.Contains(qualitiesList[i])) + continue; + } +%> + + <li class="ui-state-default" id="<%=qualitiesList[i].ToString()%>"> <%=Html.RadioButtonFor(x => x.Cutoff, qualitiesList[i])%> - <%= Html.Label(qualitiesList[i].ToString()) %> + <%=Html.Label(qualitiesList[i].ToString())%> </li> - <% } %> + <% + }%> </ul> </div> </div> - <%= Html.ValidationMessageFor(x => x.Cutoff) %> + <%=Html.ValidationMessageFor(x => x.Cutoff)%> <div class="hiddenProfileDetails"> - <%= Html.TextBoxFor(x => x.QualityProfileId, new { @style = "display:none" })%> - <%= Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" })%> - <%= Html.TextBoxFor(m => m.AllowedString, new { @style = "display:none" })%> + <%=Html.TextBoxFor(x => x.QualityProfileId, new {@style = "display:none"})%> + <%=Html.CheckBoxFor(x => x.UserProfile, new {@style = "display:none"})%> + <%=Html.TextBoxFor(m => m.AllowedString, new {@style = "display:none"})%> </div> </fieldset> </div> <script type="text/javascript"> - $("#<%: nameBox %>").keyup(function () { + $("#<%:nameBox%>").keyup(function () { var value = $(this).val(); - $("#<%= title %>").text(value); + $("#<%=title%>").text(value); }).keyup(); </script> -<% } %> \ No newline at end of file +<% + }%> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/Error.aspx b/NzbDrone.Web/Views/Shared/Error.aspx index 515fe7e5d..26b89d445 100644 --- a/NzbDrone.Web/Views/Shared/Error.aspx +++ b/NzbDrone.Web/Views/Shared/Error.aspx @@ -1,6 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %> - -<%@ Import Namespace="NLog" %> <asp:Content ID="errorTitle" ContentPlaceHolderID="TitleContent" runat="server"> EPIC FAIL!!! </asp:Content> diff --git a/NzbDrone.Web/Views/Shared/Footer.ascx b/NzbDrone.Web/Views/Shared/Footer.ascx index 73a70668e..7a4bb3ac0 100644 --- a/NzbDrone.Web/Views/Shared/Footer.ascx +++ b/NzbDrone.Web/Views/Shared/Footer.ascx @@ -17,4 +17,4 @@ <%--<div>RSS Sync: <span style="display:none" id="syncTimer" class="timer"><%: ViewData["RssTimer"] %></span></div>--%> <div>RSS Sync: </div> -<div style="display:none" id="syncTimer" class="timer"><%: ViewData["RssTimer"] %></div> \ No newline at end of file +<div style="display:none" id="syncTimer" class="timer"><%:ViewData["RssTimer"]%></div> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master index 67f33a01c..fadf97e68 100644 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ b/NzbDrone.Web/Views/Shared/Site.Master @@ -1,7 +1,5 @@ <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - <%@ Import Namespace="Helpers" %> -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head runat="server"> @@ -10,10 +8,10 @@ <title>NZBDrone <% Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css") - .Add("telerik.sitefinity.css") - .Add("notibar.css")) - .Render(); - %> + .Add("telerik.sitefinity.css") + .Add("notibar.css")) + .Render(); +%> @@ -27,11 +25,11 @@
Scanning Series Folder... @@ -50,14 +49,15 @@
-<% Html.Telerik().ScriptRegistrar().Scripts( - c => c.Add("jquery-ui-1.8.8.min.js") - .Add("jquery.form.js") - .Add("jquery.jgrowl.js") - .Add("Notification.js") - .Add("jquery-tgc-countdown-1.0.js") - .Add("MicrosoftAjax.js") - .Add("MicrosoftMvcValidation.js")) - .Render(); +<% + Html.Telerik().ScriptRegistrar().Scripts( + c => c.Add("jquery-ui-1.8.8.min.js") + .Add("jquery.form.js") + .Add("jquery.jgrowl.js") + .Add("Notification.js") + .Add("jquery-tgc-countdown-1.0.js") + .Add("MicrosoftAjax.js") + .Add("MicrosoftMvcValidation.js")) + .Render(); %> diff --git a/NzbDrone.Web/Views/Upcoming/Index.aspx b/NzbDrone.Web/Views/Upcoming/Index.aspx index c668fb123..1e87c184b 100644 --- a/NzbDrone.Web/Views/Upcoming/Index.aspx +++ b/NzbDrone.Web/Views/Upcoming/Index.aspx @@ -1,8 +1,5 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> - -<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="NzbDrone.Web.Models" %> -<%@ Import Namespace="NzbDrone.Core.Repository" %>