Merge pull request #4478 from Bond-009/chararray
Don't allocate single char arrays when possible
This commit is contained in:
commit
7caf1662ec
|
@ -31,7 +31,7 @@ namespace DvdLib.Ifo
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nums = ifo.Name.Split(new[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
|
var nums = ifo.Name.Split('_', StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (nums.Length >= 2 && ushort.TryParse(nums[1], out var ifoNumber))
|
if (nums.Length >= 2 && ushort.TryParse(nums[1], out var ifoNumber))
|
||||||
{
|
{
|
||||||
ReadVTS(ifoNumber, ifo.FullName);
|
ReadVTS(ifoNumber, ifo.FullName);
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Emby.Dlna.Didl
|
||||||
{
|
{
|
||||||
_all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
|
_all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
_fields = (filter ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
_fields = (filter ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(string field)
|
public bool Contains(string field)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Emby.Dlna.Eventing
|
||||||
if (!string.IsNullOrEmpty(header))
|
if (!string.IsNullOrEmpty(header))
|
||||||
{
|
{
|
||||||
// Starts with SECOND-
|
// Starts with SECOND-
|
||||||
header = header.Split('-').Last();
|
header = header.Split('-')[^1];
|
||||||
|
|
||||||
if (int.TryParse(header, NumberStyles.Integer, _usCulture, out var val))
|
if (int.TryParse(header, NumberStyles.Integer, _usCulture, out var val))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ namespace Emby.Server.Implementations
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No metafile, so lets see if the folder is versioned.
|
// No metafile, so lets see if the folder is versioned.
|
||||||
metafile = dir.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[^1];
|
metafile = dir.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[^1];
|
||||||
|
|
||||||
int versionIndex = dir.LastIndexOf('_');
|
int versionIndex = dir.LastIndexOf('_');
|
||||||
if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version parsedVersion))
|
if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version parsedVersion))
|
||||||
|
|
|
@ -1007,7 +1007,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parts = value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = value.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
foreach (var part in parts)
|
foreach (var part in parts)
|
||||||
{
|
{
|
||||||
|
@ -1057,7 +1057,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parts = value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = value.Split('|' , StringSplitOptions.RemoveEmptyEntries);
|
||||||
var list = new List<ItemImageInfo>();
|
var list = new List<ItemImageInfo>();
|
||||||
foreach (var part in parts)
|
foreach (var part in parts)
|
||||||
{
|
{
|
||||||
|
@ -1096,7 +1096,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
public ItemImageInfo ItemImageInfoFromValueString(string value)
|
public ItemImageInfo ItemImageInfoFromValueString(string value)
|
||||||
{
|
{
|
||||||
var parts = value.Split(new[] { '*' }, StringSplitOptions.None);
|
var parts = value.Split('*', StringSplitOptions.None);
|
||||||
|
|
||||||
if (parts.Length < 3)
|
if (parts.Length < 3)
|
||||||
{
|
{
|
||||||
|
@ -1532,7 +1532,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(index))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.Genres = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
item.Genres = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -1593,7 +1593,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
IEnumerable<MetadataField> GetLockedFields(string s)
|
IEnumerable<MetadataField> GetLockedFields(string s)
|
||||||
{
|
{
|
||||||
foreach (var i in s.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var i in s.Split('|', StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(i, true, out MetadataField parsedValue))
|
if (Enum.TryParse(i, true, out MetadataField parsedValue))
|
||||||
{
|
{
|
||||||
|
@ -1612,7 +1612,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(index))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.Studios = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
item.Studios = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -1622,7 +1622,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(index))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.Tags = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
item.Tags = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -1636,7 +1636,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
IEnumerable<TrailerType> GetTrailerTypes(string s)
|
IEnumerable<TrailerType> GetTrailerTypes(string s)
|
||||||
{
|
{
|
||||||
foreach (var i in s.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var i in s.Split('|', StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(i, true, out TrailerType parsedValue))
|
if (Enum.TryParse(i, true, out TrailerType parsedValue))
|
||||||
{
|
{
|
||||||
|
@ -1811,7 +1811,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(index))
|
if (!reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
item.ProductionLocations = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
item.ProductionLocations = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -1848,14 +1848,14 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (item is IHasArtist hasArtists && !reader.IsDBNull(index))
|
if (item is IHasArtist hasArtists && !reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
hasArtists.Artists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
hasArtists.Artists = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
if (item is IHasAlbumArtist hasAlbumArtists && !reader.IsDBNull(index))
|
if (item is IHasAlbumArtist hasAlbumArtists && !reader.IsDBNull(index))
|
||||||
{
|
{
|
||||||
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
@ -5611,7 +5611,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allTypes = typeString.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
|
var allTypes = typeString.Split('|', StringSplitOptions.RemoveEmptyEntries)
|
||||||
.ToLookup(x => x);
|
.ToLookup(x => x);
|
||||||
|
|
||||||
foreach (var type in allTypes)
|
foreach (var type in allTypes)
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var containers = container.Split(new[] { ',' });
|
var containers = container.Split(',');
|
||||||
if (containers.Length < 2)
|
if (containers.Length < 2)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -245,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parts = authorizationHeader.Split(new[] { ' ' }, 2);
|
var parts = authorizationHeader.Split(' ', 2);
|
||||||
|
|
||||||
// There should be at least to parts
|
// There should be at least to parts
|
||||||
if (parts.Length != 2)
|
if (parts.Length != 2)
|
||||||
|
@ -269,11 +269,11 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||||
|
|
||||||
foreach (var item in parts)
|
foreach (var item in parts)
|
||||||
{
|
{
|
||||||
var param = item.Trim().Split(new[] { '=' }, 2);
|
var param = item.Trim().Split('=', 2);
|
||||||
|
|
||||||
if (param.Length == 2)
|
if (param.Length == 2)
|
||||||
{
|
{
|
||||||
var value = NormalizeValue(param[1].Trim(new[] { '"' }));
|
var value = NormalizeValue(param[1].Trim('"'));
|
||||||
result[param[0]] = value;
|
result[param[0]] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2705,7 +2705,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
var videos = videoListResolver.Resolve(fileSystemChildren);
|
||||||
|
|
||||||
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files.First().Path, StringComparison.OrdinalIgnoreCase));
|
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files[0].Path, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (currentVideo != null)
|
if (currentVideo != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -849,7 +849,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
throw new ArgumentException("Key can't be empty.", nameof(key));
|
throw new ArgumentException("Key can't be empty.", nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
var keys = key.Split(new[] { LiveStreamIdDelimeter }, 2);
|
var keys = key.Split(LiveStreamIdDelimeter, 2);
|
||||||
|
|
||||||
var provider = _providers.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), keys[0], StringComparison.OrdinalIgnoreCase));
|
var provider = _providers.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), keys[0], StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstMedia = resolvedItem.Files.First();
|
var firstMedia = resolvedItem.Files[0];
|
||||||
|
|
||||||
var libraryItem = new T
|
var libraryItem = new T
|
||||||
{
|
{
|
||||||
|
|
|
@ -2208,7 +2208,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task ResetTuner(string id, CancellationToken cancellationToken)
|
public Task ResetTuner(string id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var parts = id.Split(new[] { '_' }, 2);
|
var parts = id.Split('_', 2);
|
||||||
|
|
||||||
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
|
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(currentFile))
|
if (string.IsNullOrEmpty(currentFile))
|
||||||
{
|
{
|
||||||
return (files.Last(), true);
|
return (files[^1], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextIndex = files.FindIndex(i => string.Equals(i, currentFile, StringComparison.OrdinalIgnoreCase)) + 1;
|
var nextIndex = files.FindIndex(i => string.Equals(i, currentFile, StringComparison.OrdinalIgnoreCase)) + 1;
|
||||||
|
|
|
@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
private string GetChannelNumber(string extInf, Dictionary<string, string> attributes, string mediaUrl)
|
private string GetChannelNumber(string extInf, Dictionary<string, string> attributes, string mediaUrl)
|
||||||
{
|
{
|
||||||
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
||||||
|
|
||||||
string numberString = null;
|
string numberString = null;
|
||||||
|
@ -273,8 +273,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
private static string GetChannelName(string extInf, Dictionary<string, string> attributes)
|
private static string GetChannelName(string extInf, Dictionary<string, string> attributes)
|
||||||
{
|
{
|
||||||
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
var nameInExtInf = nameParts.Length > 1 ? nameParts.Last().Trim() : null;
|
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].Trim() : null;
|
||||||
|
|
||||||
// Check for channel number with the format from SatIp
|
// Check for channel number with the format from SatIp
|
||||||
// #EXTINF:0,84. VOX Schweiz
|
// #EXTINF:0,84. VOX Schweiz
|
||||||
|
|
|
@ -653,7 +653,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.LogInformation(Name + ": Waiting on Task");
|
_logger.LogInformation(Name + ": Waiting on Task");
|
||||||
var exited = Task.WaitAll(new[] { task }, 2000);
|
var exited = task.Wait(2000);
|
||||||
|
|
||||||
if (exited)
|
if (exited)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
previouslyFailedImages = File.ReadAllText(failHistoryPath)
|
previouslyFailedImages = File.ReadAllText(failHistoryPath)
|
||||||
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
|
.Split('|', StringSplitOptions.RemoveEmptyEntries)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
|
|
@ -78,8 +78,8 @@ namespace Jellyfin.Api.Controllers
|
||||||
var query = new InternalItemsQuery
|
var query = new InternalItemsQuery
|
||||||
{
|
{
|
||||||
User = user,
|
User = user,
|
||||||
MediaTypes = (mediaTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries),
|
MediaTypes = (mediaTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
||||||
IncludeItemTypes = (includeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries),
|
IncludeItemTypes = (includeItemTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
EnableTotalRecordCount = false,
|
EnableTotalRecordCount = false,
|
||||||
DtoOptions = new DtoOptions
|
DtoOptions = new DtoOptions
|
||||||
|
@ -168,7 +168,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var genreQuery = new InternalItemsQuery(user)
|
var genreQuery = new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes =
|
IncludeItemTypes =
|
||||||
(includeItemTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries),
|
(includeItemTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
||||||
DtoOptions = new DtoOptions
|
DtoOptions = new DtoOptions
|
||||||
{
|
{
|
||||||
Fields = Array.Empty<ItemFields>(),
|
Fields = Array.Empty<ItemFields>(),
|
||||||
|
|
|
@ -249,7 +249,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||||
using var response = await httpClient.GetAsync(url).ConfigureAwait(false);
|
using var response = await httpClient.GetAsync(url).ConfigureAwait(false);
|
||||||
var ext = response.Content.Headers.ContentType.MediaType.Split('/').Last();
|
var ext = response.Content.Headers.ContentType.MediaType.Split('/')[^1];
|
||||||
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Jellyfin.Api.Helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
return removeEmpty
|
return removeEmpty
|
||||||
? value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries)
|
? value.Split(separator, StringSplitOptions.RemoveEmptyEntries)
|
||||||
: value.Split(separator);
|
: value.Split(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Jellyfin.Api.Helpers
|
||||||
|
|
||||||
streamingRequest.StreamOptions = ParseStreamOptions(httpRequest.Query);
|
streamingRequest.StreamOptions = ParseStreamOptions(httpRequest.Query);
|
||||||
|
|
||||||
var url = httpRequest.Path.Value.Split('.').Last();
|
var url = httpRequest.Path.Value.Split('.')[^1];
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(streamingRequest.AudioCodec))
|
if (string.IsNullOrEmpty(streamingRequest.AudioCodec))
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace MediaBrowser.Common.Json.Converters
|
||||||
{
|
{
|
||||||
if (reader.TokenType == JsonTokenType.String)
|
if (reader.TokenType == JsonTokenType.String)
|
||||||
{
|
{
|
||||||
var stringEntries = reader.GetString()?.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
var stringEntries = reader.GetString()?.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (stringEntries == null || stringEntries.Length == 0)
|
if (stringEntries == null || stringEntries.Length == 0)
|
||||||
{
|
{
|
||||||
return Array.Empty<T>();
|
return Array.Empty<T>();
|
||||||
|
@ -71,4 +71,4 @@ namespace MediaBrowser.Common.Json.Converters
|
||||||
JsonSerializer.Serialize(writer, value, options);
|
JsonSerializer.Serialize(writer, value, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else if (part.StartsWith("fps=", StringComparison.OrdinalIgnoreCase))
|
else if (part.StartsWith("fps=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var rate = part.Split(new[] { '=' }, 2)[^1];
|
var rate = part.Split('=', 2)[^1];
|
||||||
|
|
||||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
else if (state.RunTimeTicks.HasValue &&
|
else if (state.RunTimeTicks.HasValue &&
|
||||||
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
|
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var time = part.Split(new[] { '=' }, 2).Last();
|
var time = part.Split('=', 2)[^1];
|
||||||
|
|
||||||
if (TimeSpan.TryParse(time, _usCulture, out var val))
|
if (TimeSpan.TryParse(time, _usCulture, out var val))
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else if (part.StartsWith("size=", StringComparison.OrdinalIgnoreCase))
|
else if (part.StartsWith("size=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var size = part.Split(new[] { '=' }, 2).Last();
|
var size = part.Split('=', 2)[^1];
|
||||||
|
|
||||||
int? scale = null;
|
int? scale = null;
|
||||||
if (size.IndexOf("kb", StringComparison.OrdinalIgnoreCase) != -1)
|
if (size.IndexOf("kb", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else if (part.StartsWith("bitrate=", StringComparison.OrdinalIgnoreCase))
|
else if (part.StartsWith("bitrate=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var rate = part.Split(new[] { '=' }, 2).Last();
|
var rate = part.Split('=', 2)[^1];
|
||||||
|
|
||||||
int? scale = null;
|
int? scale = null;
|
||||||
if (rate.IndexOf("kbits/s", StringComparison.OrdinalIgnoreCase) != -1)
|
if (rate.IndexOf("kbits/s", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||||
var iTunEXTC = FFProbeHelpers.GetDictionaryValue(tags, "iTunEXTC");
|
var iTunEXTC = FFProbeHelpers.GetDictionaryValue(tags, "iTunEXTC");
|
||||||
if (!string.IsNullOrWhiteSpace(iTunEXTC))
|
if (!string.IsNullOrWhiteSpace(iTunEXTC))
|
||||||
{
|
{
|
||||||
var parts = iTunEXTC.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = iTunEXTC.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
// Example
|
// Example
|
||||||
// mpaa|G|100|For crude humor
|
// mpaa|G|100|For crude humor
|
||||||
if (parts.Length > 1)
|
if (parts.Length > 1)
|
||||||
|
@ -1139,7 +1139,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
|
return value.Split('/', StringSplitOptions.RemoveEmptyEntries)
|
||||||
.Select(i => i.Trim())
|
.Select(i => i.Trim())
|
||||||
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
return Array.Empty<string>();
|
return Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
return value.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsContainer(string container)
|
public bool ContainsContainer(string container)
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
|
|
||||||
if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn))
|
if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn))
|
||||||
{
|
{
|
||||||
orgPnValues.AddRange(mediaProfile.OrgPn.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
|
orgPnValues.AddRange(mediaProfile.OrgPn.Split(',', StringSplitOptions.RemoveEmptyEntries));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1647,7 +1647,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
|
|
||||||
// strip spaces to avoid having to encode
|
// strip spaces to avoid having to encode
|
||||||
var values = value
|
var values = value
|
||||||
.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny)
|
if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny)
|
||||||
{
|
{
|
||||||
|
|
|
@ -391,7 +391,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||||
item.Genres = Array.Empty<string>();
|
item.Genres = Array.Empty<string>();
|
||||||
|
|
||||||
foreach (var genre in result.Genre
|
foreach (var genre in result.Genre
|
||||||
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
.Split(',', StringSplitOptions.RemoveEmptyEntries)
|
||||||
.Select(i => i.Trim())
|
.Select(i => i.Trim())
|
||||||
.Where(i => !string.IsNullOrWhiteSpace(i)))
|
.Where(i => !string.IsNullOrWhiteSpace(i)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,7 +170,7 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
|
||||||
_logger.LogError(e, "Failed to retrieve series with remote id {RemoteId}", id);
|
_logger.LogError(e, "Failed to retrieve series with remote id {RemoteId}", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result?.Data.First().Id.ToString();
|
return result?.Data[0].Id.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
string subtitleId,
|
string subtitleId,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var parts = subtitleId.Split(new[] { '_' }, 2);
|
var parts = subtitleId.Split('_', 2);
|
||||||
var provider = GetProvider(parts[0]);
|
var provider = GetProvider(parts[0]);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -329,7 +329,7 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
Index = index,
|
Index = index,
|
||||||
ItemId = item.Id,
|
ItemId = item.Id,
|
||||||
Type = MediaStreamType.Subtitle
|
Type = MediaStreamType.Subtitle
|
||||||
}).First();
|
})[0];
|
||||||
|
|
||||||
var path = stream.Path;
|
var path = stream.Path;
|
||||||
_monitor.ReportFileSystemChangeBeginning(path);
|
_monitor.ReportFileSystemChangeBeginning(path);
|
||||||
|
@ -349,10 +349,10 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<SubtitleResponse> GetRemoteSubtitles(string id, CancellationToken cancellationToken)
|
public Task<SubtitleResponse> GetRemoteSubtitles(string id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var parts = id.Split(new[] { '_' }, 2);
|
var parts = id.Split('_', 2);
|
||||||
|
|
||||||
var provider = GetProvider(parts[0]);
|
var provider = GetProvider(parts[0]);
|
||||||
id = parts.Last();
|
id = parts[^1];
|
||||||
|
|
||||||
return provider.GetSubtitles(id, cancellationToken);
|
return provider.GetSubtitles(id, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace Rssdp.Infrastructure
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
headersToAddTo.TryAddWithoutValidation(headerName, values.First());
|
headersToAddTo.TryAddWithoutValidation(headerName, values[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ namespace Rssdp.Infrastructure
|
||||||
return lineIndex;
|
return lineIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<string> ParseValues(string headerValue)
|
private List<string> ParseValues(string headerValue)
|
||||||
{
|
{
|
||||||
// This really should be better and match the HTTP 1.1 spec,
|
// This really should be better and match the HTTP 1.1 spec,
|
||||||
// but this should actually be good enough for SSDP implementations
|
// but this should actually be good enough for SSDP implementations
|
||||||
|
@ -160,7 +160,7 @@ namespace Rssdp.Infrastructure
|
||||||
|
|
||||||
if (headerValue == "\"\"")
|
if (headerValue == "\"\"")
|
||||||
{
|
{
|
||||||
values.Add(String.Empty);
|
values.Add(string.Empty);
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ namespace Rssdp.Infrastructure
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var segments = headerValue.Split(SeparatorCharacters);
|
var segments = headerValue.Split(SeparatorCharacters);
|
||||||
if (headerValue.Contains("\""))
|
if (headerValue.Contains('"'))
|
||||||
{
|
{
|
||||||
for (int segmentIndex = 0; segmentIndex < segments.Length; segmentIndex++)
|
for (int segmentIndex = 0; segmentIndex < segments.Length; segmentIndex++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user