removed implicit typing from the model project

This commit is contained in:
Luke Pulverenti 2014-05-08 16:44:17 -04:00
parent bb031f553b
commit e653b41000
11 changed files with 59 additions and 59 deletions

View File

@ -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)
{

View File

@ -271,7 +271,7 @@ namespace MediaBrowser.Model.Configuration
EnableRealtimeMonitor = true;
var options = new List<MetadataOptions>
List<MetadataOptions> options = new List<MetadataOptions>
{
new MetadataOptions(1, 1280) {ItemType = "Book"},
new MetadataOptions(1, 1280) {ItemType = "MusicAlbum"},

View File

@ -27,7 +27,7 @@ namespace MediaBrowser.Model.Dlna
public bool ContainsCodec(string codec)
{
var codecs = GetCodecs();
List<string> codecs = GetCodecs();
return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase);
}

View File

@ -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)
{

View File

@ -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,

View File

@ -174,19 +174,19 @@ namespace MediaBrowser.Model.Dlna
return false;
}
var containers = i.GetContainers().ToList();
List<string> containers = i.GetContainers().ToList();
if (containers.Count > 0 && !containers.Contains(container))
{
return false;
}
var audioCodecs = i.GetAudioCodecs().ToList();
List<string> 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<string> 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<string> containers = i.GetContainers().ToList();
if (containers.Count > 0 && !containers.Contains(container))
{
return false;
}
var audioCodecs = i.GetAudioCodecs().ToList();
List<string> audioCodecs = i.GetAudioCodecs().ToList();
if (audioCodecs.Count > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty))
{
return false;
}
var videoCodecs = i.GetVideoCodecs().ToList();
List<string> 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<string> 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));

View File

@ -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";

View File

@ -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<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
}
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<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
}
@ -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<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();
}
@ -62,7 +62,7 @@ namespace MediaBrowser.Model.Dlna
private IEnumerable<MediaFormatProfile> 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<MediaFormatProfile>();
List<MediaFormatProfile> list = new List<MediaFormatProfile>();
list.Add(ValueOf("MPEG_TS_SD_NA" + suffix));
list.Add(ValueOf("MPEG_TS_SD_EU" + suffix));

View File

@ -30,7 +30,7 @@
/// <returns>ImageSize.</returns>
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 @@
/// <returns>System.Double.</returns>
private static double GetNewWidth(double currentHeight, double currentWidth, double newHeight)
{
var scaleFactor = newHeight;
double scaleFactor = newHeight;
scaleFactor /= currentHeight;
scaleFactor *= currentWidth;
@ -136,7 +136,7 @@
/// <returns>System.Double.</returns>
private static double GetNewHeight(double currentHeight, double currentWidth, double newWidth)
{
var scaleFactor = newWidth;
double scaleFactor = newWidth;
scaleFactor /= currentWidth;
scaleFactor *= currentHeight;

View File

@ -103,9 +103,9 @@ namespace MediaBrowser.Model.Entities
/// </summary>
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
/// </summary>
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);

View File

@ -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
/// <returns>System.String.</returns>
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
/// <returns>System.String.</returns>
public string GetUrl(string prefix)
{
var query = GetQueryString();
string query = GetQueryString();
if (string.IsNullOrEmpty(query))
{