Localize UI text and add copy progress bar

This commit is contained in:
2025-11-13 19:20:28 +01:00
parent f71e8989db
commit 299007a8e3
14 changed files with 183 additions and 84 deletions

View File

@@ -1,12 +1,15 @@
using Windows.Win32.Foundation;
#pragma warning disable CA1416
using Windows.Win32.Foundation;
using Windows.Win32.System.Memory;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using static Windows.Win32.PInvoke;
using static BadBuilder.Formatter.Constants;
namespace BadBuilder.Formatter
{
[SupportedOSPlatform("windows")]
static class Utilities
{
internal static byte[] StructToBytes<T>(T @struct) where T : struct
@@ -80,7 +83,7 @@ namespace BadBuilder.Formatter
fixed (byte* pData = &data[0])
{
if (!WriteFile(new HANDLE(hDevice.DangerousGetHandle()), pData, numberOfSectors * bytesPerSector, null, null))
ExitWithError($"Unable to write sectors to FAT32 device, exiting. GetLastError: {Marshal.GetLastWin32Error()}");
ExitWithError($"Sektoren konnten nicht auf das FAT32-Gerät geschrieben werden. Beende mit Fehler. GetLastError: {Marshal.GetLastWin32Error()}");
}
}
@@ -100,7 +103,7 @@ namespace BadBuilder.Formatter
writeSize = (numberOfSectors > burstSize) ? burstSize : numberOfSectors;
if (!WriteFile(new HANDLE(hDevice.DangerousGetHandle()), pZeroSector, writeSize * bytesPerSector, null, null))
ExitWithError($"Unable to write sectors to FAT32 device, exiting. GetLastError: {Marshal.GetLastWin32Error()}");
ExitWithError($"Sektoren konnten nicht auf das FAT32-Gerät geschrieben werden. Beende mit Fehler. GetLastError: {Marshal.GetLastWin32Error()}");
numberOfSectors -= writeSize;
}