Skip to content

Commit

Permalink
make some small clean-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Dec 9, 2023
1 parent aeadff6 commit f02cc07
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LrcParser.Tests/Parser/Lrc/Utils/LrcTimedTextUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LrcTimedTextUtilsTest
[TestCase("[00:17:97]帰[00:18:37]り[00:18:55]道[00:18:94]は[00:19:22] ", "帰り道は ", new[] { "[0,start]:17970", "[1,start]:18370", "[2,start]:18550", "[3,start]:18940", "[3,end]:19220" })]
[TestCase("帰[00:18:37]り[00:18:55]道[00:18:94]は[00:19:22]", "帰り道は", new[] { "[1,start]:18370", "[2,start]:18550", "[3,start]:18940", "[3,end]:19220" })]
[TestCase("[00:17:97]帰[00:18:37]り[00:18:55]道[00:18:94]は", "帰り道は", new[] { "[0,start]:17970", "[1,start]:18370", "[2,start]:18550", "[3,start]:18940" })]
[TestCase("[00:51.00][01:29.99][01:48.29][02:31.00][02:41.99]You gotta fight !", "You gotta fight !", new string[] { "[0,start]:51000" })] // decode with invalid format.
[TestCase("[00:51.00][01:29.99][01:48.29][02:31.00][02:41.99]You gotta fight !", "You gotta fight !", new[] { "[0,start]:51000" })] // decode with invalid format.
[TestCase("帰り道は", "帰り道は", new string[] { })]
[TestCase("", "", new string[] { })]
[TestCase(null, "", new string[] { })]
Expand Down
2 changes: 1 addition & 1 deletion LrcParser/Model/TextIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public bool Equals(TextIndex other)
return Index == other.Index && State == other.State;
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (obj is TextIndex textIndex)
return Equals(textIndex);
Expand Down
2 changes: 1 addition & 1 deletion LrcParser/Parser/Lrc/Lines/LrcRubyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override string Encode(LrcRuby component, int index)

var input = $"@Ruby{index + 1}={parent},{ruby},{startTime},{endTime}";

const string remove_last_comma_pattern = @"([,]*)$";
const string remove_last_comma_pattern = "([,]*)$";
return Regex.Replace(input, remove_last_comma_pattern, "");
}
}
1 change: 1 addition & 0 deletions LrcParser/Parser/Lrc/Utils/TimeTagUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal static int TimeTagToMillionSecond(string timeTag)
{
if (timeTag.Length < 10 || timeTag[0] != '[' || !char.IsDigit(timeTag[1]))
return -1;

int minute = int.Parse(timeTag.Substring(1, 2));
int second = int.Parse(timeTag.Substring(4, 2));
int millionSecond = int.Parse(timeTag.Substring(7, 2));
Expand Down

0 comments on commit f02cc07

Please sign in to comment.