mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
using YamlDotNet.Serialization; |
|
using YamlDotNet.Serialization.NamingConventions; |
|
|
|
namespace ErsatzTV.Core.Graphics; |
|
|
|
public class SubtitlesGraphicsElement |
|
{ |
|
[YamlMember(Alias = "z_index", ApplyNamingConventions = false)] |
|
public int? ZIndex { get; set; } |
|
|
|
[YamlMember(Alias = "epg_entries", ApplyNamingConventions = false)] |
|
public int EpgEntries { get; set; } |
|
|
|
public string Template { get; set; } |
|
|
|
public static async Task<Option<SubtitlesGraphicsElement>> FromFile(string fileName) |
|
{ |
|
try |
|
{ |
|
string yaml = await File.ReadAllTextAsync(fileName); |
|
|
|
// TODO: validate schema |
|
// if (await yamlScheduleValidator.ValidateSchedule(yaml, isImport) == false) |
|
// { |
|
// return Option<YamlPlayoutDefinition>.None; |
|
// } |
|
|
|
IDeserializer deserializer = new DeserializerBuilder() |
|
.WithNamingConvention(CamelCaseNamingConvention.Instance) |
|
.Build(); |
|
|
|
return deserializer.Deserialize<SubtitlesGraphicsElement>(yaml); |
|
} |
|
catch (Exception) |
|
{ |
|
return Option<SubtitlesGraphicsElement>.None; |
|
} |
|
} |
|
}
|
|
|