From 3f3b32287800b05f7f80bf7b0c41ffef573c7fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferit=20Yi=C4=9Fit=20BALABAN?= Date: Sun, 31 Oct 2021 22:37:52 +0300 Subject: [PATCH] Refactoring and clean up 2 --- src/Extensions.cs | 8 ++------ src/Program.cs | 10 ++-------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Extensions.cs b/src/Extensions.cs index f607933..4ed233c 100644 --- a/src/Extensions.cs +++ b/src/Extensions.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace processor @@ -12,7 +9,7 @@ namespace processor internal static string RemoveComment(string text) { int idx = text.LastIndexOf("#"); - return idx > 0 ? text.Substring(0, idx) : text; + return idx > 0 ? text[..idx] : text; } /// @@ -71,7 +68,6 @@ namespace processor _ => 0 }; - double sum; string mantissa = new(new[] { '.', bin[4], bin[5], bin[6], bin[7] }); switch (exp) { @@ -88,7 +84,7 @@ namespace processor string[] parts = mantissa.Split('.'); - sum = Convert.ToInt32(parts[0], 2); + double sum = Convert.ToInt32(parts[0], 2); for (int i = 0; i < parts[1].Length; i++) sum += int.Parse(parts[1][i].ToString()) / Math.Pow(2, i + 1); diff --git a/src/Program.cs b/src/Program.cs index 7f81bec..2227138 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,18 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace processor { - static class Program + internal static class Program { - /// - /// The main entry point for the application. - /// [STAThread] - static void Main() + private static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles();