From e653b41000c2116c555691f866710f2239553322 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 May 2014 16:44:17 -0400 Subject: [PATCH] removed implicit typing from the model project --- .../Configuration/NotificationOptions.cs | 8 ++-- .../Configuration/ServerConfiguration.cs | 2 +- MediaBrowser.Model/Dlna/CodecProfile.cs | 2 +- MediaBrowser.Model/Dlna/ConditionProcessor.cs | 4 +- .../Dlna/ContentFeatureBuilder.cs | 44 +++++++++---------- MediaBrowser.Model/Dlna/DeviceProfile.cs | 22 +++++----- MediaBrowser.Model/Dlna/DlnaMaps.cs | 4 +- .../Dlna/MediaFormatProfileResolver.cs | 12 ++--- MediaBrowser.Model/Drawing/DrawingUtils.cs | 6 +-- .../Entities/DisplayPreferences.cs | 6 +-- .../Web/QueryStringDictionary.cs | 8 ++-- 11 files changed, 59 insertions(+), 59 deletions(-) diff --git a/MediaBrowser.Model/Configuration/NotificationOptions.cs b/MediaBrowser.Model/Configuration/NotificationOptions.cs index 7034bd39e..0ed43ae1e 100644 --- a/MediaBrowser.Model/Configuration/NotificationOptions.cs +++ b/MediaBrowser.Model/Configuration/NotificationOptions.cs @@ -75,14 +75,14 @@ namespace MediaBrowser.Model.Configuration public bool IsEnabled(string type) { - var opt = GetOptions(type); + NotificationOption opt = GetOptions(type); return opt != null && opt.Enabled; } public bool IsServiceEnabled(string service, string notificationType) { - var opt = GetOptions(notificationType); + NotificationOption opt = GetOptions(notificationType); return opt == null || !opt.DisabledServices.Contains(service, StringComparer.OrdinalIgnoreCase); @@ -90,7 +90,7 @@ namespace MediaBrowser.Model.Configuration public bool IsEnabledToMonitorUser(string type, string userId) { - var opt = GetOptions(type); + NotificationOption opt = GetOptions(type); return opt != null && opt.Enabled && !opt.DisabledMonitorUsers.Contains(userId, StringComparer.OrdinalIgnoreCase); @@ -98,7 +98,7 @@ namespace MediaBrowser.Model.Configuration public bool IsEnabledToSendToUser(string type, string userId, UserConfiguration userConfig) { - var opt = GetOptions(type); + NotificationOption opt = GetOptions(type); if (opt != null && opt.Enabled) { diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 36598b245..c19039439 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -271,7 +271,7 @@ namespace MediaBrowser.Model.Configuration EnableRealtimeMonitor = true; - var options = new List + List options = new List { new MetadataOptions(1, 1280) {ItemType = "Book"}, new MetadataOptions(1, 1280) {ItemType = "MusicAlbum"}, diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index 7d7e0057e..61eb2f639 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Model.Dlna public bool ContainsCodec(string codec) { - var codecs = GetCodecs(); + List codecs = GetCodecs(); return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase); } diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 27c4850e8..488d742f5 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -136,7 +136,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - var expected = condition.Value; + string expected = condition.Value; switch (condition.Condition) { @@ -186,7 +186,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - var expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); + TransportStreamTimestamp expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); switch (condition.Condition) { diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 5a6be389d..5309df131 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -17,30 +17,30 @@ namespace MediaBrowser.Model.Dlna int? width, int? height) { - var orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue(); + string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue(); // 0 = native, 1 = transcoded const string orgCi = ";DLNA.ORG_CI=0"; - var flagValue = DlnaFlags.StreamingTransferMode | + DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.DlnaV15; - var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", + string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", FlagsToString(flagValue)); - var mediaProfile = _profile.GetImageMediaProfile(container, + ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container, width, height); - var orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; + string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; if (string.IsNullOrEmpty(orgPn)) { orgPn = GetImageOrgPnValue(container, width, height); } - var contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; + string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); } @@ -55,12 +55,12 @@ namespace MediaBrowser.Model.Dlna TranscodeSeekInfo transcodeSeekInfo) { // first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none - var orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo); + string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo); // 0 = native, 1 = transcoded - var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; + string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - var flagValue = DlnaFlags.StreamingTransferMode | + DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.DlnaV15; @@ -73,22 +73,22 @@ namespace MediaBrowser.Model.Dlna //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK; } - var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", + string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", FlagsToString(flagValue)); - var mediaProfile = _profile.GetAudioMediaProfile(container, + ResponseProfile mediaProfile = _profile.GetAudioMediaProfile(container, audioCodec, audioChannels, audioBitrate); - var orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; + string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; if (string.IsNullOrEmpty(orgPn)) { orgPn = GetAudioOrgPnValue(container, audioBitrate, audioSampleRate, audioChannels); } - var contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; + string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); } @@ -118,12 +118,12 @@ namespace MediaBrowser.Model.Dlna TranscodeSeekInfo transcodeSeekInfo) { // first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none - var orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo); + string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo); // 0 = native, 1 = transcoded - var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; + string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - var flagValue = DlnaFlags.StreamingTransferMode | + DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.DlnaV15; @@ -136,10 +136,10 @@ namespace MediaBrowser.Model.Dlna //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK; } - var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", + string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", FlagsToString(flagValue)); - var mediaProfile = _profile.GetVideoMediaProfile(container, + ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(container, audioCodec, videoCodec, audioBitrate, @@ -154,7 +154,7 @@ namespace MediaBrowser.Model.Dlna packetLength, timestamp); - var orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; + string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn; if (string.IsNullOrEmpty(orgPn)) { @@ -165,14 +165,14 @@ namespace MediaBrowser.Model.Dlna orgPn = (orgPn ?? string.Empty).Split(',').FirstOrDefault(); } - var contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; + string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn; return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); } private string GetImageOrgPnValue(string container, int? width, int? height) { - var format = new MediaFormatProfileResolver() + MediaFormatProfile? format = new MediaFormatProfileResolver() .ResolveImageFormat(container, width, height); @@ -182,7 +182,7 @@ namespace MediaBrowser.Model.Dlna private string GetAudioOrgPnValue(string container, int? audioBitrate, int? audioSampleRate, int? audioChannels) { - var format = new MediaFormatProfileResolver() + MediaFormatProfile? format = new MediaFormatProfileResolver() .ResolveAudioFormat(container, audioBitrate, audioSampleRate, diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index b23ad876c..e0b682e4a 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -174,19 +174,19 @@ namespace MediaBrowser.Model.Dlna return false; } - var containers = i.GetContainers().ToList(); + List containers = i.GetContainers().ToList(); if (containers.Count > 0 && !containers.Contains(container)) { return false; } - var audioCodecs = i.GetAudioCodecs().ToList(); + List audioCodecs = i.GetAudioCodecs().ToList(); if (audioCodecs.Count > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty)) { return false; } - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); return i.Conditions.All(c => conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate)); @@ -204,13 +204,13 @@ namespace MediaBrowser.Model.Dlna return false; } - var containers = i.GetContainers().ToList(); + List containers = i.GetContainers().ToList(); if (containers.Count > 0 && !containers.Contains(container)) { return false; } - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); return i.Conditions.All(c => conditionProcessor.IsImageConditionSatisfied(c, width, height)); @@ -241,25 +241,25 @@ namespace MediaBrowser.Model.Dlna return false; } - var containers = i.GetContainers().ToList(); + List containers = i.GetContainers().ToList(); if (containers.Count > 0 && !containers.Contains(container)) { return false; } - var audioCodecs = i.GetAudioCodecs().ToList(); + List audioCodecs = i.GetAudioCodecs().ToList(); if (audioCodecs.Count > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty)) { return false; } - var videoCodecs = i.GetVideoCodecs().ToList(); + List videoCodecs = i.GetVideoCodecs().ToList(); if (videoCodecs.Count > 0 && !videoCodecs.Contains(videoCodec ?? string.Empty)) { return false; } - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); return i.Conditions.All(c => conditionProcessor.IsVideoConditionSatisfied(c, audioBitrate, audioChannels, @@ -286,13 +286,13 @@ namespace MediaBrowser.Model.Dlna return false; } - var containers = i.GetContainers().ToList(); + List containers = i.GetContainers().ToList(); if (containers.Count > 0 && !containers.Contains(container)) { return false; } - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); return i.Conditions.All(c => conditionProcessor.IsImageConditionSatisfied(c, width, height)); diff --git a/MediaBrowser.Model/Dlna/DlnaMaps.cs b/MediaBrowser.Model/Dlna/DlnaMaps.cs index 0a4069d8f..036c1fc74 100644 --- a/MediaBrowser.Model/Dlna/DlnaMaps.cs +++ b/MediaBrowser.Model/Dlna/DlnaMaps.cs @@ -25,7 +25,7 @@ { if (hasKnownRuntime) { - var orgOp = string.Empty; + string orgOp = string.Empty; // Time-based seeking currently only possible when transcoding orgOp += isDirectStream ? "0" : "1"; @@ -42,7 +42,7 @@ public static string GetImageOrgOpValue() { - var orgOp = string.Empty; + string orgOp = string.Empty; // Time-based seeking currently only possible when transcoding orgOp += "0"; diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index b5f5dd138..3c35ca0f6 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -10,13 +10,13 @@ namespace MediaBrowser.Model.Dlna { if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase)) { - var val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height); + MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height); return val.HasValue ? new List { val.Value } : new List(); } if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase)) { - var val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height); + MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height); return val.HasValue ? new List { val.Value } : new List(); } @@ -50,7 +50,7 @@ namespace MediaBrowser.Model.Dlna if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase)) { - var val = ResolveVideo3GPFormat(videoCodec, audioCodec); + MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec); return val.HasValue ? new List { val.Value } : new List(); } @@ -62,7 +62,7 @@ namespace MediaBrowser.Model.Dlna private IEnumerable ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType) { - var suffix = ""; + string suffix = ""; switch (timestampType) { @@ -74,7 +74,7 @@ namespace MediaBrowser.Model.Dlna break; } - var resolution = "S"; + string resolution = "S"; if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576)) { resolution = "H"; @@ -82,7 +82,7 @@ namespace MediaBrowser.Model.Dlna if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase)) { - var list = new List(); + List list = new List(); list.Add(ValueOf("MPEG_TS_SD_NA" + suffix)); list.Add(ValueOf("MPEG_TS_SD_EU" + suffix)); diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs index 7f679a826..fcc5ddd16 100644 --- a/MediaBrowser.Model/Drawing/DrawingUtils.cs +++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs @@ -30,7 +30,7 @@ /// ImageSize. public static ImageSize Scale(ImageSize size, double scaleFactor) { - var newWidth = size.Width * scaleFactor; + double newWidth = size.Width * scaleFactor; return Resize(size.Width, size.Height, newWidth, null, null, null); } @@ -120,7 +120,7 @@ /// System.Double. private static double GetNewWidth(double currentHeight, double currentWidth, double newHeight) { - var scaleFactor = newHeight; + double scaleFactor = newHeight; scaleFactor /= currentHeight; scaleFactor *= currentWidth; @@ -136,7 +136,7 @@ /// System.Double. private static double GetNewHeight(double currentHeight, double currentWidth, double newWidth) { - var scaleFactor = newWidth; + double scaleFactor = newWidth; scaleFactor /= currentWidth; scaleFactor *= currentHeight; diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs index 2fdab9799..56a2c6194 100644 --- a/MediaBrowser.Model/Entities/DisplayPreferences.cs +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -103,9 +103,9 @@ namespace MediaBrowser.Model.Entities /// public void IncreaseImageSize() { - var newWidth = PrimaryImageWidth / ImageScale; + double newWidth = PrimaryImageWidth / ImageScale; - var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null); + ImageSize size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null); PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageHeight = Convert.ToInt32(size.Height); @@ -116,7 +116,7 @@ namespace MediaBrowser.Model.Entities /// public void DecreaseImageSize() { - var size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale); + ImageSize size = DrawingUtils.Scale(PrimaryImageWidth, PrimaryImageHeight, ImageScale); PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageHeight = Convert.ToInt32(size.Height); diff --git a/MediaBrowser.Model/Web/QueryStringDictionary.cs b/MediaBrowser.Model/Web/QueryStringDictionary.cs index 6b035fa45..b532358ff 100644 --- a/MediaBrowser.Model/Web/QueryStringDictionary.cs +++ b/MediaBrowser.Model/Web/QueryStringDictionary.cs @@ -164,7 +164,7 @@ namespace MediaBrowser.Model.Web throw new ArgumentNullException("value"); } - var paramValue = string.Join(",", value.ToArray()); + string paramValue = string.Join(",", value.ToArray()); Add(name, paramValue); } @@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Web throw new ArgumentNullException("value"); } - var paramValue = string.Join(delimiter, value.ToArray()); + string paramValue = string.Join(delimiter, value.ToArray()); Add(name, paramValue); } @@ -221,7 +221,7 @@ namespace MediaBrowser.Model.Web /// System.String. public string GetQueryString() { - var queryParams = this.Select(i => string.Format("{0}={1}", i.Key, GetEncodedValue(i.Value))).ToArray(); + string[] queryParams = this.Select(i => string.Format("{0}={1}", i.Key, GetEncodedValue(i.Value))).ToArray(); return string.Join("&", queryParams); } @@ -243,7 +243,7 @@ namespace MediaBrowser.Model.Web /// System.String. public string GetUrl(string prefix) { - var query = GetQueryString(); + string query = GetQueryString(); if (string.IsNullOrEmpty(query)) {