RC2BotArchiver/RC2BotArchiver/FixCRF2Archive.cs
2024-07-06 16:33:06 +02:00

17 lines
No EOL
542 B
C#

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));
}
}
}