EditorConfig: Using utf-8-bom instead of utf-8

This commit is contained in:
Zoe Roux 2021-09-04 11:25:27 +02:00
parent aec2a8f51a
commit b93f69cb22
3 changed files with 35 additions and 12 deletions

View File

@ -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

View File

@ -13,10 +13,30 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public enum StreamType
{
/// <summary>
/// The type of the stream is not known.
/// </summary>
Unknown = 0,
/// <summary>
/// The stream is a video.
/// </summary>
Video = 1,
/// <summary>
/// The stream is an audio.
/// </summary>
Audio = 2,
/// <summary>
/// The stream is a subtitle.
/// </summary>
Subtitle = 3,
/// <summary>
/// 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.
/// </summary>
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,7 +102,6 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public string Codec { get; set; }
/// <summary>
/// Is this stream the default one of it's type?
/// </summary>
@ -111,6 +131,7 @@ namespace Kyoo.Abstractions.Models
/// The ID of the episode that uses this track.
/// </summary>
[SerializeIgnore] public int EpisodeID { get; set; }
/// <summary>
/// The episode that uses this track.
/// </summary>
@ -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
/// </summary>
/// <param name="baseSlug">The slug to edit</param>
/// <param name="type">The new type of this </param>
/// <returns></returns>
public static string BuildSlug(string baseSlug,
StreamType type)
/// <returns>The completed slug.</returns>
public static string BuildSlug(string baseSlug, StreamType type)
{
return baseSlug.EndsWith($".{type}", StringComparison.InvariantCultureIgnoreCase)
? baseSlug

View File

@ -155,16 +155,19 @@ namespace Kyoo.Core
.AddCommandLine(args)
.Build();
string path = parsed.GetValue<string>("datadir")
?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyoo");
string path = parsed.GetValue<string>("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;
}