Compare commits
3 Commits
9440d5a065
...
b40bd3bcf1
Author | SHA1 | Date | |
---|---|---|---|
b40bd3bcf1 | |||
f3efacb784 | |||
cf900f831e |
@ -83,16 +83,29 @@ namespace Comic_CBZ_Helper
|
|||||||
}
|
}
|
||||||
int totalFolders = comicFolders.Count;
|
int totalFolders = comicFolders.Count;
|
||||||
int processedFolders = 0;
|
int processedFolders = 0;
|
||||||
object consoleLock = new();
|
|
||||||
|
|
||||||
// 设置初始日期
|
// 设置初始日期
|
||||||
DateTime currentDate = new(2020, 1, 1, 0, 0, 0);
|
DateTime currentDate = new(2020, 1, 1, 0, 0, 0);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int timeInc = 7;
|
||||||
|
|
||||||
|
// 寻找合适的日期增加量
|
||||||
|
DateTime tempDate = currentDate;
|
||||||
|
while (tempDate.AddHours(comicFolders.Count * timeInc) >= DateTime.Now)
|
||||||
|
{
|
||||||
|
timeInc--;
|
||||||
|
if (timeInc == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("日期增加量无效,请修改代码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tempDate = currentDate;
|
||||||
|
}
|
||||||
|
Console.WriteLine($"日期增加量为{timeInc}小时");
|
||||||
|
|
||||||
// 循环处理每个漫画文件夹
|
// 循环处理每个漫画文件夹
|
||||||
foreach (var comicFolder in comicFolders)
|
foreach (var comicFolder in comicFolders)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"开始处理漫画 {Path.GetFileName(comicFolder)}...");
|
|
||||||
|
|
||||||
// 检查漫画文件夹是否存在
|
// 检查漫画文件夹是否存在
|
||||||
if (!Directory.Exists(comicFolder))
|
if (!Directory.Exists(comicFolder))
|
||||||
{
|
{
|
||||||
@ -100,6 +113,19 @@ namespace Comic_CBZ_Helper
|
|||||||
return; //stop
|
return; //stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成 CBZ 文件名为漫画文件夹的名称
|
||||||
|
string cbzFileName = Path.Combine(outputFolder, $"{Path.GetFileName(comicFolder)}.cbz");
|
||||||
|
|
||||||
|
// 检查 CBZ 文件是否已经存在,若存在则跳过当前漫画文件夹的处理
|
||||||
|
if (File.Exists(cbzFileName))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"CBZ 文件 {cbzFileName} 已存在,跳过。");
|
||||||
|
count++;
|
||||||
|
processedFolders++;
|
||||||
|
currentDate = currentDate.AddHours(timeInc);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 临时存储重命名后的文件路径
|
// 临时存储重命名后的文件路径
|
||||||
string tempFolder = Path.Combine(comicFolder, "temp");
|
string tempFolder = Path.Combine(comicFolder, "temp");
|
||||||
// 检查 temp 文件夹是否存在,如果存在,则删除
|
// 检查 temp 文件夹是否存在,如果存在,则删除
|
||||||
@ -122,17 +148,6 @@ namespace Comic_CBZ_Helper
|
|||||||
// Sort the imageFiles using the NaturalSortComparer
|
// Sort the imageFiles using the NaturalSortComparer
|
||||||
Array.Sort(imageFiles, new NaturalSortComparer());
|
Array.Sort(imageFiles, new NaturalSortComparer());
|
||||||
|
|
||||||
// 生成 CBZ 文件名为漫画文件夹的名称
|
|
||||||
string cbzFileName = Path.Combine(outputFolder, $"{Path.GetFileName(comicFolder)}.cbz");
|
|
||||||
|
|
||||||
// 检查 CBZ 文件是否已经存在,若存在则跳过当前漫画文件夹的处理
|
|
||||||
if (File.Exists(cbzFileName))
|
|
||||||
{
|
|
||||||
Console.WriteLine($"CBZ 文件 {cbzFileName} 已存在,跳过。");
|
|
||||||
count++;
|
|
||||||
processedFolders++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建新的 temp 文件夹
|
// 创建新的 temp 文件夹
|
||||||
Directory.CreateDirectory(tempFolder);
|
Directory.CreateDirectory(tempFolder);
|
||||||
@ -168,11 +183,11 @@ namespace Comic_CBZ_Helper
|
|||||||
Directory.Delete(tempFolder, true);
|
Directory.Delete(tempFolder, true);
|
||||||
|
|
||||||
// 增加日期
|
// 增加日期
|
||||||
currentDate = currentDate.AddHours(7);
|
currentDate = currentDate.AddHours(timeInc);
|
||||||
count++;
|
count++;
|
||||||
|
processedFolders++;
|
||||||
|
|
||||||
Console.WriteLine($"漫画文件夹 {comicFolder} 转换完成。");
|
Console.WriteLine($"漫画文件夹 {comicFolder} 转换完成。");
|
||||||
processedFolders++;
|
|
||||||
ShowProgress(processedFolders, totalFolders);
|
ShowProgress(processedFolders, totalFolders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user