@page "/Dev/Options" @using ArcaneLibs.Extensions @using System.Text.Unicode @using System.Text @using System.Text.Json @inject NavigationManager NavigationManager @inject ILocalStorageService LocalStorage Developer options

Rory&::MatrixUtils - Developer options


Import local storage:

Export local storage:

@if (userSettings is not null) {


}
@code { private MRUStorageWrapper.Settings? userSettings { get; set; } protected override async Task OnInitializedAsync() { // userSettings = await TieredStorage.DataStorageProvider.LoadObjectAsync("mru.settings"); await base.OnInitializedAsync(); } private async Task LogStuff() { await Task.Delay(100); Console.WriteLine($"Settings: {userSettings.ToJson()}"); await TieredStorage.DataStorageProvider.SaveObjectAsync("mru.settings", userSettings); } private async Task ExportLocalStorage() { var keys = await TieredStorage.DataStorageProvider.GetAllKeysAsync(); var data = new Dictionary(); foreach (var key in keys) { data.Add(key, await TieredStorage.DataStorageProvider.LoadObjectAsync(key)); } var dataUri = "data:application/json;base64,"; dataUri += Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonSerializer.Serialize(data))); await JSRuntime.InvokeVoidAsync("window.open", dataUri, "_blank"); } private async Task ImportLocalStorage(InputFileChangeEventArgs obj) { if (obj.FileCount != 1) return; var data = await JsonSerializer.DeserializeAsync>(obj.File.OpenReadStream()); foreach (var (key, value) in data) { await TieredStorage.DataStorageProvider.SaveObjectAsync(key, value); } NavigationManager.NavigateTo(NavigationManager.Uri, true, true); } }