From fc557d2500262497a780d0b942864235baaa866f Mon Sep 17 00:00:00 2001 From: AJ Date: Thu, 7 Oct 2021 09:12:38 -0400 Subject: [PATCH] Cleanup --- CutList/App.config | 6 +++--- CutList/Controls/BinLayoutView.cs | 2 +- CutList/Forms/DataGridViewExtensions.cs | 5 ++--- CutList/Forms/MainForm.cs | 5 +---- CutList/Forms/ResultsForm.cs | 9 ++------- CutList/Helper.cs | 5 ++--- CutList/Models/BinInputItem.cs | 8 ++++---- CutList/Models/Item.cs | 6 +++--- CutList/Program.cs | 9 +++------ CutList/Properties/AssemblyInfo.cs | 13 ++++++------- CutList/Tool.cs | 2 +- SawCut/ArchUnits.cs | 5 ++--- SawCut/Bin.cs | 2 +- SawCut/BinItem.cs | 2 +- SawCut/Fraction.cs | 6 +++--- SawCut/MultiBin.cs | 2 +- SawCut/Nesting/BestFitEngine.cs | 2 +- SawCut/Nesting/Engine2.cs | 6 +++--- SawCut/Nesting/IEngine.cs | 2 +- SawCut/Nesting/MultiBinEngine.cs | 5 ++--- SawCut/Nesting/Result.cs | 2 +- SawCut/Properties/AssemblyInfo.cs | 3 +-- 22 files changed, 45 insertions(+), 62 deletions(-) diff --git a/CutList/App.config b/CutList/App.config index ecdcf8a..a0d2eaa 100644 --- a/CutList/App.config +++ b/CutList/App.config @@ -1,6 +1,6 @@ - - + + - + \ No newline at end of file diff --git a/CutList/Controls/BinLayoutView.cs b/CutList/Controls/BinLayoutView.cs index c8f1d98..d3ab0a5 100644 --- a/CutList/Controls/BinLayoutView.cs +++ b/CutList/Controls/BinLayoutView.cs @@ -79,4 +79,4 @@ namespace CutList.Controls e.Graphics.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height); } } -} +} \ No newline at end of file diff --git a/CutList/Forms/DataGridViewExtensions.cs b/CutList/Forms/DataGridViewExtensions.cs index 75ccdeb..313e4c9 100644 --- a/CutList/Forms/DataGridViewExtensions.cs +++ b/CutList/Forms/DataGridViewExtensions.cs @@ -5,7 +5,7 @@ namespace CutList.Forms { public static class DataGridViewExtensions { - static readonly StringFormat CenterVerticallyFormat = new StringFormat + private static readonly StringFormat CenterVerticallyFormat = new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center @@ -25,7 +25,6 @@ namespace CutList.Forms headerBounds, CenterVerticallyFormat); }; - } } -} +} \ No newline at end of file diff --git a/CutList/Forms/MainForm.cs b/CutList/Forms/MainForm.cs index a748745..4620d9c 100644 --- a/CutList/Forms/MainForm.cs +++ b/CutList/Forms/MainForm.cs @@ -2,11 +2,9 @@ using Newtonsoft.Json; using SawCut; using SawCut.Nesting; -using SimpleExpressionEvaluator; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -278,7 +276,6 @@ namespace CutList.Forms private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { - } private void dataGridView2_CellEndEdit(object sender, DataGridViewCellEventArgs e) @@ -287,4 +284,4 @@ namespace CutList.Forms dataGridView2.Refresh(); } } -} +} \ No newline at end of file diff --git a/CutList/Forms/ResultsForm.cs b/CutList/Forms/ResultsForm.cs index 889f64e..609578b 100644 --- a/CutList/Forms/ResultsForm.cs +++ b/CutList/Forms/ResultsForm.cs @@ -1,14 +1,9 @@ using SawCut; 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; namespace CutList.Forms @@ -49,7 +44,7 @@ namespace CutList.Forms s.FileName = name; s.Filter = "Text File|*.txt"; - + if (s.ShowDialog() != DialogResult.OK) { return; @@ -93,4 +88,4 @@ namespace CutList.Forms Process.Start(file); } } -} +} \ No newline at end of file diff --git a/CutList/Helper.cs b/CutList/Helper.cs index 3697695..ac5c4a6 100644 --- a/CutList/Helper.cs +++ b/CutList/Helper.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; namespace CutList { - static class Helper + internal static class Helper { public static double GetLengthInches(TextBox tb) { @@ -20,7 +20,6 @@ namespace CutList var x = ArchUnits.ParseToInches(tb.Text); tb.ForeColor = SystemColors.WindowText; return x; - } catch { @@ -29,4 +28,4 @@ namespace CutList } } } -} +} \ No newline at end of file diff --git a/CutList/Models/BinInputItem.cs b/CutList/Models/BinInputItem.cs index 225ea21..6cdfd9e 100644 --- a/CutList/Models/BinInputItem.cs +++ b/CutList/Models/BinInputItem.cs @@ -53,9 +53,9 @@ namespace CutList.Models public string TotalLengthString { - get - { - return TotalLength.HasValue ? ArchUnits.FormatFromInches(TotalLength.Value) : "-"; + get + { + return TotalLength.HasValue ? ArchUnits.FormatFromInches(TotalLength.Value) : "-"; } } @@ -63,4 +63,4 @@ namespace CutList.Models public int Priority { get; set; } = 10; } -} +} \ No newline at end of file diff --git a/CutList/Models/Item.cs b/CutList/Models/Item.cs index ff811a0..b49e19e 100644 --- a/CutList/Models/Item.cs +++ b/CutList/Models/Item.cs @@ -42,17 +42,17 @@ namespace CutList.Models [JsonIgnore] public double? TotalLength { - get + get { var length = Length; if (length == null) return null; - return Math.Round(length.Value * Quantity, 8); + return Math.Round(length.Value * Quantity, 8); } } public int Quantity { get; set; } = 1; } -} +} \ No newline at end of file diff --git a/CutList/Program.cs b/CutList/Program.cs index e4bb7a6..15dc03d 100644 --- a/CutList/Program.cs +++ b/CutList/Program.cs @@ -1,22 +1,19 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace CutList { - static class Program + internal static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main() + private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Forms.MainForm()); } } -} +} \ No newline at end of file diff --git a/CutList/Properties/AssemblyInfo.cs b/CutList/Properties/AssemblyInfo.cs index 08fac54..d852b86 100644 --- a/CutList/Properties/AssemblyInfo.cs +++ b/CutList/Properties/AssemblyInfo.cs @@ -1,8 +1,7 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// 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("CutList")] @@ -14,8 +13,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,12 +24,12 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/CutList/Tool.cs b/CutList/Tool.cs index 16e92b4..fde034b 100644 --- a/CutList/Tool.cs +++ b/CutList/Tool.cs @@ -13,4 +13,4 @@ return Name; } } -} +} \ No newline at end of file diff --git a/SawCut/ArchUnits.cs b/SawCut/ArchUnits.cs index e54f410..1dd8d9d 100644 --- a/SawCut/ArchUnits.cs +++ b/SawCut/ArchUnits.cs @@ -1,7 +1,6 @@ using System; -using System.Text.RegularExpressions; using System.Text; -using SawCut; +using System.Text.RegularExpressions; namespace SawCut { @@ -73,4 +72,4 @@ namespace SawCut } } } -} +} \ No newline at end of file diff --git a/SawCut/Bin.cs b/SawCut/Bin.cs index 6c697d5..964b1c3 100644 --- a/SawCut/Bin.cs +++ b/SawCut/Bin.cs @@ -45,4 +45,4 @@ namespace SawCut return $"Length: {totalLength}, {remainingLength} remaining, {Items.Count} items, {utilitation}% utilization"; } } -} +} \ No newline at end of file diff --git a/SawCut/BinItem.cs b/SawCut/BinItem.cs index 21c5bae..03bea6f 100644 --- a/SawCut/BinItem.cs +++ b/SawCut/BinItem.cs @@ -6,4 +6,4 @@ public double Length { get; set; } } -} +} \ No newline at end of file diff --git a/SawCut/Fraction.cs b/SawCut/Fraction.cs index fea5448..5634ad0 100644 --- a/SawCut/Fraction.cs +++ b/SawCut/Fraction.cs @@ -1,7 +1,7 @@ using System; -using System.Text.RegularExpressions; -using System.Text; using System.Linq; +using System.Text; +using System.Text.RegularExpressions; namespace SawCut { @@ -82,4 +82,4 @@ namespace SawCut return true; } } -} +} \ No newline at end of file diff --git a/SawCut/MultiBin.cs b/SawCut/MultiBin.cs index 83b3682..5098990 100644 --- a/SawCut/MultiBin.cs +++ b/SawCut/MultiBin.cs @@ -8,4 +8,4 @@ public int Priority { get; set; } } -} +} \ No newline at end of file diff --git a/SawCut/Nesting/BestFitEngine.cs b/SawCut/Nesting/BestFitEngine.cs index b99030c..e67717b 100644 --- a/SawCut/Nesting/BestFitEngine.cs +++ b/SawCut/Nesting/BestFitEngine.cs @@ -103,4 +103,4 @@ namespace SawCut.Nesting return (found != null); } } -} +} \ No newline at end of file diff --git a/SawCut/Nesting/Engine2.cs b/SawCut/Nesting/Engine2.cs index 2f63ab0..d1fe402 100644 --- a/SawCut/Nesting/Engine2.cs +++ b/SawCut/Nesting/Engine2.cs @@ -57,7 +57,7 @@ namespace SawCut.Nesting FillBin(bin); int count = 0; - + while (TryImprovePacking(bin)) { count++; @@ -71,7 +71,7 @@ namespace SawCut.Nesting .ThenBy(b => b.Items.Count) .ToList(); } - + private void FillBin(Bin bin) { for (int i = 0; i < Items.Count; i++) @@ -155,4 +155,4 @@ namespace SawCut.Nesting return false; } } -} +} \ No newline at end of file diff --git a/SawCut/Nesting/IEngine.cs b/SawCut/Nesting/IEngine.cs index e3cab54..6efc997 100644 --- a/SawCut/Nesting/IEngine.cs +++ b/SawCut/Nesting/IEngine.cs @@ -6,4 +6,4 @@ namespace SawCut.Nesting { Result Pack(List items); } -} +} \ No newline at end of file diff --git a/SawCut/Nesting/MultiBinEngine.cs b/SawCut/Nesting/MultiBinEngine.cs index 7ac4ace..3b935cc 100644 --- a/SawCut/Nesting/MultiBinEngine.cs +++ b/SawCut/Nesting/MultiBinEngine.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace SawCut.Nesting @@ -67,4 +66,4 @@ namespace SawCut.Nesting return result; } } -} +} \ No newline at end of file diff --git a/SawCut/Nesting/Result.cs b/SawCut/Nesting/Result.cs index baac25a..54b2e93 100644 --- a/SawCut/Nesting/Result.cs +++ b/SawCut/Nesting/Result.cs @@ -14,4 +14,4 @@ namespace SawCut.Nesting public List Bins { get; set; } } -} +} \ No newline at end of file diff --git a/SawCut/Properties/AssemblyInfo.cs b/SawCut/Properties/AssemblyInfo.cs index 2f25e23..36487f5 100644 --- a/SawCut/Properties/AssemblyInfo.cs +++ b/SawCut/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file