From fd37cede9d6cd58d24c5303e396975fdd143e48c Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Wed, 21 Jul 2021 19:41:25 +0200 Subject: [PATCH] Using immuable collections in the file extensions class --- Kyoo/Kyoo.csproj | 1 + Kyoo/Models/FileExtensions.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 205b8458..70fae8ca 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -32,6 +32,7 @@ + diff --git a/Kyoo/Models/FileExtensions.cs b/Kyoo/Models/FileExtensions.cs index b42b4be2..d023c039 100644 --- a/Kyoo/Models/FileExtensions.cs +++ b/Kyoo/Models/FileExtensions.cs @@ -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 /// /// The list of known video extensions /// - public static readonly string[] VideoExtensions = + public static readonly ImmutableArray VideoExtensions = new() { ".webm", ".mkv", @@ -53,11 +53,11 @@ namespace Kyoo.Models.Watch /// /// The dictionary of known subtitles extensions and the name of the subtitle codec. /// - public static readonly Dictionary SubtitleExtensions = new() + public static readonly ImmutableDictionary SubtitleExtensions = new Dictionary { {".ass", "ass"}, {".str", "subrip"} - }; + }.ToImmutableDictionary(); /// /// Check if a file represent a subtitle file (only by checking the extension of the file)