fix incorrect date value

This commit is contained in:
Chenx221 2024-08-29 00:37:15 +08:00
parent 9440d5a065
commit cf900f831e

View File

@ -83,7 +83,6 @@ namespace Comic_CBZ_Helper
}
int totalFolders = comicFolders.Count;
int processedFolders = 0;
object consoleLock = new();
// 设置初始日期
DateTime currentDate = new(2020, 1, 1, 0, 0, 0);
@ -91,8 +90,6 @@ namespace Comic_CBZ_Helper
// 循环处理每个漫画文件夹
foreach (var comicFolder in comicFolders)
{
Console.WriteLine($"开始处理漫画 {Path.GetFileName(comicFolder)}...");
// 检查漫画文件夹是否存在
if (!Directory.Exists(comicFolder))
{
@ -100,6 +97,19 @@ namespace Comic_CBZ_Helper
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(7);
continue;
}
// 临时存储重命名后的文件路径
string tempFolder = Path.Combine(comicFolder, "temp");
// 检查 temp 文件夹是否存在,如果存在,则删除
@ -122,17 +132,6 @@ namespace Comic_CBZ_Helper
// Sort the imageFiles using the 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 文件夹
Directory.CreateDirectory(tempFolder);
@ -170,9 +169,9 @@ namespace Comic_CBZ_Helper
// 增加日期
currentDate = currentDate.AddHours(7);
count++;
processedFolders++;
Console.WriteLine($"漫画文件夹 {comicFolder} 转换完成。");
processedFolders++;
ShowProgress(processedFolders, totalFolders);
}