Skip to content

Commit acf0880

Browse files
committed
Refactor FormatSize methods; update .NET SDK version
1 parent 485281f commit acf0880

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

WebGUI/Components/Layout/ExperimentalLayout/FileBrowserDialog.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@
333333
}
334334
private void Cancel() => MudDialog.Cancel();
335335

336-
private static string FormatSize(long bytes) => bytes switch
336+
private static string FormatSize(long bytes)
337337
{
338-
< 1024 => $"{bytes} B",
339-
< 1024 * 1024 => $"{bytes / 1024.0:F1} KB",
340-
< 1024 * 1024 * 1024 => $"{bytes / (1024.0 * 1024):F1} MB",
341-
_ => $"{bytes / (1024.0 * 1024 * 1024):F2} GB"
342-
};
338+
if (bytes < 1024) return $"{bytes} B";
339+
if (bytes < 1024 * 1024) return $"{bytes / 1024.0:F1} KB";
340+
if (bytes < 1024L * 1024 * 1024) return $"{bytes / (1024.0 * 1024):F1} MB";
341+
return $"{bytes / (1024.0 * 1024 * 1024):F2} GB";
342+
}
343343

344344
private static string FormatDate(DateTime dt)
345345
{

WebGUI/Components/Pages/ToolsFolder/EretConfigCreator.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,13 @@
650650
netFilter = "";
651651
}
652652

653-
private static string FormatSize(long bytes) => bytes switch
653+
private static string FormatSize(long bytes)
654654
{
655-
< 1024 => $"{bytes} B",
656-
< 1024 * 1024 => $"{bytes / 1024.0:F1} KB",
657-
< 1024 * 1024 * 1024 => $"{bytes / (1024.0 * 1024):F1} MB",
658-
_ => $"{bytes / (1024.0 * 1024 * 1024):F2} GB"
659-
};
655+
if (bytes < 1024) return $"{bytes} B";
656+
if (bytes < 1024 * 1024) return $"{bytes / 1024.0:F1} KB";
657+
if (bytes < 1024L * 1024 * 1024) return $"{bytes / (1024.0 * 1024):F1} MB";
658+
return $"{bytes / (1024.0 * 1024 * 1024):F2} GB";
659+
}
660660

661661
private class EngineEntry
662662
{

WebGUI/Components/Pages/ToolsFolder/PuzzleConfigCreator.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,13 +699,13 @@
699699
netFilter = "";
700700
}
701701

702-
private static string FormatSize(long bytes) => bytes switch
702+
private static string FormatSize(long bytes)
703703
{
704-
< 1024 => $"{bytes} B",
705-
< 1024 * 1024 => $"{bytes / 1024.0:F1} KB",
706-
< 1024 * 1024 * 1024 => $"{bytes / (1024.0 * 1024):F1} MB",
707-
_ => $"{bytes / (1024.0 * 1024 * 1024):F2} GB"
708-
};
704+
if (bytes < 1024) return $"{bytes} B";
705+
if (bytes < 1024 * 1024) return $"{bytes / 1024.0:F1} KB";
706+
if (bytes < 1024L * 1024 * 1024) return $"{bytes / (1024.0 * 1024):F1} MB";
707+
return $"{bytes / (1024.0 * 1024 * 1024):F2} GB";
708+
}
709709

710710
private class EngineEntry
711711
{

WebGUI/global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "10.0.0",
3+
"version": "10.0.100",
44
"rollForward": "latestFeature"
55
}
66
}

0 commit comments

Comments
 (0)