From b93f69cb220c43196161e84d8b990cbc596e2396 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 4 Sep 2021 11:25:27 +0200 Subject: [PATCH] EditorConfig: Using utf-8-bom instead of utf-8 --- .editorconfig | 2 +- Kyoo.Abstractions/Models/Resources/Track.cs | 34 ++++++++++++++++----- Kyoo.Core/Application.cs | 11 ++++--- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.editorconfig b/.editorconfig index ad56e82e..1f3fbd2d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,7 @@ root = true [*] -charset = utf-8 +charset = utf-8-bom end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true diff --git a/Kyoo.Abstractions/Models/Resources/Track.cs b/Kyoo.Abstractions/Models/Resources/Track.cs index 1e5da085..64f499bd 100644 --- a/Kyoo.Abstractions/Models/Resources/Track.cs +++ b/Kyoo.Abstractions/Models/Resources/Track.cs @@ -13,10 +13,30 @@ namespace Kyoo.Abstractions.Models /// public enum StreamType { + /// + /// The type of the stream is not known. + /// Unknown = 0, + + /// + /// The stream is a video. + /// Video = 1, + + /// + /// The stream is an audio. + /// Audio = 2, + + /// + /// The stream is a subtitle. + /// Subtitle = 3, + + /// + /// The stream is an attachement (a font, an image or something else). + /// Only fonts are handled by kyoo but they are not saved to the database. + /// Attachment = 4 } @@ -36,8 +56,9 @@ namespace Kyoo.Abstractions.Models string type = Type.ToString().ToLower(); string index = TrackIndex != 0 ? $"-{TrackIndex}" : string.Empty; string episode = EpisodeSlug ?? Episode?.Slug ?? EpisodeID.ToString(); - return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : "")}.{type}"; + return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : string.Empty)}.{type}"; } + [UsedImplicitly] private set { if (value == null) @@ -81,14 +102,13 @@ namespace Kyoo.Abstractions.Models /// public string Codec { get; set; } - /// /// Is this stream the default one of it's type? /// public bool IsDefault { get; set; } /// - /// Is this stream tagged as forced? + /// Is this stream tagged as forced? /// public bool IsForced { get; set; } @@ -111,6 +131,7 @@ namespace Kyoo.Abstractions.Models /// The ID of the episode that uses this track. /// [SerializeIgnore] public int EpisodeID { get; set; } + /// /// The episode that uses this track. /// @@ -145,7 +166,7 @@ namespace Kyoo.Abstractions.Models } } - //Converting mkv track language to c# system language tag. + // Converting mkv track language to c# system language tag. private static string GetLanguage(string mkvLanguage) { // TODO delete this and have a real way to get the language string from the ISO-639-2. @@ -162,9 +183,8 @@ namespace Kyoo.Abstractions.Models /// /// The slug to edit /// The new type of this - /// - public static string BuildSlug(string baseSlug, - StreamType type) + /// The completed slug. + public static string BuildSlug(string baseSlug, StreamType type) { return baseSlug.EndsWith($".{type}", StringComparison.InvariantCultureIgnoreCase) ? baseSlug diff --git a/Kyoo.Core/Application.cs b/Kyoo.Core/Application.cs index 643aa89c..ff3f1c1e 100644 --- a/Kyoo.Core/Application.cs +++ b/Kyoo.Core/Application.cs @@ -39,7 +39,7 @@ namespace Kyoo.Core private CancellationTokenSource _tokenSource; /// - /// The environment in witch Kyoo will run (ether "Production" or "Development"). + /// The environment in witch Kyoo will run (ether "Production" or "Development"). /// private readonly string _environment; @@ -155,16 +155,19 @@ namespace Kyoo.Core .AddCommandLine(args) .Build(); - string path = parsed.GetValue("datadir") - ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyoo"); + string path = parsed.GetValue("datadir"); + path ??= Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyoo"); + path = Path.GetFullPath(path); if (!Directory.Exists(path)) Directory.CreateDirectory(path); Environment.CurrentDirectory = path; if (!File.Exists(GetConfigFile())) + { File.Copy(Path.Join(AppDomain.CurrentDomain.BaseDirectory, GetConfigFile()), GetConfigFile()); + } return path; } @@ -287,4 +290,4 @@ namespace Kyoo.Core .Enrich.FromLogContext(); } } -} \ No newline at end of file +}