From 90edc9cb8dc7ef9427338dc83f0af4e02c9109e4 Mon Sep 17 00:00:00 2001 From: sewer56lol Date: Wed, 19 Sep 2018 19:34:45 +0100 Subject: [PATCH] Include Simple C# GUI Application --- {csharp-test => csharp-prs-GUI}/App.config | 6 +- csharp-prs-GUI/MainForm.Designer.cs | 147 +++++++++++++++++ csharp-prs-GUI/MainForm.cs | 128 +++++++++++++++ csharp-prs-GUI/MainForm.resx | 120 ++++++++++++++ csharp-prs-GUI/Program.cs | 22 +++ .../Properties/AssemblyInfo.cs | 6 +- .../Properties/Resources.Designer.cs | 71 +++++++++ csharp-prs-GUI/Properties/Resources.resx | 117 ++++++++++++++ .../Properties/Settings.Designer.cs | 30 ++++ csharp-prs-GUI/Properties/Settings.settings | 7 + csharp-prs-GUI/csharp-prs-GUI.csproj | 150 ++++++++++++++++++ csharp-prs-GUI/packages.config | 4 + csharp-test/Program.cs | 42 ----- csharp-test/csharp-test.csproj | 99 ------------ dlang-prs.sln | 28 ++-- 15 files changed, 816 insertions(+), 161 deletions(-) rename {csharp-test => csharp-prs-GUI}/App.config (59%) create mode 100644 csharp-prs-GUI/MainForm.Designer.cs create mode 100644 csharp-prs-GUI/MainForm.cs create mode 100644 csharp-prs-GUI/MainForm.resx create mode 100644 csharp-prs-GUI/Program.cs rename {csharp-test => csharp-prs-GUI}/Properties/AssemblyInfo.cs (89%) create mode 100644 csharp-prs-GUI/Properties/Resources.Designer.cs create mode 100644 csharp-prs-GUI/Properties/Resources.resx create mode 100644 csharp-prs-GUI/Properties/Settings.Designer.cs create mode 100644 csharp-prs-GUI/Properties/Settings.settings create mode 100644 csharp-prs-GUI/csharp-prs-GUI.csproj create mode 100644 csharp-prs-GUI/packages.config delete mode 100644 csharp-test/Program.cs delete mode 100644 csharp-test/csharp-test.csproj diff --git a/csharp-test/App.config b/csharp-prs-GUI/App.config similarity index 59% rename from csharp-test/App.config rename to csharp-prs-GUI/App.config index d1428ad..88fa402 100644 --- a/csharp-test/App.config +++ b/csharp-prs-GUI/App.config @@ -1,6 +1,6 @@ - + - + - + \ No newline at end of file diff --git a/csharp-prs-GUI/MainForm.Designer.cs b/csharp-prs-GUI/MainForm.Designer.cs new file mode 100644 index 0000000..aa8cdfd --- /dev/null +++ b/csharp-prs-GUI/MainForm.Designer.cs @@ -0,0 +1,147 @@ +namespace csharp_prs_GUI +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.nud_SearchBufferSize = new System.Windows.Forms.NumericUpDown(); + this.lbl_SearchBufferSize = new System.Windows.Forms.Label(); + this.btn_CompressDragDrop = new System.Windows.Forms.Button(); + this.btn_DecompressDragDrop = new System.Windows.Forms.Button(); + this.lbl_SearchBufferSizeDescription = new System.Windows.Forms.Label(); + this.lbl_SearchBufferSizeDescription2 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.nud_SearchBufferSize)).BeginInit(); + this.SuspendLayout(); + // + // nud_SearchBufferSize + // + this.nud_SearchBufferSize.Location = new System.Drawing.Point(184, 176); + this.nud_SearchBufferSize.Maximum = new decimal(new int[] { + 8191, + 0, + 0, + 0}); + this.nud_SearchBufferSize.Name = "nud_SearchBufferSize"; + this.nud_SearchBufferSize.Size = new System.Drawing.Size(121, 20); + this.nud_SearchBufferSize.TabIndex = 0; + this.nud_SearchBufferSize.Value = new decimal(new int[] { + 255, + 0, + 0, + 0}); + // + // lbl_SearchBufferSize + // + this.lbl_SearchBufferSize.AutoSize = true; + this.lbl_SearchBufferSize.Location = new System.Drawing.Point(6, 178); + this.lbl_SearchBufferSize.Name = "lbl_SearchBufferSize"; + this.lbl_SearchBufferSize.Size = new System.Drawing.Size(167, 13); + this.lbl_SearchBufferSize.TabIndex = 1; + this.lbl_SearchBufferSize.Text = "Search Buffer Size (Compression):"; + // + // btn_CompressDragDrop + // + this.btn_CompressDragDrop.AllowDrop = true; + this.btn_CompressDragDrop.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; + this.btn_CompressDragDrop.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; + this.btn_CompressDragDrop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_CompressDragDrop.Location = new System.Drawing.Point(8, 16); + this.btn_CompressDragDrop.Name = "btn_CompressDragDrop"; + this.btn_CompressDragDrop.Size = new System.Drawing.Size(144, 155); + this.btn_CompressDragDrop.TabIndex = 2; + this.btn_CompressDragDrop.Text = "Drag and Drop Files Here to Compress"; + this.btn_CompressDragDrop.UseVisualStyleBackColor = true; + this.btn_CompressDragDrop.DragDrop += new System.Windows.Forms.DragEventHandler(this.btn_CompressDragDrop_DragDrop); + this.btn_CompressDragDrop.DragEnter += new System.Windows.Forms.DragEventHandler(this.btn_CompressDragDrop_DragEnter); + // + // btn_DecompressDragDrop + // + this.btn_DecompressDragDrop.AllowDrop = true; + this.btn_DecompressDragDrop.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; + this.btn_DecompressDragDrop.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; + this.btn_DecompressDragDrop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_DecompressDragDrop.Location = new System.Drawing.Point(160, 16); + this.btn_DecompressDragDrop.Name = "btn_DecompressDragDrop"; + this.btn_DecompressDragDrop.Size = new System.Drawing.Size(144, 155); + this.btn_DecompressDragDrop.TabIndex = 3; + this.btn_DecompressDragDrop.Text = "Drag and Drop Files Here to Decompress"; + this.btn_DecompressDragDrop.UseVisualStyleBackColor = true; + this.btn_DecompressDragDrop.DragDrop += new System.Windows.Forms.DragEventHandler(this.btn_DecompressDragDrop_DragDrop); + this.btn_DecompressDragDrop.DragEnter += new System.Windows.Forms.DragEventHandler(this.btn_DecompressDragDrop_DragEnter); + // + // lbl_SearchBufferSizeDescription + // + this.lbl_SearchBufferSizeDescription.AutoSize = true; + this.lbl_SearchBufferSizeDescription.Location = new System.Drawing.Point(6, 200); + this.lbl_SearchBufferSizeDescription.Name = "lbl_SearchBufferSizeDescription"; + this.lbl_SearchBufferSizeDescription.Size = new System.Drawing.Size(297, 13); + this.lbl_SearchBufferSizeDescription.TabIndex = 4; + this.lbl_SearchBufferSizeDescription.Text = "Lower values = Less compressed files but faster compression."; + // + // lbl_SearchBufferSizeDescription2 + // + this.lbl_SearchBufferSizeDescription2.AutoSize = true; + this.lbl_SearchBufferSizeDescription2.Location = new System.Drawing.Point(6, 224); + this.lbl_SearchBufferSizeDescription2.Name = "lbl_SearchBufferSizeDescription2"; + this.lbl_SearchBufferSizeDescription2.Size = new System.Drawing.Size(284, 13); + this.lbl_SearchBufferSizeDescription2.TabIndex = 5; + this.lbl_SearchBufferSizeDescription2.Text = "Range: 0-8191 | See Github for Search Buffer Benchmarks\r\n"; + // + // MainForm + // + this.AllowDrop = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(313, 249); + this.Controls.Add(this.lbl_SearchBufferSizeDescription2); + this.Controls.Add(this.lbl_SearchBufferSizeDescription); + this.Controls.Add(this.btn_DecompressDragDrop); + this.Controls.Add(this.btn_CompressDragDrop); + this.Controls.Add(this.lbl_SearchBufferSize); + this.Controls.Add(this.nud_SearchBufferSize); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "MainForm"; + this.Text = "Basic Compressor GUI"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); + ((System.ComponentModel.ISupportInitialize)(this.nud_SearchBufferSize)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown nud_SearchBufferSize; + private System.Windows.Forms.Label lbl_SearchBufferSize; + private System.Windows.Forms.Button btn_CompressDragDrop; + private System.Windows.Forms.Button btn_DecompressDragDrop; + private System.Windows.Forms.Label lbl_SearchBufferSizeDescription; + private System.Windows.Forms.Label lbl_SearchBufferSizeDescription2; + } +} + diff --git a/csharp-prs-GUI/MainForm.cs b/csharp-prs-GUI/MainForm.cs new file mode 100644 index 0000000..779e228 --- /dev/null +++ b/csharp-prs-GUI/MainForm.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using csharp_prs; + +namespace csharp_prs_GUI +{ + public partial class MainForm : Form + { + // Name of the directory relative to application directory to which all files are output. + public const string TempDirectoryName = "temp-output"; + + public MainForm() + { + InitializeComponent(); + } + + /* + ----------- + Drag Events + ----------- + */ + + /* + Change Mouse Cursor & Target Drop Effect on Drag Enter with Files + */ + private void btn_CompressDragDrop_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Copy; + } + + private void btn_DecompressDragDrop_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Copy; + } + + + /* + Process each file in a DragDrop operation. + */ + private void btn_CompressDragDrop_DragDrop(object sender, DragEventArgs e) + { + // Get files dropped onto button and process them. + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + PrepareOutputFolder(); + + int searchBufferSize = (int)nud_SearchBufferSize.Value; + ParallelOptions options = new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }; + Parallel.ForEach(files, file => + { + byte[] decompressedFile = File.ReadAllBytes(file); + byte[] compressedFile = Prs.Compress(ref decompressedFile, searchBufferSize); + + string fileName = Path.GetFileName(file); + File.WriteAllBytes($"{TempDirectoryName}\\{fileName}", compressedFile); + }); + + // Open directory + Process.Start(TempDirectoryName); + } + + private void btn_DecompressDragDrop_DragDrop(object sender, DragEventArgs e) + { + // Get files dropped onto button and process them. + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + PrepareOutputFolder(); + + ParallelOptions options = new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }; + Parallel.ForEach(files, file => + { + byte[] compressedFile = File.ReadAllBytes(file); + byte[] decompressedFile = Prs.Decompress(ref compressedFile); + + string fileName = Path.GetFileName(file); + File.WriteAllBytes($"{TempDirectoryName}\\{fileName}", decompressedFile); + }); + + // Open directory + Process.Start(TempDirectoryName); + } + + /* + ---------------------------- + Compress/Decompress Routines + ---------------------------- + */ + + public void PrepareOutputFolder() + { + if (! Directory.Exists(TempDirectoryName)) + Directory.CreateDirectory(TempDirectoryName); + else + ClearDirectory(new DirectoryInfo(TempDirectoryName)); + } + + + /// + /// Removes all files from a specific directory and subdirectories. + /// + public static void ClearDirectory(DirectoryInfo directory) + { + foreach (FileInfo file in directory.GetFiles()) + file.Delete(); + + foreach (DirectoryInfo subDirectory in directory.GetDirectories()) + subDirectory.Delete(true); + } + + /// + /// Cleanup our temp folder. + /// + private void MainForm_FormClosed(object sender, FormClosedEventArgs e) + { + if (Directory.Exists(TempDirectoryName)) + new DirectoryInfo(TempDirectoryName).Delete(true); + } + } +} diff --git a/csharp-prs-GUI/MainForm.resx b/csharp-prs-GUI/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/csharp-prs-GUI/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp-prs-GUI/Program.cs b/csharp-prs-GUI/Program.cs new file mode 100644 index 0000000..870f2ed --- /dev/null +++ b/csharp-prs-GUI/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace csharp_prs_GUI +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/csharp-test/Properties/AssemblyInfo.cs b/csharp-prs-GUI/Properties/AssemblyInfo.cs similarity index 89% rename from csharp-test/Properties/AssemblyInfo.cs rename to csharp-prs-GUI/Properties/AssemblyInfo.cs index 1f1d2ef..2f61d9d 100644 --- a/csharp-test/Properties/AssemblyInfo.cs +++ b/csharp-prs-GUI/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("csharp-test")] +[assembly: AssemblyTitle("csharp-prs-GUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("csharp-test")] +[assembly: AssemblyProduct("csharp-prs-GUI")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("69b35408-3d4e-4bcc-95b7-bf7275fbc457")] +[assembly: Guid("29196666-227e-495b-bb76-9d1768151e29")] // Version information for an assembly consists of the following four values: // diff --git a/csharp-prs-GUI/Properties/Resources.Designer.cs b/csharp-prs-GUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..f82c885 --- /dev/null +++ b/csharp-prs-GUI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace csharp_prs_GUI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // 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.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + 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() + { + } + + /// + /// 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)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("csharp_prs_GUI.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 + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/csharp-prs-GUI/Properties/Resources.resx b/csharp-prs-GUI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/csharp-prs-GUI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp-prs-GUI/Properties/Settings.Designer.cs b/csharp-prs-GUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c6896f0 --- /dev/null +++ b/csharp-prs-GUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace csharp_prs_GUI.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 + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/csharp-prs-GUI/Properties/Settings.settings b/csharp-prs-GUI/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/csharp-prs-GUI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/csharp-prs-GUI/csharp-prs-GUI.csproj b/csharp-prs-GUI/csharp-prs-GUI.csproj new file mode 100644 index 0000000..af29aa9 --- /dev/null +++ b/csharp-prs-GUI/csharp-prs-GUI.csproj @@ -0,0 +1,150 @@ + + + + + Debug + AnyCPU + {29196666-227E-495B-BB76-9D1768151E29} + WinExe + csharp_prs_GUI + csharp-prs-GUI + v4.5.2 + 512 + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + + ..\packages\csharp-prs.2.0.0\lib\net45\AdvancedDLSupport.dll + + + ..\packages\csharp-prs.2.0.0\lib\net45\csharp-prs.dll + + + ..\packages\csharp-prs.2.0.0\lib\net45\Mono.DllMap.dll + + + ..\packages\csharp-prs.2.0.0\lib\net45\StrictEmit.dll + + + + + ..\packages\csharp-prs.2.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\csharp-prs.2.0.0\lib\net45\System.ValueTuple.dll + + + + + + + + + + + + + + Form + + + MainForm.cs + + + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/csharp-prs-GUI/packages.config b/csharp-prs-GUI/packages.config new file mode 100644 index 0000000..ff02700 --- /dev/null +++ b/csharp-prs-GUI/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/csharp-test/Program.cs b/csharp-test/Program.cs deleted file mode 100644 index a3c29da..0000000 --- a/csharp-test/Program.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using csharp_prs; - -namespace csharp_test -{ - class Program - { - static void Main(string[] args) - { - // If you get Access violation executing location... remember to switch project type from executable to DLL for D project. - // Benchmark Time! - Stopwatch stopwatch = new Stopwatch(); - - // Preload file - byte[] test = File.ReadAllBytes("test.bin"); - - // Benchmark: Compress 1/4 search buffer size and write to file - stopwatch.Start(); - byte[] compressed = Prs.Compress(ref test, 0x7FF); - stopwatch.Stop(); - - // Decompressed - File.WriteAllBytes("zcompressed.prs", compressed); - byte[] decompressed = Prs.Decompress(ref compressed); - File.WriteAllBytes("zdecompressed.prs", decompressed); - - // Actually release memory (check if it works) - GC.Collect(); - - // Show results - Console.WriteLine("Compress time (wrapper): " + stopwatch.ElapsedMilliseconds); - Console.ReadLine(); - } - } -} diff --git a/csharp-test/csharp-test.csproj b/csharp-test/csharp-test.csproj deleted file mode 100644 index f72ba77..0000000 --- a/csharp-test/csharp-test.csproj +++ /dev/null @@ -1,99 +0,0 @@ - - - - - Debug - AnyCPU - {69B35408-3D4E-4BCC-95B7-BF7275FBC457} - Exe - csharp_test - csharp-test - v4.5 - 512 - true - - - - AnyCPU - true - full - false - ..\build\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - ..\build\ - TRACE - prompt - 4 - - - true - ..\build\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - ..\build\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - true - ..\build\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - true - - - ..\build\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - true - - - - - - - - - - - - - - - - - - - - - {8f1d9d07-0cbb-4a00-a083-b86de70ff83a} - csharp-prs - - - - \ No newline at end of file diff --git a/dlang-prs.sln b/dlang-prs.sln index 5a519c3..a96c016 100644 --- a/dlang-prs.sln +++ b/dlang-prs.sln @@ -4,13 +4,13 @@ VisualStudioVersion = 15.0.27703.2026 MinimumVisualStudioVersion = 10.0.40219.1 Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "dlang-prs", ".dub\dlang-prs.visualdproj", "{5B0175B6-D62D-4780-9EB2-52E451CF9CE3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp-test", "csharp-test\csharp-test.csproj", "{69B35408-3D4E-4BCC-95B7-BF7275FBC457}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp-prs", "csharp-prs\csharp-prs.csproj", "{8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}" ProjectSection(ProjectDependencies) = postProject {5B0175B6-D62D-4780-9EB2-52E451CF9CE3} = {5B0175B6-D62D-4780-9EB2-52E451CF9CE3} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp-prs-GUI", "csharp-prs-GUI\csharp-prs-GUI.csproj", "{29196666-227E-495B-BB76-9D1768151E29}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug|Any CPU = debug|Any CPU @@ -31,18 +31,6 @@ Global {5B0175B6-D62D-4780-9EB2-52E451CF9CE3}.release|Win32.Build.0 = release|Win32 {5B0175B6-D62D-4780-9EB2-52E451CF9CE3}.release|x64.ActiveCfg = release|x64 {5B0175B6-D62D-4780-9EB2-52E451CF9CE3}.release|x64.Build.0 = release|x64 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|Any CPU.ActiveCfg = Debug|Any CPU - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|Any CPU.Build.0 = Debug|Any CPU - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|Win32.ActiveCfg = Debug|x86 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|Win32.Build.0 = Debug|x86 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|x64.ActiveCfg = Debug|x64 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.debug|x64.Build.0 = Debug|x64 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|Any CPU.ActiveCfg = Release|Any CPU - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|Any CPU.Build.0 = Release|Any CPU - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|Win32.ActiveCfg = Release|x86 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|Win32.Build.0 = Release|x86 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|x64.ActiveCfg = Release|x64 - {69B35408-3D4E-4BCC-95B7-BF7275FBC457}.release|x64.Build.0 = Release|x64 {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.debug|Any CPU.ActiveCfg = Debug|Any CPU {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.debug|Any CPU.Build.0 = Debug|Any CPU {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.debug|Win32.ActiveCfg = Debug|x86 @@ -55,6 +43,18 @@ Global {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.release|Win32.Build.0 = Release|x86 {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.release|x64.ActiveCfg = Release|x64 {8F1D9D07-0CBB-4A00-A083-B86DE70FF83A}.release|x64.Build.0 = Release|x64 + {29196666-227E-495B-BB76-9D1768151E29}.debug|Any CPU.ActiveCfg = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.debug|Any CPU.Build.0 = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.debug|Win32.ActiveCfg = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.debug|Win32.Build.0 = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.debug|x64.ActiveCfg = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.debug|x64.Build.0 = Debug|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.release|Any CPU.ActiveCfg = Release|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.release|Any CPU.Build.0 = Release|Any CPU + {29196666-227E-495B-BB76-9D1768151E29}.release|Win32.ActiveCfg = Release|x86 + {29196666-227E-495B-BB76-9D1768151E29}.release|Win32.Build.0 = Release|x86 + {29196666-227E-495B-BB76-9D1768151E29}.release|x64.ActiveCfg = Release|x64 + {29196666-227E-495B-BB76-9D1768151E29}.release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE