Skip to content

Commit

Permalink
Make MaxFileSize global constant
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Jan 26, 2024
1 parent 6d0bcaa commit c9d2325
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Pkmds.Web/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
public static class Constants
{
public const string SelectedSlotStyle = "border: 4px solid orange; border-radius: 6px;";

public const long MaxFileSize = 8_000_000L; // bytes
}
3 changes: 1 addition & 2 deletions Pkmds.Web/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ private async Task OnSystemPreferenceChanged(bool newValue)

private void DrawerToggle() => AppService.ToggleDrawer();

private const long MaxFileSize = 5_000_000L; // bytes
private IBrowserFile? browserLoadSaveFile;

private async Task ShowLoadSaveFileDialogAsync()
Expand All @@ -57,7 +56,7 @@ private async Task LoadSaveFileAsync()
AppState.SelectedBoxSlotNumber = null;
AppState.ShowProgressIndicator = true;

await using var fileStream = browserLoadSaveFile.OpenReadStream(MaxFileSize);
await using var fileStream = browserLoadSaveFile.OpenReadStream(Constants.MaxFileSize);
using var memoryStream = new MemoryStream();
await fileStream.CopyToAsync(memoryStream);
var data = memoryStream.ToArray();
Expand Down

0 comments on commit c9d2325

Please sign in to comment.