From e403e27d22465a6ca280921db9e5b0e457796633 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Tue, 27 Aug 2024 14:41:03 +0800 Subject: [PATCH] update --- Comic_CBZ_Helper.sln | 8 +++++++- Comic_CBZ_Helper/Comic_CBZ_Helper.csproj | 3 ++- Comic_CBZ_Helper/Program.cs | 12 ++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Comic_CBZ_Helper.sln b/Comic_CBZ_Helper.sln index d3674c8..1f91a5c 100644 --- a/Comic_CBZ_Helper.sln +++ b/Comic_CBZ_Helper.sln @@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.34928.147 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Comic_CBZ_Helper", "Comic_CBZ_Helper\Comic_CBZ_Helper.csproj", "{B1629CAD-82CB-4532-98DA-B3CCDEFE9963}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Comic_CBZ_Helper", "Comic_CBZ_Helper\Comic_CBZ_Helper.csproj", "{B1629CAD-82CB-4532-98DA-B3CCDEFE9963}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Debug|x64.ActiveCfg = Debug|x64 + {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Debug|x64.Build.0 = Debug|x64 {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Release|Any CPU.Build.0 = Release|Any CPU + {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Release|x64.ActiveCfg = Release|x64 + {B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Comic_CBZ_Helper/Comic_CBZ_Helper.csproj b/Comic_CBZ_Helper/Comic_CBZ_Helper.csproj index 5319713..32fab99 100644 --- a/Comic_CBZ_Helper/Comic_CBZ_Helper.csproj +++ b/Comic_CBZ_Helper/Comic_CBZ_Helper.csproj @@ -6,7 +6,8 @@ enable enable 10.0.19041.0 - ConsoleApp1.Program + + AnyCPU;x64 diff --git a/Comic_CBZ_Helper/Program.cs b/Comic_CBZ_Helper/Program.cs index 6bace53..9ec982a 100644 --- a/Comic_CBZ_Helper/Program.cs +++ b/Comic_CBZ_Helper/Program.cs @@ -4,12 +4,12 @@ using System.Numerics; using System.IO.Compression; using System.Security; -namespace ConsoleApp1 +namespace Comic_CBZ_Helper { class Program { private static readonly object lockObject = new(); - static void Main(string[] args) + static void Main() { // 设置控制台的输出编码为UTF-8 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); @@ -96,14 +96,14 @@ namespace ConsoleApp1 // 确保漫画文件夹中包含图像文件 string[] imageFiles = Directory.GetFiles(comicFolder, "*.*", SearchOption.AllDirectories) - .Where(file => file.ToLower().EndsWith(".jpg") || file.ToLower().EndsWith(".png") || file.ToLower().EndsWith(".webp")) + .Where(file => file.ToLower().EndsWith(".jpg") || file.ToLower().EndsWith(".png") || file.ToLower().EndsWith(".webp") || file.ToLower().EndsWith(".webp") || file.ToLower().EndsWith(".avif")) .ToArray(); if (imageFiles.Length == 0) { lock (consoleLock) { - Console.WriteLine($"在漫画文件夹 {comicFolder} 中未找到任何图像文件 (.jpg , .png or .webp)。"); + Console.WriteLine($"在漫画文件夹 {comicFolder} 中未找到任何图像文件。"); } return; // 继续处理下一个漫画文件夹 } @@ -190,7 +190,7 @@ namespace ConsoleApp1 { Console.CursorLeft = 0; int width = 50; // 进度条宽度 - int progress = (int)((current / (double)total) * width); + int progress = (int)(current / (double)total * width); Console.Write("["); Console.Write(new string('=', progress)); Console.Write(new string(' ', width - progress)); @@ -247,7 +247,7 @@ namespace ConsoleApp1 { if (x == null || y == null) { - return x == null ? (y == null ? 0 : -1) : 1; + return x == null ? y == null ? 0 : -1 : 1; } // Get the file names from the full file paths string fileNameX = Path.GetFileName(x);