Merge pull request #3502 from barronpm/array-empty

Use Array.Empty
This commit is contained in:
Bond-009 2020-07-04 23:10:45 +02:00 committed by GitHub
commit fb91e4fc23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 33 additions and 27 deletions

View File

@ -164,7 +164,7 @@ namespace Emby.Dlna.Profiles
public void AddXmlRootAttribute(string name, string value)
{
var atts = XmlRootAttributes ?? new XmlAttribute[] { };
var atts = XmlRootAttributes ?? System.Array.Empty<XmlAttribute>();
var list = atts.ToList();
list.Add(new XmlAttribute

View File

@ -28,7 +28,7 @@ namespace Emby.Dlna.Profiles
},
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = System.Array.Empty<ResponseProfile>();
}
}
}

View File

@ -123,7 +123,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = System.Array.Empty<ResponseProfile>();
}
}
}

View File

@ -72,7 +72,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = System.Array.Empty<ResponseProfile>();
}
}
}

View File

@ -37,7 +37,7 @@ namespace Emby.Dlna.Profiles
},
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = System.Array.Empty<ResponseProfile>();
}
}
}

View File

@ -1,5 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.Profiles
@ -37,7 +38,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = Array.Empty<ResponseProfile>();
}
}
}

View File

@ -1,5 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.Profiles
@ -223,7 +224,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = Array.Empty<ResponseProfile>();
}
}
}

View File

@ -1,5 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.Profiles
@ -223,7 +224,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = Array.Empty<ResponseProfile>();
}
}
}

View File

@ -1,5 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.Profiles
@ -211,7 +212,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = Array.Empty<ResponseProfile>();
}
}
}

View File

@ -1,5 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.Profiles
@ -211,7 +212,7 @@ namespace Emby.Dlna.Profiles
}
};
ResponseProfiles = new ResponseProfile[] { };
ResponseProfiles = Array.Empty<ResponseProfile>();
}
}
}

View File

@ -125,7 +125,7 @@ namespace MediaBrowser.Api
IncludeItemTypes = request.GetIncludeItemTypes(),
DtoOptions = new Controller.Dto.DtoOptions
{
Fields = new ItemFields[] { },
Fields = Array.Empty<ItemFields>(),
EnableImages = false,
EnableUserData = false
},

View File

@ -613,7 +613,7 @@ namespace MediaBrowser.Controller.Entities
{
if (!IsFileProtocol)
{
return new string[] { };
return Array.Empty<string>();
}
return new[] { Path };

View File

@ -198,7 +198,7 @@ namespace MediaBrowser.Controller.Entities.Movies
public Guid[] GetLibraryFolderIds()
{
var expandedFolders = new List<Guid>() { };
var expandedFolders = new List<Guid>();
return FlattenItems(this, expandedFolders)
.SelectMany(i => LibraryManager.GetCollectionFolders(i))

View File

@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Library
};
}
return new DayOfWeek[] { };
return Array.Empty<DayOfWeek>();
}
return null;

View File

@ -41,7 +41,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
var outputStream = new BlurayDiscInfo
{
MediaStreams = new MediaStream[] { }
MediaStreams = Array.Empty<MediaStream>()
};
if (playlist == null)

View File

@ -1008,7 +1008,7 @@ namespace MediaBrowser.MediaEncoding.Probing
var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");
if (string.IsNullOrWhiteSpace(artist))
{
audio.Artists = new string[] { };
audio.Artists = Array.Empty<string>();
}
else
{
@ -1031,7 +1031,7 @@ namespace MediaBrowser.MediaEncoding.Probing
if (string.IsNullOrWhiteSpace(albumArtist))
{
audio.AlbumArtists = new string[] { };
audio.AlbumArtists = Array.Empty<string>();
}
else
{

View File

@ -206,7 +206,7 @@ namespace MediaBrowser.Model.Dlna
}
}
return new MediaFormatProfile[] { };
return Array.Empty<MediaFormatProfile>();
}
private MediaFormatProfile ValueOf(string value)

View File

@ -813,18 +813,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetAudioStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in AudioCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}
@ -838,18 +838,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetVideoStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in VideoCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}

View File

@ -1,6 +1,7 @@
#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Querying
@ -54,7 +55,7 @@ namespace MediaBrowser.Model.Querying
public UpcomingEpisodesQuery()
{
EnableImageTypes = new ImageType[] { };
EnableImageTypes = Array.Empty<ImageType>();
}
}
}

View File

@ -723,7 +723,7 @@ namespace MediaBrowser.Providers.Manager
userDataList.AddRange(localItem.UserDataList);
}
MergeData(localItem, temp, new MetadataField[] { }, !options.ReplaceAllMetadata, true);
MergeData(localItem, temp, Array.Empty<MetadataField>(), !options.ReplaceAllMetadata, true);
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport;
// Only one local provider allowed per item
@ -849,7 +849,7 @@ namespace MediaBrowser.Providers.Manager
{
result.Provider = provider.Name;
MergeData(result, temp, new MetadataField[] { }, false, false);
MergeData(result, temp, Array.Empty<MetadataField>(), false, false);
MergeNewData(temp.Item, id);
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataDownload;