From 1021aa06aa025c8207a5a5b148b6de9b4115671c Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 21 Jul 2024 17:55:17 +0800 Subject: [PATCH] Implement the config for kar/lrc parser. --- LrcParser/Parser/DecodeConfig.cs | 6 ++++++ LrcParser/Parser/EncodeConfig.cs | 6 ++++++ LrcParser/Parser/IHasParserConfig.cs | 12 ++++++++++++ LrcParser/Parser/Kar/KarDecodeConfig.cs | 6 ++++++ LrcParser/Parser/Kar/KarEncodeConfig.cs | 6 ++++++ LrcParser/Parser/Kar/KarParser.cs | 5 ++++- LrcParser/Parser/Lrc/LrcDecodeConfig.cs | 6 ++++++ LrcParser/Parser/Lrc/LrcEncodeConfig.cs | 6 ++++++ LrcParser/Parser/Lrc/LrcParser.cs | 5 ++++- 9 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 LrcParser/Parser/DecodeConfig.cs create mode 100644 LrcParser/Parser/EncodeConfig.cs create mode 100644 LrcParser/Parser/IHasParserConfig.cs create mode 100644 LrcParser/Parser/Kar/KarDecodeConfig.cs create mode 100644 LrcParser/Parser/Kar/KarEncodeConfig.cs create mode 100644 LrcParser/Parser/Lrc/LrcDecodeConfig.cs create mode 100644 LrcParser/Parser/Lrc/LrcEncodeConfig.cs diff --git a/LrcParser/Parser/DecodeConfig.cs b/LrcParser/Parser/DecodeConfig.cs new file mode 100644 index 0000000..b39c624 --- /dev/null +++ b/LrcParser/Parser/DecodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser; + +public abstract class DecodeConfig; diff --git a/LrcParser/Parser/EncodeConfig.cs b/LrcParser/Parser/EncodeConfig.cs new file mode 100644 index 0000000..4cdb488 --- /dev/null +++ b/LrcParser/Parser/EncodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser; + +public abstract class EncodeConfig; diff --git a/LrcParser/Parser/IHasParserConfig.cs b/LrcParser/Parser/IHasParserConfig.cs new file mode 100644 index 0000000..9c4b584 --- /dev/null +++ b/LrcParser/Parser/IHasParserConfig.cs @@ -0,0 +1,12 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser; + +public interface IHasParserConfig + where TEncodeConfig : EncodeConfig + where TDecodeConfig : DecodeConfig +{ + TEncodeConfig EncodeConfig { get; set; } + TDecodeConfig DecodeConfig { get; set; } +} diff --git a/LrcParser/Parser/Kar/KarDecodeConfig.cs b/LrcParser/Parser/Kar/KarDecodeConfig.cs new file mode 100644 index 0000000..ce39324 --- /dev/null +++ b/LrcParser/Parser/Kar/KarDecodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser.Kar; + +public class KarDecodeConfig : DecodeConfig; diff --git a/LrcParser/Parser/Kar/KarEncodeConfig.cs b/LrcParser/Parser/Kar/KarEncodeConfig.cs new file mode 100644 index 0000000..64ecc12 --- /dev/null +++ b/LrcParser/Parser/Kar/KarEncodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser.Kar; + +public class KarEncodeConfig : EncodeConfig; diff --git a/LrcParser/Parser/Kar/KarParser.cs b/LrcParser/Parser/Kar/KarParser.cs index 5002f10..669ade6 100644 --- a/LrcParser/Parser/Kar/KarParser.cs +++ b/LrcParser/Parser/Kar/KarParser.cs @@ -12,8 +12,11 @@ namespace LrcParser.Parser.Kar; /// /// Parser for encode and decode .kar lyric format /// -public class KarParser : LyricParser +public class KarParser : LyricParser, IHasParserConfig { + public KarEncodeConfig EncodeConfig { get; set; } = new(); + public KarDecodeConfig DecodeConfig { get; set; } = new(); + public KarParser() { Register(); diff --git a/LrcParser/Parser/Lrc/LrcDecodeConfig.cs b/LrcParser/Parser/Lrc/LrcDecodeConfig.cs new file mode 100644 index 0000000..900e1dd --- /dev/null +++ b/LrcParser/Parser/Lrc/LrcDecodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser.Lrc; + +public class LrcDecodeConfig : DecodeConfig; diff --git a/LrcParser/Parser/Lrc/LrcEncodeConfig.cs b/LrcParser/Parser/Lrc/LrcEncodeConfig.cs new file mode 100644 index 0000000..7cc7562 --- /dev/null +++ b/LrcParser/Parser/Lrc/LrcEncodeConfig.cs @@ -0,0 +1,6 @@ +// Copyright (c) karaoke.dev . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace LrcParser.Parser.Lrc; + +public class LrcEncodeConfig : EncodeConfig; diff --git a/LrcParser/Parser/Lrc/LrcParser.cs b/LrcParser/Parser/Lrc/LrcParser.cs index 09c5d0a..7378511 100644 --- a/LrcParser/Parser/Lrc/LrcParser.cs +++ b/LrcParser/Parser/Lrc/LrcParser.cs @@ -10,8 +10,11 @@ namespace LrcParser.Parser.Lrc; /// /// Parser for encode and decode .lrc lyric format /// -public class LrcParser : LyricParser +public class LrcParser : LyricParser, IHasParserConfig { + public LrcEncodeConfig EncodeConfig { get; set; } = new(); + public LrcDecodeConfig DecodeConfig { get; set; } = new(); + public LrcParser() { Register();