From 8b484601f61d4a1b7d4ae41eb6ba48597afdc9fd Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 19 Jun 2011 13:43:47 -0700 Subject: [PATCH] Removed all warnings --- Migrator.net/Migrator.Providers/Dialect.cs | 2 +- .../UpcomingEpisodesProviderTest.cs | 1 - NzbDrone.Core.Test/dbBenchmark.cs | 4 +-- NzbDrone.Core/Model/Quality.cs | 26 +++++++++++++++++++ .../Controllers/AddSeriesController.cs | 2 +- .../Controllers/DirectoryController.cs | 2 +- NzbDrone.Web/NzbDrone.Web.csproj | 4 --- NzbDrone.Web/Views/Series/Details.cshtml | 5 ++-- 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Migrator.net/Migrator.Providers/Dialect.cs b/Migrator.net/Migrator.Providers/Dialect.cs index 6c1a2fabf..16f4426a6 100644 --- a/Migrator.net/Migrator.Providers/Dialect.cs +++ b/Migrator.net/Migrator.Providers/Dialect.cs @@ -166,7 +166,7 @@ namespace Migrator.Providers public virtual string Default(object defaultValue) { - if (defaultValue is String && defaultValue == String.Empty) + if (defaultValue is String && defaultValue.ToString() == String.Empty) { defaultValue = "''"; } diff --git a/NzbDrone.Core.Test/UpcomingEpisodesProviderTest.cs b/NzbDrone.Core.Test/UpcomingEpisodesProviderTest.cs index f6a5f9947..fdd982e83 100644 --- a/NzbDrone.Core.Test/UpcomingEpisodesProviderTest.cs +++ b/NzbDrone.Core.Test/UpcomingEpisodesProviderTest.cs @@ -18,7 +18,6 @@ namespace NzbDrone.Core.Test private Episode tomorrow; private Episode twoDays; private Episode sevenDays; - private Episode eightDays; [SetUp] public new void Setup() diff --git a/NzbDrone.Core.Test/dbBenchmark.cs b/NzbDrone.Core.Test/dbBenchmark.cs index 60eb37b88..3b8b3800b 100644 --- a/NzbDrone.Core.Test/dbBenchmark.cs +++ b/NzbDrone.Core.Test/dbBenchmark.cs @@ -211,7 +211,7 @@ namespace NzbDrone.Core.Test [Test] - public void get_season_count_x5000() + public void get_season_count_x500() { var mocker = new AutoMoqer(); mocker.SetConstant(db); @@ -225,7 +225,7 @@ namespace NzbDrone.Core.Test Console.WriteLine("Starting Test"); var sw = Stopwatch.StartNew(); - for (int i = 0; i < 5000; i++) + for (int i = 0; i < 500; i++) { provider.GetSeasons(random.Next(1, 10)).Should().HaveSameCount(seasonsNumbers); } diff --git a/NzbDrone.Core/Model/Quality.cs b/NzbDrone.Core/Model/Quality.cs index 95ea38efb..28b0b4012 100644 --- a/NzbDrone.Core/Model/Quality.cs +++ b/NzbDrone.Core/Model/Quality.cs @@ -85,5 +85,31 @@ namespace NzbDrone.Core.Model return result; } + + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hash = 17; + hash = hash * 23 + Proper.GetHashCode(); + hash = hash * 23 + QualityType.GetHashCode(); + return hash; + } + } + + public bool Equals(Quality other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Equals(other.QualityType, QualityType) && other.Proper.Equals(Proper); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Quality)) return false; + return Equals((Quality) obj); + } } } diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 4737ebca7..6431d35da 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -139,7 +139,7 @@ namespace NzbDrone.Web.Controllers return new JsonResult { Data = "ok" }; } - catch (Exception ex) + catch (Exception) { return new JsonResult { Data = "failed" }; } diff --git a/NzbDrone.Web/Controllers/DirectoryController.cs b/NzbDrone.Web/Controllers/DirectoryController.cs index c756de335..b7e446d35 100644 --- a/NzbDrone.Web/Controllers/DirectoryController.cs +++ b/NzbDrone.Web/Controllers/DirectoryController.cs @@ -50,7 +50,7 @@ namespace NzbDrone.Web.Controllers return new SelectList(dirs, dirs.FirstOrDefault()); } } - catch(Exception ex) + catch { //Swallow the exceptions so proper JSON is returned to the client (Empty results) } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index e0908cf64..e35bd337a 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -45,10 +45,6 @@ x86 - - False - ..\Libraries\Castle.Core.dll - False ..\Libraries\MVC3\Microsoft.Web.Infrastructure.dll diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 2d03c1c66..a2fb68d53 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -91,8 +91,7 @@ Loading... } - @{var specialSeason = Model.Seasons.Where(s => s == 0).FirstOrDefault();} - @if (specialSeason != null) + @if (Model.Seasons.Any(s => s == 0)) {
@@ -127,7 +126,7 @@ .DataBinding( d => d.Ajax().Select("_AjaxSeasonGrid", "Series", - new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", specialSeason } } + new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", 0 } } )).Render(); } Loading