Skip to content

Commit

Permalink
修复标题中特殊字符的处理 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed May 17, 2020
1 parent 89f8aff commit b4748c5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
10 changes: 7 additions & 3 deletions Novel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,16 @@ public bool isVipChapter(int chptindx)
return vipChapters.IndexOf(chptindx) != -1;
}

Regex legalPath = new Regex(@"[|:?\\/*'<>]|\.+(?:$)");
public void saveChapter(Chapter chpt, bool split)
{
string savepath;
var legalName = legalPath.Replace(this.name, "_", -1);
if (split)
savepath = this.savePath + "\\" + this.name + "-" + chpt.chapterIndex.ToString("D3") + ".txt";
savepath = this.savePath + "\\" + legalName + "-" + chpt.chapterIndex.ToString("D3") + ".txt";
else
savepath = this.savePath + "\\" + this.name + ".txt";
savepath = this.savePath + "\\" + legalName + ".txt";

FileStream fs = new FileStream(savepath, FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(chpt.ToString() + "\r\n");
Expand All @@ -414,7 +417,8 @@ public void saveChapter(Chapter chpt, bool split)
}
private void saveProgress(int chpt)
{
string savepath = this.savePath + "\\" + this.name + ".jjget";
var legalName = legalPath.Replace(this.name, "_", -1);
string savepath = this.savePath + "\\" + legalName + ".jjget";
FileStream fs = new FileStream(savepath, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.Write(chpt.ToString());
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[assembly: AssemblyTitle("jjget")]
[assembly: AssemblyDescription("晋江下载器")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("fffonion (https://yooooo.us)")]
[assembly: AssemblyCompany("fffonion (https://github.com/fffonion/JJGet/issues)")]
[assembly: AssemblyProduct("jjget")]
[assembly: AssemblyCopyright("GPLv3")]
[assembly: AssemblyTrademark("")]
Expand All @@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.2")]
[assembly: AssemblyFileVersion("1.2.2")]
[assembly: AssemblyVersion("1.2.4")]
[assembly: AssemblyFileVersion("1.2.4")]
6 changes: 3 additions & 3 deletions frmAbout.Designer.cs

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

2 changes: 1 addition & 1 deletion frmMain.Designer.cs

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

5 changes: 2 additions & 3 deletions jjget.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@
<Error Condition="!Exists('..\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
</Target>
<ItemGroup>
<PackageReference Include="ILMerge" Version="3.0.17" />
<PackageReference Include="ILMerge" Version="3.0.29" />
</ItemGroup>

<Target Name="ILMerge">
<!-- the ILMergePath property points to the location of ILMerge.exe console application -->
<Exec Command="$(ILMergeConsolePath) bin\SingleFile\jjget.exe /out:jjget.exe bin\SingleFile\HtmlAgilityPack.dll bin\SingleFile\Newtonsoft.Json.dll" />
<Exec Command="$(ILMergeConsolePath) bin\Release\jjget.exe /out:jjget.exe bin\Release\HtmlAgilityPack.dll bin\Release\Newtonsoft.Json.dll" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit b4748c5

Please sign in to comment.