From 21493c1f1231f1563610b4c439bd96e999763cd0 Mon Sep 17 00:00:00 2001 From: drake-vcu <42615139+drake-vcu@users.noreply.github.com> Date: Fri, 12 Oct 2018 21:14:20 -0500 Subject: [PATCH 1/5] Update framework to 4.7.2 --- MergePDF/App.config | 6 ++-- MergePDF/MergePDF.csproj | 4 ++- MergePDF/Properties/Resources.Designer.cs | 44 ++++++++++------------- MergePDF/Properties/Settings.Designer.cs | 22 +++++------- 4 files changed, 33 insertions(+), 43 deletions(-) diff --git a/MergePDF/App.config b/MergePDF/App.config index 731f6de..ecdcf8a 100644 --- a/MergePDF/App.config +++ b/MergePDF/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/MergePDF/MergePDF.csproj b/MergePDF/MergePDF.csproj index be30e8f..f99dc62 100644 --- a/MergePDF/MergePDF.csproj +++ b/MergePDF/MergePDF.csproj @@ -9,7 +9,7 @@ WinExe MergePDF MergePDF - v4.6.1 + v4.7.2 512 true false @@ -29,6 +29,7 @@ true + AnyCPU @@ -94,6 +95,7 @@ True Resources.resx + True Designer diff --git a/MergePDF/Properties/Resources.Designer.cs b/MergePDF/Properties/Resources.Designer.cs index e1ae42c..b78b3ef 100644 --- a/MergePDF/Properties/Resources.Designer.cs +++ b/MergePDF/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace MergePDF.Properties -{ - - +namespace MergePDF.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace MergePDF.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", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MergePDF.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/MergePDF/Properties/Settings.Designer.cs b/MergePDF/Properties/Settings.Designer.cs index e6c71b2..61a239d 100644 --- a/MergePDF/Properties/Settings.Designer.cs +++ b/MergePDF/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace MergePDF.Properties -{ - - +namespace MergePDF.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } From 362c6a5414547071f1dec2700f35b6a60e1bbb1f Mon Sep 17 00:00:00 2001 From: drake-vcu <42615139+drake-vcu@users.noreply.github.com> Date: Fri, 12 Oct 2018 22:19:54 -0500 Subject: [PATCH 2/5] Moved logic to seperate class moved merge logic to seperate class to enable unit testing --- MergePDF/Form1.cs | 35 +++-------------- MergePDF/MergePDF.csproj | 1 + MergePDF/PdfMerger.cs | 84 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 30 deletions(-) create mode 100644 MergePDF/PdfMerger.cs diff --git a/MergePDF/Form1.cs b/MergePDF/Form1.cs index ac317c6..6961bf2 100644 --- a/MergePDF/Form1.cs +++ b/MergePDF/Form1.cs @@ -20,10 +20,7 @@ public partial class Form1 : Form private List Textboxes { get; set; } private List FileDialogs { get; set; } - private List Documents { get; set; } - - // Create a document for the merged result. - private PdfDocument outDocument { get; set; } + private PdfMerger _pdfMerger; private OpenFileDialog openFileDialog { get; set; } private SaveFileDialog saveFileDialog { get; set; } @@ -35,7 +32,7 @@ public Form1() Buttons = new List