Add meta and settings json
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using ALttPRandomizer.Azure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class SeedService {
|
||||
@@ -11,12 +12,28 @@
|
||||
|
||||
private AzureStorage AzureStorage { get; }
|
||||
|
||||
public async Task<IDictionary<string, string>> GetSeed(string seedId) {
|
||||
public async Task<IDictionary<string, object>> GetSeed(string seedId) {
|
||||
var files = await this.AzureStorage.GetFiles(seedId);
|
||||
|
||||
var result = new Dictionary<string, string>();
|
||||
foreach (var file in files) {
|
||||
result[file.Key] = Convert.ToBase64String(file.Value.ToMemory().ToArray());
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
if (files.TryGetValue("settings.json", out var settingsData)) {
|
||||
var json = JsonDocument.Parse(settingsData.ToString());
|
||||
result["settings"] = json;
|
||||
}
|
||||
|
||||
if (files.TryGetValue("meta.json", out var metaData)) {
|
||||
var json = JsonDocument.Parse(metaData.ToString());
|
||||
result["meta"] = json;
|
||||
}
|
||||
|
||||
if (files.TryGetValue("spoiler.json", out var spoilerData)) {
|
||||
var json = JsonDocument.Parse(spoilerData.ToString());
|
||||
result["spoiler"] = json;
|
||||
}
|
||||
|
||||
if (files.TryGetValue("patch.bps", out var patchData)) {
|
||||
result["patch.bps"] = Convert.ToBase64String(patchData.ToArray());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user