diff --git a/RC2BotArchiver/FixCRF2Archive.cs b/RC2BotArchiver/FixCRF2Archive.cs new file mode 100644 index 0000000..20b4ce8 --- /dev/null +++ b/RC2BotArchiver/FixCRF2Archive.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Nodes; + +namespace RC2BotArchiver; + +public static class FixCRF2Archive +{ + public static void FixIt() + { + foreach (var directory in Directory.EnumerateDirectories("robots")) + { + var meta = File.ReadAllText(Path.Combine(directory, "robotData.json")); + var metadata = JsonNode.Parse(meta); + var data = metadata!["data"]!.AsValue().GetValue(); + File.WriteAllBytes(Path.Combine(directory, "robot.rc2"), Convert.FromBase64String(data)); + } + } +} \ No newline at end of file diff --git a/RC2BotArchiver/Program.cs b/RC2BotArchiver/Program.cs index 7fa4f1f..d013bd6 100644 --- a/RC2BotArchiver/Program.cs +++ b/RC2BotArchiver/Program.cs @@ -10,7 +10,9 @@ using RC2BotArchiver; Console.WriteLine("Hello, World!"); -var client = new HttpClient(); +FixCRF2Archive.FixIt(); + +/*var client = new HttpClient(); async Task GetResponse(HttpResponseMessage result, string url) { @@ -93,3 +95,4 @@ foreach (var result in results.EnumerateArray()) await DownloadImages.DoIt(client); // TODO: Chart of amount of bots on CRF by date & amount of starter bots +*/ \ No newline at end of file