Fix CRF2 archive

This commit is contained in:
Norbi Peti 2024-07-06 16:33:06 +02:00
parent 231cc0f7c0
commit 88d3ede9ff
2 changed files with 21 additions and 1 deletions

View file

@ -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<string>();
File.WriteAllBytes(Path.Combine(directory, "robot.rc2"), Convert.FromBase64String(data));
}
}
}

View file

@ -10,7 +10,9 @@ using RC2BotArchiver;
Console.WriteLine("Hello, World!");
var client = new HttpClient();
FixCRF2Archive.FixIt();
/*var client = new HttpClient();
async Task<JsonElement?> 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
*/