brace multiline if statements (cont.)

This commit is contained in:
telans 2020-06-20 21:19:16 +12:00
parent 5bb639a59a
commit 6556bec646
No known key found for this signature in database
GPG Key ID: 195444EE92DBCB20
8 changed files with 36 additions and 0 deletions

View File

@ -2955,8 +2955,10 @@ namespace MediaBrowser.Controller.Entities
return ((IHasTrailers)this).LocalTrailerIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName); return ((IHasTrailers)this).LocalTrailerIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName);
} }
else else
{
return Array.Empty<BaseItem>(); return Array.Empty<BaseItem>();
} }
}
public virtual bool IsHD => Height >= 720; public virtual bool IsHD => Height >= 720;

View File

@ -1384,17 +1384,21 @@ namespace MediaBrowser.MediaEncoding.Probing
description = string.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it description = string.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it
} }
else else
{
throw new Exception(); // Switch to default parsing throw new Exception(); // Switch to default parsing
} }
}
catch // Default parsing catch // Default parsing
{ {
if (subtitle.Contains(".")) // skip the comment, keep the subtitle if (subtitle.Contains(".")) // skip the comment, keep the subtitle
description = string.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first description = string.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
else else
{
description = subtitle.Trim(); // Clean up whitespaces and save it description = subtitle.Trim(); // Clean up whitespaces and save it
} }
} }
} }
}
if (!string.IsNullOrWhiteSpace(description)) if (!string.IsNullOrWhiteSpace(description))
{ {

View File

@ -207,7 +207,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + "><i>"); text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + "><i>");
} }
else else
{
text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + ">"); text = text.Insert(start, "<font face=\"" + fontName + "\"" + extraTags + ">");
}
int indexOfEndTag = text.IndexOf("{\\fn}", start); int indexOfEndTag = text.IndexOf("{\\fn}", start);
if (indexOfEndTag > 0) if (indexOfEndTag > 0)
@ -215,9 +217,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Remove(indexOfEndTag, "{\\fn}".Length).Insert(indexOfEndTag, "</font>"); text = text.Remove(indexOfEndTag, "{\\fn}".Length).Insert(indexOfEndTag, "</font>");
} }
else else
{
text += "</font>"; text += "</font>";
} }
} }
}
if (text.Contains(@"{\fs")) if (text.Contains(@"{\fs"))
{ {
@ -236,7 +240,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + "><i>"); text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + "><i>");
} }
else else
{
text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + ">"); text = text.Insert(start, "<font size=\"" + fontSize + "\"" + extraTags + ">");
}
int indexOfEndTag = text.IndexOf("{\\fs}", start); int indexOfEndTag = text.IndexOf("{\\fs}", start);
if (indexOfEndTag > 0) if (indexOfEndTag > 0)
@ -244,10 +250,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Remove(indexOfEndTag, "{\\fs}".Length).Insert(indexOfEndTag, "</font>"); text = text.Remove(indexOfEndTag, "{\\fs}".Length).Insert(indexOfEndTag, "</font>");
} }
else else
{
text += "</font>"; text += "</font>";
} }
} }
} }
}
if (text.Contains(@"{\c")) if (text.Contains(@"{\c"))
{ {
@ -272,16 +280,20 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>"); text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>");
} }
else else
{
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">"); text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">");
}
int indexOfEndTag = text.IndexOf("{\\c}", start); int indexOfEndTag = text.IndexOf("{\\c}", start);
if (indexOfEndTag > 0) if (indexOfEndTag > 0)
{ {
text = text.Remove(indexOfEndTag, "{\\c}".Length).Insert(indexOfEndTag, "</font>"); text = text.Remove(indexOfEndTag, "{\\c}".Length).Insert(indexOfEndTag, "</font>");
} }
else else
{
text += "</font>"; text += "</font>";
} }
} }
}
if (text.Contains(@"{\1c")) // "1" specifices primary color if (text.Contains(@"{\1c")) // "1" specifices primary color
{ {
@ -306,7 +318,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>"); text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + "><i>");
} }
else else
{
text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">"); text = text.Insert(start, "<font color=\"" + color + "\"" + extraTags + ">");
}
text += "</font>"; text += "</font>";
} }
} }

View File

@ -140,8 +140,10 @@ namespace Rssdp.Infrastructure
lineIndex++; lineIndex++;
} }
else else
{
break; break;
} }
}
ParseHeader(line, headers, contentHeaders); ParseHeader(line, headers, contentHeaders);
} }
@ -184,8 +186,10 @@ namespace Rssdp.Infrastructure
} }
} }
else else
{
values.AddRange(segments); values.AddRange(segments);
} }
}
return values; return values;
} }
@ -218,7 +222,9 @@ namespace Rssdp.Infrastructure
return trimmedSegment.Substring(1, trimmedSegment.Length - 2); return trimmedSegment.Substring(1, trimmedSegment.Length - 2);
} }
else else
{
return trimmedSegment; return trimmedSegment;
} }
} }
} }
}

View File

@ -70,7 +70,9 @@ namespace Rssdp.Infrastructure
message.RequestUri = requestUri; message.RequestUri = requestUri;
} }
else else
{
System.Diagnostics.Debug.WriteLine(parts[1]); System.Diagnostics.Debug.WriteLine(parts[1]);
}
if (parts.Length >= 3) if (parts.Length >= 3)
{ {

View File

@ -169,8 +169,10 @@ namespace Rssdp
return "uuid:" + this.Uuid; return "uuid:" + this.Uuid;
} }
else else
{
return _Udn; return _Udn;
} }
}
set set
{ {

View File

@ -590,8 +590,10 @@ namespace Rssdp.Infrastructure
return OneSecond; return OneSecond;
} }
else else
{
return searchWaitTime.Subtract(OneSecond); return searchWaitTime.Subtract(OneSecond);
} }
}
private DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn) private DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn)
{ {

View File

@ -402,8 +402,10 @@ namespace Rssdp.Infrastructure
_RecentSearchRequests[newRequest.Key] = newRequest; _RecentSearchRequests[newRequest.Key] = newRequest;
} }
else else
{
isDuplicateRequest = true; isDuplicateRequest = true;
} }
}
else else
{ {
_RecentSearchRequests.Add(newRequest.Key, newRequest); _RecentSearchRequests.Add(newRequest.Key, newRequest);
@ -613,8 +615,10 @@ namespace Rssdp.Infrastructure
WriteTrace(text + " " + device.DeviceType + " - " + device.Uuid + " - " + rootDevice.Location); WriteTrace(text + " " + device.DeviceType + " - " + device.Uuid + " - " + rootDevice.Location);
} }
else else
{
WriteTrace(text + " " + device.DeviceType + " - " + device.Uuid); WriteTrace(text + " " + device.DeviceType + " - " + device.Uuid);
} }
}
private void CommsServer_RequestReceived(object sender, RequestReceivedEventArgs e) private void CommsServer_RequestReceived(object sender, RequestReceivedEventArgs e)
{ {