Skip to content

Commit

Permalink
修复集数字符结束的后一位字符获取错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Apr 24, 2021
1 parent 1955299 commit 2b672dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions SubRenamer/Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ private string GetEpisByFileName(string fileName, int beginPos, string endStr)
if (str[i].ToString() == endStr) break;
result += str[i];
}

result = result.TrimStart('0'); // 开头为零的情况:替换 0001 为 1
result = result.Trim(); // 去掉前后空格

return result;
}

Expand Down Expand Up @@ -330,6 +334,7 @@ private string GetEndStrByList(List<FileInfo> list, int beginPos)
if (o.Name == null || o.Name.Length <= beginPos) return false;
return Regex.IsMatch(o.Name.Substring(beginPos)[0].ToString(), @"^\d+$");
}).ToList()[0].Name; // 获取开始即是数字的文件名
fileName = fileName.Substring(beginPos); // 从指定开始位置 (beginPos) 开始读取数字(忽略开始位置前的所有内容)

This comment has been minimized.

Copy link
@qwqcode

qwqcode Apr 24, 2021

Author Owner

没有从差异位置开始读取其后的字符,而是读取了全部字符

var grp = Regex.Matches(fileName, @"(\d+)");
if (grp.Count <= 0) return null;
Match firstNum = grp[0];
Expand Down
2 changes: 1 addition & 1 deletion SubRenamer/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions SubRenamer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("qwqaq.com")]
[assembly: AssemblyProduct("SubRenamer")]
[assembly: AssemblyCopyright("Copyright © qwqaq.com 2019")]
[assembly: AssemblyCopyright("Copyright © qwqaq.com 2021")]
[assembly: AssemblyTrademark("qwqaq.com")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]

0 comments on commit 2b672dc

Please sign in to comment.