This repository was archived by the owner on Jul 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
77 lines (59 loc) · 3.35 KB
/
Copy pathProgram.cs
File metadata and controls
77 lines (59 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
namespace DriveFiller
{
internal static class Program
{
private static async Task Main(string[] args)
{
InputHelper.SetWindowTitle("DriveFiller");
string driveLetter = InputHelper.GetAnswer("Drive letter for the drive you want to fill: ");
Logger.SetActive(InputHelper.YesNo("Log the results?"));
bool random = InputHelper.YesNo("Variable file-size?");
if (random)
{
int minValue = InputHelper.GetValidatedAnswer($"Minimum value for the variable file-size (measured in MB) (default {UtilsHelper.ConvertStorage(DriveUtilities.minSize)}): ", InputHelper.ValidInteger);
int maxValue = InputHelper.GetValidatedAnswer($"Maximum value for the variable file-size (measured in MB) (default {UtilsHelper.ConvertStorage(DriveUtilities.maxSize)}): ", InputHelper.ValidInteger);
while (minValue > maxValue)
{
Console.WriteLine("Invalid answer. Minimum value is bigger than maximum. Please try again.");
minValue = InputHelper.GetValidatedAnswer($"Minimum value for the variable file-size (measured in MB) (default {UtilsHelper.ConvertStorage(DriveUtilities.minSize)}): ", InputHelper.ValidInteger);
maxValue = InputHelper.GetValidatedAnswer($"Maximum value for the variable file-size (measured in MB) (default {UtilsHelper.ConvertStorage(DriveUtilities.maxSize)}): ", InputHelper.ValidInteger);
}
DriveUtilities.UpdateSizes(minValue, maxValue);
}
else
{
int fixedValue = InputHelper.GetValidatedAnswer($"Fixed value for the file-size (measured in MB) (default {UtilsHelper.ConvertStorage(DriveUtilities.fixedSize)}): ", InputHelper.ValidInteger);
DriveUtilities.UpdateSizes(fixedValue);
}
var drive = DriveUtilities.GetDrive(driveLetter);
if (drive == null)
{
InputHelper.ExitApplication("Drive does not exist. Exiting...");
return;
}
Console.Clear();
bool continueAnswer = InputHelper.YesNoLoop("The drive filler can be stopped anytime by pressing any key on the command prompt window, keep in mind, use the program at your own risk, do you wish to continue?");
if (!continueAnswer)
{
InputHelper.ExitApplication("User cancelled action. Exiting...");
return;
}
Console.Clear();
Logger.AddLog($"Started drive filler on drive {drive.Name} at {DateTime.Now}");
Logger.AddLog($"Settings: VARIABLE_FILESIZE={random};");
if (random)
{
Logger.AddLog($"MIN_SIZE={UtilsHelper.ConvertStorage(DriveUtilities.minSize)}; MAX_SIZE={UtilsHelper.ConvertStorage(DriveUtilities.maxSize)};");
}
else
{
Logger.AddLog($"FIXED_SIZE={UtilsHelper.ConvertStorage(DriveUtilities.fixedSize)}");
}
await DriveUtilities.FillDrive(random, drive);
await DriveUtilities.CleanupMess(drive);
Logger.AddSpacedLog($"Finished at {DateTime.Now}");
Logger.WriteLogToDisk();
InputHelper.ExitApplication("Finished the work!", true);
}
}
}