mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 11:27:32 +01:00
Chapter illegalstring regex
This commit is contained in:
parent
25a6ceff10
commit
ac96fca6dc
@ -15,7 +15,8 @@ public struct Chapter
|
|||||||
public string url { get; }
|
public string url { get; }
|
||||||
public string fileName { get; }
|
public string fileName { get; }
|
||||||
|
|
||||||
private static readonly Regex LegalCharacters = new Regex(@"([A-z]*[0-9]* *\.*-*,*\]*\[*'*\'*\)*\(*~*!*)*");
|
private static readonly Regex LegalCharacters = new (@"([A-z]*[0-9]* *\.*-*,*\]*\[*'*\'*\)*\(*~*!*)*");
|
||||||
|
private static readonly Regex IllegalStrings = new(@"Vol(ume)?.?", RegexOptions.IgnoreCase);
|
||||||
public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url)
|
public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -27,7 +28,7 @@ public struct Chapter
|
|||||||
string volStr = this.volumeNumber is not null ? $"Vol.{this.volumeNumber} " : "";
|
string volStr = this.volumeNumber is not null ? $"Vol.{this.volumeNumber} " : "";
|
||||||
string chNumberStr = this.chapterNumber is not null ? $"Ch.{chapterNumber} " : "";
|
string chNumberStr = this.chapterNumber is not null ? $"Ch.{chapterNumber} " : "";
|
||||||
string chNameStr = chapterName.Length > 0 ? $"- {chapterName}" : "";
|
string chNameStr = chapterName.Length > 0 ? $"- {chapterName}" : "";
|
||||||
chNameStr = chNameStr.Replace("Volume", "").Replace("volume", "");
|
chNameStr = IllegalStrings.Replace(chNameStr, "");
|
||||||
this.fileName = $"{volStr}{chNumberStr}{chNameStr}";
|
this.fileName = $"{volStr}{chNumberStr}{chNameStr}";
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user