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 # Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147 VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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|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.ActiveCfg = Release|Any CPU
{B1629CAD-82CB-4532-98DA-B3CCDEFE9963}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

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

View File

@ -4,12 +4,12 @@ using System.Numerics;
using System.IO.Compression; using System.IO.Compression;
using System.Security; using System.Security;
namespace ConsoleApp1 namespace Comic_CBZ_Helper
{ {
class Program class Program
{ {
private static readonly object lockObject = new(); private static readonly object lockObject = new();
static void Main(string[] args) static void Main()
{ {
// 设置控制台的输出编码为UTF-8 // 设置控制台的输出编码为UTF-8
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
@ -96,14 +96,14 @@ namespace ConsoleApp1
// 确保漫画文件夹中包含图像文件 // 确保漫画文件夹中包含图像文件
string[] imageFiles = Directory.GetFiles(comicFolder, "*.*", SearchOption.AllDirectories) 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(); .ToArray();
if (imageFiles.Length == 0) if (imageFiles.Length == 0)
{ {
lock (consoleLock) lock (consoleLock)
{ {
Console.WriteLine($"在漫画文件夹 {comicFolder} 中未找到任何图像文件 (.jpg , .png or .webp)。"); Console.WriteLine($"在漫画文件夹 {comicFolder} 中未找到任何图像文件。");
} }
return; // 继续处理下一个漫画文件夹 return; // 继续处理下一个漫画文件夹
} }
@ -190,7 +190,7 @@ namespace ConsoleApp1
{ {
Console.CursorLeft = 0; Console.CursorLeft = 0;
int width = 50; // 进度条宽度 int width = 50; // 进度条宽度
int progress = (int)((current / (double)total) * width); int progress = (int)(current / (double)total * width);
Console.Write("["); Console.Write("[");
Console.Write(new string('=', progress)); Console.Write(new string('=', progress));
Console.Write(new string(' ', width - progress)); Console.Write(new string(' ', width - progress));
@ -247,7 +247,7 @@ namespace ConsoleApp1
{ {
if (x == null || y == null) 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 // Get the file names from the full file paths
string fileNameX = Path.GetFileName(x); string fileNameX = Path.GetFileName(x);