Using immuable collections in the file extensions class

This commit is contained in:
Zoe Roux 2021-07-21 19:41:25 +02:00
parent bb5dc0dcae
commit fd37cede9d
2 changed files with 5 additions and 4 deletions

View File

@ -32,6 +32,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
<ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" />
<PackageReference Include="Autofac" Version="6.2.0" />

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
namespace Kyoo.Models.Watch
{
@ -12,7 +12,7 @@ namespace Kyoo.Models.Watch
/// <summary>
/// The list of known video extensions
/// </summary>
public static readonly string[] VideoExtensions =
public static readonly ImmutableArray<string> VideoExtensions = new()
{
".webm",
".mkv",
@ -53,11 +53,11 @@ namespace Kyoo.Models.Watch
/// <summary>
/// The dictionary of known subtitles extensions and the name of the subtitle codec.
/// </summary>
public static readonly Dictionary<string, string> SubtitleExtensions = new()
public static readonly ImmutableDictionary<string, string> SubtitleExtensions = new Dictionary<string, string>
{
{".ass", "ass"},
{".str", "subrip"}
};
}.ToImmutableDictionary();
/// <summary>
/// Check if a file represent a subtitle file (only by checking the extension of the file)