优化代码

This commit is contained in:
Chenx221 2024-09-16 17:25:58 +08:00
parent 4e3c9aa311
commit d86f91f6c7

View File

@ -33,6 +33,14 @@ namespace Comic_Compressor
return; return;
} }
Console.WriteLine("目标格式0 - webp, 1 - avif, 2 - JXL(JPEG-XL), 3 - JPG, 4 - PNG, 5 - BMP, 6 - 保留原格式");
string? modeInput = Console.ReadLine();
if (modeInput == null)
{
Console.WriteLine("无效格式");
return;
}
Console.WriteLine("使用预设质量(默认使用)(y/n)"); Console.WriteLine("使用预设质量(默认使用)(y/n)");
string? input = Console.ReadLine()?.Trim().ToLower(); string? input = Console.ReadLine()?.Trim().ToLower();
bool usePresetQuality = input == null || input == "" || input == "y" || input == "yes"; bool usePresetQuality = input == null || input == "" || input == "y" || input == "yes";
@ -54,14 +62,6 @@ namespace Comic_Compressor
} }
} }
Console.WriteLine("目标格式0 - webp, 1 - avif, 2 - JXL(JPEG-XL), 3 - JPG, 4 - PNG, 5 - BMP, 6 - 保留原格式");
string? modeInput = Console.ReadLine();
if (modeInput == null)
{
Console.WriteLine("无效格式");
return;
}
switch (modeInput) switch (modeInput)
{ {
case "0": case "0":