V3.x
Moved functionalities to library iMGcompress-core
This commit is contained in:
+17
-22
@@ -22,7 +22,7 @@ using Xabe.FFmpeg;
|
||||
using SharpCompress.Archives;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Common;
|
||||
using itext.pdfimage.Extensions;
|
||||
//using itext.pdfimage.Extensions;
|
||||
using org.omg.PortableInterceptor;
|
||||
using org.apache.pdfbox.util.@operator;
|
||||
using java.nio;
|
||||
@@ -36,12 +36,15 @@ using System.Reflection;
|
||||
using Microsoft.VisualBasic;
|
||||
using BinaryKits.Zpl.Viewer;
|
||||
|
||||
using iMGcompress_core;
|
||||
using Compressor = iMGcompress_core.Compressor;
|
||||
|
||||
namespace ComicCompressor
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
||||
// string progVersion = "Version 2.0.0 - (04/07/2024)";
|
||||
// string progVersion = "Version 2.0.0 - (04/07/2024)";
|
||||
|
||||
// Added copy of non image files with same name
|
||||
//string progVersion = "Version 2.0.1 - (12/08/2024)";
|
||||
@@ -50,8 +53,13 @@ namespace ComicCompressor
|
||||
//string progVersion = "Version 2.0.2 - (27/08/2024)";
|
||||
|
||||
// Completed support for ZEBRA PRN files, generate image and base64 for prn and image. Using URI format for base64 files
|
||||
string progVersion = "Version 2.1.0 - (28/08/2024)";
|
||||
//string progVersion = "Version 2.1.0 - (28/08/2024)";
|
||||
|
||||
// Moved functionalities to library iMGcompress-core
|
||||
//string progVersion = "Version 3.0.0 - (21/11/2024)";
|
||||
|
||||
// In core changed color of percent save to white
|
||||
string progVersion = "Version 3.0.1 - (23/01/2025)";
|
||||
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
|
||||
|
||||
#region INPUT_FLAGS
|
||||
@@ -80,7 +88,6 @@ namespace ComicCompressor
|
||||
[Option("-c|--cpu", Description = "Run in parallel, use given number of CPUs")]
|
||||
public int NumOfCpu { get; } = Environment.ProcessorCount;
|
||||
|
||||
|
||||
[Option("-d|--pdf", Description = "Process pdf only")]
|
||||
public bool DoPdf { get; } = false;
|
||||
|
||||
@@ -96,18 +103,6 @@ namespace ComicCompressor
|
||||
|
||||
#region STATISTICS
|
||||
|
||||
public class file_stat
|
||||
{
|
||||
public string Filename { get; set; }
|
||||
public file_stat(string filename) {
|
||||
Filename = filename;
|
||||
}
|
||||
public long Uncompressed_file_len { get; set; }
|
||||
public long Compressed_file_len { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
static Dictionary <string, file_stat> file_statistics = new Dictionary<string, file_stat>();
|
||||
public static Dictionary<string, file_stat> File_statistics { get => file_statistics; set => file_statistics = value; }
|
||||
|
||||
@@ -141,7 +136,7 @@ namespace ComicCompressor
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
|
||||
Logger = new Logger();
|
||||
Logger.Debug = true;
|
||||
Logger.DebugOn = true;
|
||||
Logger.LoggingLevel = LogLevel.Verbose;
|
||||
|
||||
Logger.Log(progVersion, LogLevel.Verbose, true);
|
||||
@@ -276,7 +271,7 @@ namespace ComicCompressor
|
||||
{
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -293,7 +288,7 @@ namespace ComicCompressor
|
||||
{
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath_webp).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -313,7 +308,7 @@ namespace ComicCompressor
|
||||
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -399,7 +394,7 @@ namespace ComicCompressor
|
||||
|
||||
long lengthin = new System.IO.FileInfo(filename).Length;
|
||||
long lengthout = new System.IO.FileInfo(outputPath).Length;
|
||||
Program.file_stat fs = null;
|
||||
file_stat fs = null;
|
||||
Program.File_statistics.TryGetValue(filename, out fs);
|
||||
if (fs != null)
|
||||
{
|
||||
@@ -441,7 +436,7 @@ namespace ComicCompressor
|
||||
|
||||
try
|
||||
{
|
||||
compressor.Compress(filename, outputPath);
|
||||
compressor.Compress(filename, outputPath, file_statistics);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user