From 86f573ab426ce2159984bcf286d7d2cffe9859d6 Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Sat, 23 Mar 2024 14:37:11 +0800 Subject: [PATCH 1/4] Update ikkoku-dotnet-ci.yml Only run GHA on master --- .github/workflows/ikkoku-dotnet-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ikkoku-dotnet-ci.yml b/.github/workflows/ikkoku-dotnet-ci.yml index abc78af..ec61aab 100644 --- a/.github/workflows/ikkoku-dotnet-ci.yml +++ b/.github/workflows/ikkoku-dotnet-ci.yml @@ -3,7 +3,7 @@ name: publish on: push: pull_request: - # branches: [ "master" ] + branches: [ "master" ] paths: - '**.cs' - '**.csproj' @@ -71,4 +71,4 @@ jobs: !Ikkoku/bin/Release/net8.0/${{ matrix.env.identifier }}-${{ matrix.arch }}/publish/*.pdb !Ikkoku/bin/Release/net8.0/${{ matrix.env.identifier }}-${{ matrix.arch }}/publish/*.dbg !Ikkoku/bin/Release/net8.0/${{ matrix.env.identifier }}-${{ matrix.arch }}/publish/*.dwarf - !Ikkoku/bin/Release/net8.0/${{ matrix.env.identifier }}-${{ matrix.arch }}/publish/*.dsym \ No newline at end of file + !Ikkoku/bin/Release/net8.0/${{ matrix.env.identifier }}-${{ matrix.arch }}/publish/*.dsym From 33fe9f4a2d72a3d328f82c68f5a11b5fa070aec1 Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Tue, 26 Mar 2024 22:05:47 +0800 Subject: [PATCH 2/4] Ikkoku/Clean: trimend when process event It is a regression bug caused by 244bb2b778a1a48c473bb4708629da82826eb029. I used to trim space chars at the end of the event line when parse ass, but now I have moved it to the ikkoku/clean --- Ikkoku/SubtileProcess/Clean.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Ikkoku/SubtileProcess/Clean.cs b/Ikkoku/SubtileProcess/Clean.cs index e20cc38..6894965 100644 --- a/Ikkoku/SubtileProcess/Clean.cs +++ b/Ikkoku/SubtileProcess/Clean.cs @@ -114,6 +114,7 @@ public static void CleanAss(AssData data, ReadOnlySpan assFileName, CleanA var hadMotionGarbage = false; var hadUnusedChar = false; var hadWeridSpace = false; + var hadEndSpace = false; for (var i = 0; i < data.Events.Collection.Count; i++) { @@ -125,6 +126,8 @@ public static void CleanAss(AssData data, ReadOnlySpan assFileName, CleanA } var et = data.Events.Collection[i].Text; + if (RemoveEndSpace(et)) + hadEndSpace = true; if (IsMotionGarbage(et)) { @@ -151,6 +154,10 @@ public static void CleanAss(AssData data, ReadOnlySpan assFileName, CleanA { records.Append(" replace weird space chars;"); } + if (hadEndSpace) + { + records.Append(" remove end space chars;"); + } RecordRemoveLast(records, 7); } @@ -234,6 +241,23 @@ private static void RemoveWeridChars(List et, ref bool hadUnusedChar, re } } + private static bool RemoveEndSpace(List et) + { + if (et.Count == 0) + return false; + + var last = et[^1]; + for (var end = last.Length - 1; end >=0; end--) + { + if (!char.IsWhiteSpace(last[end])) + { + et[^1] = last[..(end + 1)]; + return true; + } + } + return false; + } + public static void RemoveChar( StringBuilder sb, char[] chars) { for (int i = 0; i < sb.Length; i++) From cdf06bb2e65c6a899410ac4a7de661fdbc822673 Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:20:05 +0800 Subject: [PATCH 3/4] Update ikkoku-dotnet-ci.yml --- .github/workflows/ikkoku-dotnet-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ikkoku-dotnet-ci.yml b/.github/workflows/ikkoku-dotnet-ci.yml index ec61aab..fd664ab 100644 --- a/.github/workflows/ikkoku-dotnet-ci.yml +++ b/.github/workflows/ikkoku-dotnet-ci.yml @@ -2,6 +2,10 @@ name: publish on: push: + branches: [ "master" ] + paths: + - '**.cs' + - '**.csproj' pull_request: branches: [ "master" ] paths: From 590348366e5c5ea605d68619d76b282d9ad0e75f Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:27:57 +0800 Subject: [PATCH 4/4] Ikkoku/Clean: fix RemoveEndSpace wrong return --- Ikkoku/SubtileProcess/Clean.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Ikkoku/SubtileProcess/Clean.cs b/Ikkoku/SubtileProcess/Clean.cs index 6894965..2884c82 100644 --- a/Ikkoku/SubtileProcess/Clean.cs +++ b/Ikkoku/SubtileProcess/Clean.cs @@ -252,7 +252,10 @@ private static bool RemoveEndSpace(List et) if (!char.IsWhiteSpace(last[end])) { et[^1] = last[..(end + 1)]; - return true; + if (end != last.Length - 1) + return true; + else + break; } } return false;