This commit is contained in:
Chenx221 2024-08-27 14:41:03 +08:00
parent 55b19f6976
commit e403e27d22
3 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -6,7 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<StartupObject>ConsoleApp1.Program</StartupObject>
<StartupObject></StartupObject>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
</Project>

View File

@ -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);