Fix CRF2 archive
This commit is contained in:
parent
231cc0f7c0
commit
88d3ede9ff
2 changed files with 21 additions and 1 deletions
17
RC2BotArchiver/FixCRF2Archive.cs
Normal file
17
RC2BotArchiver/FixCRF2Archive.cs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,9 @@ using RC2BotArchiver;
|
||||||
|
|
||||||
Console.WriteLine("Hello, World!");
|
Console.WriteLine("Hello, World!");
|
||||||
|
|
||||||
var client = new HttpClient();
|
FixCRF2Archive.FixIt();
|
||||||
|
|
||||||
|
/*var client = new HttpClient();
|
||||||
|
|
||||||
async Task<JsonElement?> GetResponse(HttpResponseMessage result, string url)
|
async Task<JsonElement?> GetResponse(HttpResponseMessage result, string url)
|
||||||
{
|
{
|
||||||
|
@ -93,3 +95,4 @@ foreach (var result in results.EnumerateArray())
|
||||||
await DownloadImages.DoIt(client);
|
await DownloadImages.DoIt(client);
|
||||||
|
|
||||||
// TODO: Chart of amount of bots on CRF by date & amount of starter bots
|
// TODO: Chart of amount of bots on CRF by date & amount of starter bots
|
||||||
|
*/
|
Loading…
Reference in a new issue