2022-12-05 18:19:18 +01:00
|
|
|
|
public class Program {
|
|
|
|
|
static void Main(string[] args) {
|
2022-12-06 16:53:10 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
string beforeUpdate() {
|
2023-01-12 22:38:29 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
Update.copyEverthingBeforeUpdateToBackupLocation();
|
|
|
|
|
Update.zipAllContentInBackupLocation("pre-backup.zip");
|
|
|
|
|
Update.zipPacmanDatabase();
|
2023-01-13 14:28:52 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
return "pre-backup complete";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string postUpdate() {
|
2023-01-14 04:03:43 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
Update.copyEverthingAfterUpdateToBackupLocation();
|
|
|
|
|
Update.zipAllContentInBackupLocation("post-backup.zip");
|
|
|
|
|
Update.copyEverthingFromBackupLocationToFinalDestination(args[0]);
|
2023-01-14 04:03:43 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
return "post-backup complete";
|
2023-01-14 04:03:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
string testPacmanDatabase() {
|
2023-01-14 04:03:43 +01:00
|
|
|
|
|
2023-02-01 03:17:45 +01:00
|
|
|
|
Update.zipPacmanDatabase();
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Yellow;
|
|
|
|
|
return "Test complete";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use https://learn.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?redirectedfrom=MSDN&view=net-7.0
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
switch(args[1]) {
|
|
|
|
|
case "pre-backup":
|
|
|
|
|
beforeUpdate();
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
break;
|
|
|
|
|
case "post-backup":
|
|
|
|
|
postUpdate();
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
break;
|
|
|
|
|
case "testPacmanDatabase":
|
|
|
|
|
testPacmanDatabase();
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Console.WriteLine("Wait! How did you do that?");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
|
|
|
Console.WriteLine(e.Message);
|
|
|
|
|
}
|
2022-12-05 18:08:45 +01:00
|
|
|
|
}
|
2022-12-05 18:19:18 +01:00
|
|
|
|
}
|