Update files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -9,6 +9,7 @@ class EpisodeRenamer
|
|||||||
{
|
{
|
||||||
private class PatternConfig
|
private class PatternConfig
|
||||||
{
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
public string Regex { get; set; }
|
public string Regex { get; set; }
|
||||||
public int? Start { get; set; }
|
public int? Start { get; set; }
|
||||||
public int? End { get; set; }
|
public int? End { get; set; }
|
||||||
@@ -109,13 +110,15 @@ class EpisodeRenamer
|
|||||||
patterns = new List<Pattern>();
|
patterns = new List<Pattern>();
|
||||||
foreach (PatternConfig patternConfig in config.Patterns)
|
foreach (PatternConfig patternConfig in config.Patterns)
|
||||||
{
|
{
|
||||||
|
if (!patternConfig.Enabled)
|
||||||
|
continue;
|
||||||
RegexOptions options = patternConfig.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None;
|
RegexOptions options = patternConfig.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||||
Regex regex = new Regex(patternConfig.Regex, options);
|
Regex regex = new Regex(patternConfig.Regex, options);
|
||||||
patterns.Add(new Pattern(regex, patternConfig.Start, patternConfig.End));
|
patterns.Add(new Pattern(regex, patternConfig.Start, patternConfig.End));
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Конфигурация успешно загружена.");
|
Console.WriteLine("Конфигурация успешно загружена.");
|
||||||
Console.WriteLine($"Загружено {patterns.Count} паттернов и {extensions.Count} расширений.");
|
Console.WriteLine($"Загружено паттернов: {patterns.Count}; расширений: {extensions.Count}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessFolder(string folder)
|
private static void ProcessFolder(string folder)
|
||||||
|
|||||||
10
config.json
10
config.json
@@ -1,23 +1,33 @@
|
|||||||
{
|
{
|
||||||
"Patterns": [
|
"Patterns": [
|
||||||
{
|
{
|
||||||
|
"Enabled": true,
|
||||||
"Regex": "\\[\\d+\\]",
|
"Regex": "\\[\\d+\\]",
|
||||||
"Start": 1,
|
"Start": 1,
|
||||||
"End": -1
|
"End": -1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Enabled": true,
|
||||||
"Regex": "[s]\\d+[e]\\d+",
|
"Regex": "[s]\\d+[e]\\d+",
|
||||||
"Start": 4,
|
"Start": 4,
|
||||||
"End": null,
|
"End": null,
|
||||||
"IgnoreCase": true
|
"IgnoreCase": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Enabled": true,
|
||||||
"Regex": "[s]\\d+[.][e]\\d+",
|
"Regex": "[s]\\d+[.][e]\\d+",
|
||||||
"Start": 5,
|
"Start": 5,
|
||||||
"End": null,
|
"End": null,
|
||||||
"IgnoreCase": true
|
"IgnoreCase": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Enabled": false,
|
||||||
|
"Regex": "[ ]\\d[2][ ]",
|
||||||
|
"Start": 1,
|
||||||
|
"End": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Enabled": true,
|
||||||
"Regex": "\\d+$",
|
"Regex": "\\d+$",
|
||||||
"Start": 0,
|
"Start": 0,
|
||||||
"End": null
|
"End": null
|
||||||
|
|||||||
Reference in New Issue
Block a user