Skip to content

Commit

Permalink
Implement the config for kar/lrc parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 21, 2024
1 parent 83e688e commit 1021aa0
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 2 deletions.
6 changes: 6 additions & 0 deletions LrcParser/Parser/DecodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

namespace LrcParser.Parser;

public abstract class DecodeConfig;
6 changes: 6 additions & 0 deletions LrcParser/Parser/EncodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

namespace LrcParser.Parser;

public abstract class EncodeConfig;
12 changes: 12 additions & 0 deletions LrcParser/Parser/IHasParserConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

namespace LrcParser.Parser;

public interface IHasParserConfig<TEncodeConfig, TDecodeConfig>
where TEncodeConfig : EncodeConfig
where TDecodeConfig : DecodeConfig
{
TEncodeConfig EncodeConfig { get; set; }
TDecodeConfig DecodeConfig { get; set; }
}
6 changes: 6 additions & 0 deletions LrcParser/Parser/Kar/KarDecodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. 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;
6 changes: 6 additions & 0 deletions LrcParser/Parser/Kar/KarEncodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. 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;
5 changes: 4 additions & 1 deletion LrcParser/Parser/Kar/KarParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ namespace LrcParser.Parser.Kar;
/// <summary>
/// Parser for encode and decode .kar lyric format
/// </summary>
public class KarParser : LyricParser
public class KarParser : LyricParser, IHasParserConfig<KarEncodeConfig, KarDecodeConfig>
{
public KarEncodeConfig EncodeConfig { get; set; } = new();
public KarDecodeConfig DecodeConfig { get; set; } = new();

public KarParser()
{
Register<KarRubyParser>();
Expand Down
6 changes: 6 additions & 0 deletions LrcParser/Parser/Lrc/LrcDecodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. 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;
6 changes: 6 additions & 0 deletions LrcParser/Parser/Lrc/LrcEncodeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. 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;
5 changes: 4 additions & 1 deletion LrcParser/Parser/Lrc/LrcParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ namespace LrcParser.Parser.Lrc;
/// <summary>
/// Parser for encode and decode .lrc lyric format
/// </summary>
public class LrcParser : LyricParser
public class LrcParser : LyricParser, IHasParserConfig<LrcEncodeConfig, LrcDecodeConfig>
{
public LrcEncodeConfig EncodeConfig { get; set; } = new();
public LrcDecodeConfig DecodeConfig { get; set; } = new();

public LrcParser()
{
Register<LrcLyricParser>();
Expand Down

0 comments on commit 1021aa0

Please sign in to comment.