diff --git a/CbrConverter/CbrConverter.csproj b/CbrConverter/CbrConverter.csproj index 02b86d8..4233a1d 100644 --- a/CbrConverter/CbrConverter.csproj +++ b/CbrConverter/CbrConverter.csproj @@ -1,5 +1,5 @@  - + Debug x86 @@ -10,7 +10,7 @@ Properties CbrConverter CbrConverter - v4.0 + v4.7.2 512 @@ -56,27 +56,28 @@ 1335329130_comic-book.ico - - Libraries\Ionic.Zip.Reduced.dll + + ..\packages\BouncyCastle.1.8.6.1\lib\BouncyCastle.Crypto.dll - - False - Libraries\itextsharp.dll + + ..\packages\DotNetZip.1.14.0\lib\net40\DotNetZip.dll - - False - Libraries\SharpCompress.dll + + ..\packages\iTextSharp.5.5.13.2\lib\itextsharp.dll + + + ..\packages\Microsoft.Extensions.FileProviders.Abstractions.3.1.9\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll + + + ..\packages\Microsoft.Extensions.Primitives.3.1.9\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll + + + ..\packages\SharpCompress.0.26.0\lib\net46\SharpCompress.dll - - - - - - + - @@ -121,6 +122,7 @@ True + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/CbrConverter/Converter/Extract.cs b/CbrConverter/Converter/Extract.cs index ac6ab06..c6e1d0a 100644 --- a/CbrConverter/Converter/Extract.cs +++ b/CbrConverter/Converter/Extract.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.IO; using System.Threading; @@ -9,7 +7,7 @@ using System.Drawing; using Ionic.Zip; using System.ComponentModel; -using SharpCompress.Archive; +using SharpCompress.Archives; using SharpCompress.Common; namespace CbrConverter @@ -50,7 +48,7 @@ public void BeginExtraction(bool cbr2pdf, bool pdf2cbz, bool reduceSize, bool de //it's a file so i start the single extraction thread //check if cbr string ext = Path.GetExtension(DataAccess.Instance.g_WorkingFile).ToLower(); - if ((string.Compare(ext, ".cbr") == 0 || (string.Compare(ext, ".cbz") == 0)) && (_Cbr2Pdf)) + if ((string.Compare(ext, ".zip") == 0 || string.Compare(ext, ".rar") == 0 || string.Compare(ext, ".cbr") == 0 || string.Compare(ext, ".cbz") == 0) && _Cbr2Pdf) { Thread extract = new Thread(ConvertCbrToPdf); @@ -163,6 +161,13 @@ private void ConvertCbrToPdf() divider = 50; CurOneStep = divider / CurOneStep; + var options = new ExtractionOptions + { + Overwrite = true, + PreserveAttributes = false, + PreserveFileTime = true + }; + //extract the file into the folder foreach (var entry in archive.Entries) { @@ -171,9 +176,9 @@ private void ConvertCbrToPdf() if (DataAccess.Instance.g_Processing) //this is to stop the thread if stop button is pressed { - string path = Path.Combine(temporaryDir, Path.GetFileName(entry.FilePath)); + string path = Path.Combine(temporaryDir, Path.GetFileName(entry.Key)); //entry.WriteToDirectory(@"C:\temp", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); - entry.WriteToFile(path, ExtractOptions.Overwrite); + entry.WriteToFile(path, options); DataAccess.Instance.g_curProgress += CurOneStep; evnt_UpdateCurBar(); @@ -331,12 +336,12 @@ private void ExtractMultipleFiles(string currentDir, double singval) DataAccess.Instance.g_WorkingFile = file; try { - string ext = Path.GetExtension(DataAccess.Instance.g_WorkingFile); - if (((string.Compare(ext, ".cbr") == 0) || (string.Compare(ext, ".cbz") == 0) || (string.Compare(ext, ".CBZ") == 0) || (string.Compare(ext, ".CBR") == 0)) && (_Cbr2Pdf)) + string ext = Path.GetExtension(DataAccess.Instance.g_WorkingFile).ToLower(); + if (((string.Compare(ext, ".cbr") == 0) || (string.Compare(ext, ".rar") == 0) || (string.Compare(ext, ".cbz") == 0) || (string.Compare(ext, ".zip") == 0)) && (_Cbr2Pdf)) { ConvertCbrToPdf(); } - else if (((string.Compare(ext, ".pdf") == 0) || (string.Compare(ext, ".PDF") == 0)) && (_Pdf2Cbz)) + else if ((string.Compare(ext, ".pdf") == 0) && (_Pdf2Cbz)) { ConvertPdfToCbr(file); } @@ -365,7 +370,8 @@ private void GeneratePdf() var writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create)); document.Open(); - string[] imageFiles = Directory.GetFiles(temporaryDir); + var imageFiles = Directory.GetFiles(temporaryDir).ToList(); + imageFiles.Sort(); //count for progression bar CurOneStep = imageFiles.Count(); @@ -396,7 +402,7 @@ private void GeneratePdf() //checking file extension string ext = Path.GetExtension(imageFile).ToLower(); - if ((string.Compare(ext, ".jpg") == 0) || (string.Compare(ext, ".jpeg") == 0) || (string.Compare(ext, ".png") == 0) || (string.Compare(ext, ".bmp") == 0) || (string.Compare(ext, ".new") == 0)) + if ((string.Compare(ext, ".tif") == 0) || (string.Compare(ext, ".jpg") == 0) || (string.Compare(ext, ".jpeg") == 0) || (string.Compare(ext, ".png") == 0) || (string.Compare(ext, ".bmp") == 0) || (string.Compare(ext, ".new") == 0)) { //var size = iTextSharp.text.PageSize.A4; var img = iTextSharp.text.Image.GetInstance(imageFile); diff --git a/CbrConverter/Properties/Resources.Designer.cs b/CbrConverter/Properties/Resources.Designer.cs index e30a874..ef804b2 100644 --- a/CbrConverter/Properties/Resources.Designer.cs +++ b/CbrConverter/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18051 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace CbrConverter.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/CbrConverter/Properties/Settings.Designer.cs b/CbrConverter/Properties/Settings.Designer.cs index 0060761..531a1b3 100644 --- a/CbrConverter/Properties/Settings.Designer.cs +++ b/CbrConverter/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18051 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace CbrConverter.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/CbrConverter/app.config b/CbrConverter/app.config index e365603..5049824 100644 --- a/CbrConverter/app.config +++ b/CbrConverter/app.config @@ -1,3 +1,28 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CbrConverter/packages.config b/CbrConverter/packages.config new file mode 100644 index 0000000..e192d40 --- /dev/null +++ b/CbrConverter/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Compiled/v1.2/CbrConverter1.2.zip b/Compiled/v1.2/CbrConverter1.2.zip new file mode 100644 index 0000000..43c2f1d Binary files /dev/null and b/Compiled/v1.2/CbrConverter1.2.zip differ diff --git a/Compiled/v1.2/version.txt b/Compiled/v1.2/version.txt new file mode 100644 index 0000000..89a6e74 --- /dev/null +++ b/Compiled/v1.2/version.txt @@ -0,0 +1 @@ +v1.2 diff --git a/README.md b/README.md index 9322298..3e49675 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ What's new in this fork : - You can choose output folder - Error won't pause processing -__Note :__ If you don't have visual studio you can download the executable file here: https://github.com/dragouf/CbrPdfConverter/releases/tag/1.1 +__Note :__ If you don't have visual studio you can download the executable file here: https://github.com/rfog/CbrPdfConverter/blob/master/Compiled/v1.2/CbrConverter1.2.zip

CbrConverter screenshot