Move types to dedicated cs files

This commit is contained in:
Gustave Monce
2024-03-06 23:04:07 +01:00
parent 445399055e
commit 2c2ec52494
10 changed files with 343 additions and 114 deletions
+33
View File
@@ -0,0 +1,33 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public enum AppType : byte
{
Min,
UEFI,
BOOT,
Max
};
}
+33
View File
@@ -0,0 +1,33 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public enum DeviceLogType
{
Min,
Flashing,
Servicing,
Max
}
}
+47
View File
@@ -0,0 +1,47 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public struct DeviceTargetingInfo
{
public string Manufacturer;
public string Family;
public string ProductName;
public string ProductVersion;
public string SKUNumber;
public string BaseboardManufacturer;
public string BaseboardProduct;
public override readonly string ToString()
{
return "Manufacturer: " + Manufacturer +
" - Family: " + Family +
" - Product Name: " + ProductName +
" - Product Version: " + ProductVersion +
" - SKU Number: " + SKUNumber +
" - Baseboard Manufacturer: " + BaseboardManufacturer +
" - Baseboard Product: " + BaseboardProduct;
}
}
}
+41
View File
@@ -0,0 +1,41 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public struct FlashAppInfo
{
public byte ProtocolMajorVersion;
public byte ProtocolMinorVersion;
public byte ImplementationMajorVersion;
public byte ImplementationMinorVersion;
public override readonly string ToString()
{
return "ProtocolMajorVersion: " + ProtocolMajorVersion +
" - ProtocolMinorVersion: " + ProtocolMinorVersion +
" - ImplementationMajorVersion: " + ImplementationMajorVersion +
" - ImplementationMinorVersion: " + ImplementationMinorVersion;
}
}
}
+31
View File
@@ -0,0 +1,31 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public enum Mode : byte
{
DiagnosticMode,
Max
}
}
+39
View File
@@ -0,0 +1,39 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public struct ResetProtectionInfo
{
public bool IsResetProtectionEnabled;
public uint MajorVersion;
public uint MinorVersion;
public override readonly string ToString()
{
return "IsResetProtectionEnabled: " + IsResetProtectionEnabled +
" - MajorVersion: " + MajorVersion +
" - MinorVersion: " + MinorVersion;
}
}
}
+37
View File
@@ -0,0 +1,37 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace UnifiedFlashingPlatform
{
public struct USBSpeed
{
public byte CurrentUSBSpeed;
public byte MaxUSBSpeed;
public override readonly string ToString()
{
return "CurrentUSBSpeed: " + CurrentUSBSpeed +
" - MaxUSBSpeed: " + MaxUSBSpeed;
}
}
}
+41
View File
@@ -0,0 +1,41 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
namespace UnifiedFlashingPlatform
{
public struct UefiVariable
{
public UefiVariableAttributes Attributes;
public uint DataSize;
public byte[] Data;
public override readonly string ToString()
{
return "Attributes: " + Attributes +
" - DataSize: " + DataSize +
" - Data: " + BitConverter.ToString(Data);
}
}
}
+41
View File
@@ -0,0 +1,41 @@
/*
* MIT License
*
* Copyright (c) 2024 The DuoWOA authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
namespace UnifiedFlashingPlatform
{
[Flags]
public enum UefiVariableAttributes : uint
{
EfiVariableNone,
EfiVariableNonVolatile,
EfiVariableBootServiceAccess,
EfiVariableRuntimeAccess = 4U,
EfiVariableHardwareErrorRecord = 8U,
EfiVariableAuthenticatedWriteAccess = 16U,
EfiVariableTimeBasedAuthenticatedWriteAccess = 32U,
EfiVariableAppendWrite = 64U,
EfiVariableEnhancedAuthenticatedAccess = 128U
}
}
-114
View File
@@ -125,14 +125,6 @@ namespace UnifiedFlashingPlatform
return Encoding.ASCII.GetString(Bytes).Trim('\0');
}
public enum AppType : byte
{
Min,
UEFI,
BOOT,
Max
};
public AppType ReadAppType()
{
byte[] Bytes = ReadParam("APPT");
@@ -149,20 +141,6 @@ namespace UnifiedFlashingPlatform
return AppType.Min;
}
public struct ResetProtectionInfo
{
public bool IsResetProtectionEnabled;
public uint MajorVersion;
public uint MinorVersion;
public override readonly string ToString()
{
return "IsResetProtectionEnabled: " + IsResetProtectionEnabled +
" - MajorVersion: " + MajorVersion +
" - MinorVersion: " + MinorVersion;
}
}
public ResetProtectionInfo? ReadResetProtection()
{
byte[] Bytes = ReadParam("ATRP");
@@ -263,28 +241,6 @@ namespace UnifiedFlashingPlatform
return ReadStringParam("DPR\0");
}
public struct DeviceTargetingInfo
{
public string Manufacturer;
public string Family;
public string ProductName;
public string ProductVersion;
public string SKUNumber;
public string BaseboardManufacturer;
public string BaseboardProduct;
public override readonly string ToString()
{
return "Manufacturer: " + Manufacturer +
" - Family: " + Family +
" - Product Name: " + ProductName +
" - Product Version: " + ProductVersion +
" - SKU Number: " + SKUNumber +
" - Baseboard Manufacturer: " + BaseboardManufacturer +
" - Baseboard Product: " + BaseboardProduct;
}
}
public DeviceTargetingInfo? ReadDeviceTargetInfo()
{
byte[] Bytes = ReadParam("DTI\0");
@@ -398,22 +354,6 @@ namespace UnifiedFlashingPlatform
return BitConverter.ToUInt32(Bytes.Reverse().ToArray());
}
public struct FlashAppInfo
{
public byte ProtocolMajorVersion;
public byte ProtocolMinorVersion;
public byte ImplementationMajorVersion;
public byte ImplementationMinorVersion;
public override readonly string ToString()
{
return "ProtocolMajorVersion: " + ProtocolMajorVersion +
" - ProtocolMinorVersion: " + ProtocolMinorVersion +
" - ImplementationMajorVersion: " + ImplementationMajorVersion +
" - ImplementationMinorVersion: " + ImplementationMinorVersion;
}
}
public FlashAppInfo? ReadFlashAppInfo()
{
byte[] Bytes = ReadParam("FAI\0");
@@ -494,34 +434,6 @@ namespace UnifiedFlashingPlatform
return Bytes[0] == 1;
}
[Flags]
public enum UefiVariableAttributes : uint
{
EfiVariableNone,
EfiVariableNonVolatile,
EfiVariableBootServiceAccess,
EfiVariableRuntimeAccess = 4U,
EfiVariableHardwareErrorRecord = 8U,
EfiVariableAuthenticatedWriteAccess = 16U,
EfiVariableTimeBasedAuthenticatedWriteAccess = 32U,
EfiVariableAppendWrite = 64U,
EfiVariableEnhancedAuthenticatedAccess = 128U
}
public struct UefiVariable
{
public UefiVariableAttributes Attributes;
public uint DataSize;
public byte[] Data;
public override readonly string ToString()
{
return "Attributes: " + Attributes +
" - DataSize: " + DataSize +
" - Data: " + BitConverter.ToString(Data);
}
}
public UefiVariable? ReadUEFIVariable(Guid Guid, string Name, uint Size)
{
byte[] Request = new byte[39 + (Name.Length + 1) * 2];
@@ -601,14 +513,6 @@ namespace UnifiedFlashingPlatform
return BitConverter.ToUInt64(Bytes.Reverse().ToArray());
}
public enum DeviceLogType
{
Min,
Flashing,
Servicing,
Max
}
public UInt64? ReadLogSize(DeviceLogType LogType)
{
byte[] Request = new byte[0x10];
@@ -640,12 +544,6 @@ namespace UnifiedFlashingPlatform
return ReadStringParam("MAC\0");
}
public enum Mode : byte
{
DiagnosticMode,
Max
}
public UInt32? ReadModeData(Mode Mode)
{
byte[] Request = new byte[0x10];
@@ -781,18 +679,6 @@ namespace UnifiedFlashingPlatform
return ReadStringParam("UKTF");
}
public struct USBSpeed
{
public byte CurrentUSBSpeed;
public byte MaxUSBSpeed;
public override readonly string ToString()
{
return "CurrentUSBSpeed: " + CurrentUSBSpeed +
" - MaxUSBSpeed: " + MaxUSBSpeed;
}
}
public USBSpeed? ReadUSBSpeed()
{
byte[] Bytes = ReadParam("USBS");