2023-05-16 22:54:19 +02:00
|
|
|
|
public class Program {
|
2023-05-16 00:43:47 +02:00
|
|
|
|
static void Main(string[] args) {
|
|
|
|
|
|
2023-06-04 23:44:03 +02:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
2023-05-17 12:18:20 +02:00
|
|
|
|
if (args.Length == 0) {
|
|
|
|
|
Console.WriteLine("Please specify an option.");
|
2023-06-04 23:44:03 +02:00
|
|
|
|
PrintAvailableOptions();
|
|
|
|
|
return;
|
|
|
|
|
} else if (args.Length > 1) {
|
|
|
|
|
Console.WriteLine("Too many options.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
switch (args[0]) {
|
2023-05-17 12:18:20 +02:00
|
|
|
|
case "checksum":
|
|
|
|
|
Console.WriteLine("Starting the checksum process.");
|
|
|
|
|
Console.ResetColor();
|
2023-05-16 00:43:47 +02:00
|
|
|
|
|
2023-05-17 12:18:20 +02:00
|
|
|
|
Chksum.doTheThing();
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
Console.WriteLine("Checksum process finished");
|
|
|
|
|
break;
|
|
|
|
|
case "countmd5":
|
|
|
|
|
Console.WriteLine("Counting md5 checksum files.");
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
|
|
|
|
Chksum.countAllMd5Checksums();
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
Console.WriteLine("Finished counting all md5 checksum files.");
|
|
|
|
|
break;
|
|
|
|
|
case "deletemd5":
|
|
|
|
|
Console.WriteLine("Deleting all md5 checksum files.");
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
|
|
|
|
Chksum.deleteAllMd5Checksums();
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
Console.WriteLine("Deleted all md5 checksum files.");
|
|
|
|
|
break;
|
2023-05-17 14:52:30 +02:00
|
|
|
|
case "compareChecksums":
|
2023-06-04 23:44:03 +02:00
|
|
|
|
Console.WriteLine("Comparing all md5 checksum files. If there is none, creating one.");
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
2023-05-17 14:52:30 +02:00
|
|
|
|
Chksum.compareChecksums();
|
|
|
|
|
break;
|
2023-06-04 23:44:03 +02:00
|
|
|
|
case "help":
|
|
|
|
|
PrintAvailableOptions();
|
|
|
|
|
break;
|
2023-05-17 12:18:20 +02:00
|
|
|
|
default:
|
2023-06-04 23:44:03 +02:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
|
|
|
Console.WriteLine("Invalid option. Maybe you mistyped it?");
|
|
|
|
|
PrintAvailableOptions();
|
2023-05-17 12:18:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2023-06-04 23:44:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void PrintAvailableOptions() {
|
|
|
|
|
String[] options = {
|
|
|
|
|
"checksum",
|
|
|
|
|
"countmd5",
|
|
|
|
|
"deletemd5",
|
|
|
|
|
"compareChecksums",
|
|
|
|
|
"help"
|
|
|
|
|
};
|
2023-05-16 00:43:47 +02:00
|
|
|
|
|
2023-06-04 23:44:03 +02:00
|
|
|
|
Console.ResetColor();
|
|
|
|
|
Console.WriteLine("usage: chksum [option]");
|
|
|
|
|
Console.WriteLine("Here is a list of all available options:");
|
|
|
|
|
foreach (String option in options) {
|
|
|
|
|
Console.WriteLine("\t" + option);
|
|
|
|
|
}
|
2023-05-16 00:43:47 +02:00
|
|
|
|
}
|
|
|
|
|
}
|