Skip to content

Commit 40eb4cb

Browse files
committed
ran code cleanup
1 parent 1ba2f5a commit 40eb4cb

File tree

13 files changed

+27
-94
lines changed

13 files changed

+27
-94
lines changed

minitool/Commands/Boot.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
1+
using CommandLine;
82
using System.Diagnostics;
93

104
namespace minitool.Commands;

minitool/Commands/Console.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
1+
using CommandLine;
82
using minitool.Enums;
93
using minitool.Models;
104
using System.IO.Ports;
@@ -18,7 +12,7 @@ public class Options
1812
{
1913
[Value(0, Required = true, HelpText = "The port number of the minipad.")]
2014
public int Port { get; private set; }
21-
15+
2216
public Options() { }
2317
}
2418

@@ -63,7 +57,7 @@ public static int Handle(Options options)
6357

6458
// Ask for user input in a loop and only exit if the user types an exit keyword.
6559
string input = "";
66-
while(true)
60+
while (true)
6761
{
6862
// Ask for user input.
6963
Console.Write($"{device.Configuration.Name} ({device.PortName})> ");

minitool/Commands/Devices.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
using minitool.Models;
1+
using CommandLine;
92
using minitool.Enums;
3+
using minitool.Models;
104

115
namespace minitool.Commands;
126

@@ -40,7 +34,7 @@ public static int Handle(Options options)
4034
devices.Add(port, null);
4135
}
4236
}
43-
37+
4438
// Output all connected devices, including their name, COM port and state.
4539
Console.WriteLine($"List of connected minipads ({devices.Where(x => x.Value?.State == DeviceState.CONNECTED).Count()} connected, " +
4640
$"{devices.Where(x => x.Value?.State == DeviceState.BUSY).Count()} busy):");

minitool/Commands/Flash.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
using minitool.Models;
1+
using CommandLine;
92
using minitool.Enums;
3+
using minitool.Models;
104
using System.Diagnostics;
115

126
namespace minitool.Commands;
@@ -99,7 +93,7 @@ public static int Handle(Options options)
9993

10094
// Waiting for a new drive to appear.
10195
Console.WriteLine("Waiting for bootloader...");
102-
while(Environment.GetLogicalDrives().SequenceEqual(drives))
96+
while (Environment.GetLogicalDrives().SequenceEqual(drives))
10397
Thread.Sleep(100);
10498

10599
// Get the drive letter of the new drive and copy the firmware file on it.

minitool/Commands/Info.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
1+
using CommandLine;
2+
using minitool.Enums;
83
using minitool.Models;
94
using minitool.Utils;
10-
using minitool.Enums;
11-
using System.Diagnostics;
125

136
namespace minitool.Commands;
147

minitool/Commands/Send.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
using minitool.Models;
1+
using CommandLine;
92
using minitool.Enums;
3+
using minitool.Models;
104
using Console = System.Console;
115

126
namespace minitool.Commands;

minitool/Commands/Visualize.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
using CommandLine.Text;
2-
using CommandLine;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
1+
using CommandLine;
82
using minitool.Enums;
93
using minitool.Models;
10-
using System.IO.Ports;
11-
using System.Diagnostics;
124

135
namespace minitool.Commands;
146
public static class Visualize
@@ -79,7 +71,7 @@ public static int Handle(Options options)
7971

8072
// Calculate the total width available for the visualizer bar, based on the console width, prefix and suffix.
8173
int totalWidth = Console.WindowWidth - prefix.Length - suffix.Length - 3;
82-
int width = (int) Math.Ceiling(mappedValues[i] / (device.Configuration.TravelDistance.Value * 1d / totalWidth));
74+
int width = (int)Math.Ceiling(mappedValues[i] / (device.Configuration.TravelDistance.Value * 1d / totalWidth));
8375

8476
// Print the line, including prefix, visualizer bar and suffix.
8577
Console.Write(prefix);

minitool/Enums/DeviceState.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace minitool.Enums;
1+
namespace minitool.Enums;
82

93
/// <summary>
104
/// The state of the device.

minitool/Models/MinipadDevice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class MinipadDevice
3333
/// The configuration of the keypad.
3434
/// </summary>
3535
public Configuration Configuration { get; }
36-
36+
3737
/// <summary>
3838
/// Initialize a new MinipadDevice instance with the specified COM port, firmware version and configuration.
3939
/// </summary>

minitool/Program.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
using CommandLine;
2-
using CommandLine.Text;
32
using minitool.Commands;
4-
using minitool.Models;
5-
using minitool.Utils;
6-
using System;
73
using System.Diagnostics;
84
using System.Globalization;
9-
using System.Security.Cryptography.X509Certificates;
105

116
namespace minitool
127
{
@@ -27,7 +22,7 @@ public static void Main(string[] args)
2722
// If the application was ran by executing the exe file from the desktop environment, rather than the commandline,
2823
// open a new commandline window and run the application from there. This helps users that are not that familiar with CLI.
2924
// This check can be done by looking whether no args are specified and the cursor is all the way at the top.
30-
if(args.Length == 0 && Console.CursorTop == 0)
25+
if (args.Length == 0 && Console.CursorTop == 0)
3126
{
3227
// Run a CMD session and initially print the help text to guide the user on how to start.
3328
Process.Start(new ProcessStartInfo("cmd.exe", "/k minitool help")

0 commit comments

Comments
 (0)