diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f6eb1d70..13a9a1bc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -50,7 +50,7 @@ jobs:
- name: Build CLI utilities
shell: pwsh
run: |
- msbuild /m /t:restore,cli\uupmediaconverter:publish,cli\uupdownload:publish /p:Platform=${{ matrix.architecture }} /p:RuntimeIdentifier=${{ matrix.platform }}-${{ matrix.architecture }} /p:PublishDir=${{ github.workspace }}/artifacts/${{ matrix.platform }}-${{ matrix.architecture }}/CLIs /p:PublishSingleFile=true /p:PublishTrimmed=false /p:Configuration=Release UUPMediaCreator.sln
+ msbuild /m /t:restore,cli\uupmediaconverter:publish,cli\uupdownload:publish /p:Platform=${{ matrix.architecture }} /p:RuntimeIdentifier=${{ matrix.platform }}-${{ matrix.architecture }} /p:PublishDir=${{ github.workspace }}/artifacts/${{ matrix.platform }}-${{ matrix.architecture }}/CLIs /p:PublishSingleFile=true /p:PublishTrimmed=false /p:Configuration=Release /p:IncludeNativeLibrariesForSelfExtract=true UUPMediaCreator.sln
- name: Create PDB Output Directory
shell: pwsh
diff --git a/UUPMediaCreator.sln b/UUPMediaCreator.sln
index 533d36be..e7d12b9b 100644
--- a/UUPMediaCreator.sln
+++ b/UUPMediaCreator.sln
@@ -43,6 +43,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Windows.Internal.Flighting"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground", "src\Applications\Playground\Playground.csproj", "{CB4B918C-3DBD-40AA-99F7-83EF033DB8A8}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting", "src\UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting\UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting.csproj", "{7AFF6421-B605-43F1-B849-D331E979B3B1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.WindowsUpdate.ESRP", "src\UnifiedUpdatePlatform.Services.WindowsUpdate.ESRP\UnifiedUpdatePlatform.Services.WindowsUpdate.ESRP.csproj", "{E5A8D8A2-6219-4632-84EC-8F8BF625A596}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.WindowsUpdate.Models", "src\UnifiedUpdatePlatform.Services.WindowsUpdate.Models\UnifiedUpdatePlatform.Services.WindowsUpdate.Models.csproj", "{D78B2286-F75B-4FE6-990B-84117E722CD4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting.Tests", "src\UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting.Tests\UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting.Tests.csproj", "{95007D84-20A1-4711-9CBC-DEE3B1798E74}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareIds", "src\Applications\ComputerHardwareIds\ComputerHardwareIds.csproj", "{7955FADE-628E-4E41-B48B-350EFB5418E7}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UUPSort", "src\Applications\UUPSort\UUPSort.csproj", "{21630DC1-A538-4198-A2C5-C38D9CDA0FB1}"
EndProject
Global
@@ -419,6 +428,106 @@ Global
{CB4B918C-3DBD-40AA-99F7-83EF033DB8A8}.Release|x64.Build.0 = Release|Any CPU
{CB4B918C-3DBD-40AA-99F7-83EF033DB8A8}.Release|x86.ActiveCfg = Release|Any CPU
{CB4B918C-3DBD-40AA-99F7-83EF033DB8A8}.Release|x86.Build.0 = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|ARM.Build.0 = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|arm64.ActiveCfg = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|arm64.Build.0 = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|x64.Build.0 = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Debug|x86.Build.0 = Debug|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|ARM.ActiveCfg = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|ARM.Build.0 = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|arm64.ActiveCfg = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|arm64.Build.0 = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|x64.ActiveCfg = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|x64.Build.0 = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|x86.ActiveCfg = Release|Any CPU
+ {7AFF6421-B605-43F1-B849-D331E979B3B1}.Release|x86.Build.0 = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|ARM.Build.0 = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|arm64.ActiveCfg = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|arm64.Build.0 = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|x64.Build.0 = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Debug|x86.Build.0 = Debug|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|ARM.ActiveCfg = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|ARM.Build.0 = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|arm64.ActiveCfg = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|arm64.Build.0 = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|x64.ActiveCfg = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|x64.Build.0 = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|x86.ActiveCfg = Release|Any CPU
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596}.Release|x86.Build.0 = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|ARM.Build.0 = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|arm64.ActiveCfg = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|arm64.Build.0 = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|x64.Build.0 = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Debug|x86.Build.0 = Debug|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|ARM.ActiveCfg = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|ARM.Build.0 = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|arm64.ActiveCfg = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|arm64.Build.0 = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|x64.ActiveCfg = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|x64.Build.0 = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|x86.ActiveCfg = Release|Any CPU
+ {D78B2286-F75B-4FE6-990B-84117E722CD4}.Release|x86.Build.0 = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|ARM.Build.0 = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|arm64.ActiveCfg = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|arm64.Build.0 = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|x64.Build.0 = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Debug|x86.Build.0 = Debug|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|ARM.ActiveCfg = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|ARM.Build.0 = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|arm64.ActiveCfg = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|arm64.Build.0 = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|x64.ActiveCfg = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|x64.Build.0 = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|x86.ActiveCfg = Release|Any CPU
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74}.Release|x86.Build.0 = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|ARM.Build.0 = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|arm64.ActiveCfg = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|arm64.Build.0 = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|x64.Build.0 = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Debug|x86.Build.0 = Debug|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|ARM.ActiveCfg = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|ARM.Build.0 = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|arm64.ActiveCfg = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|arm64.Build.0 = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|x64.ActiveCfg = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|x64.Build.0 = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|x86.ActiveCfg = Release|Any CPU
+ {7955FADE-628E-4E41-B48B-350EFB5418E7}.Release|x86.Build.0 = Release|Any CPU
{21630DC1-A538-4198-A2C5-C38D9CDA0FB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21630DC1-A538-4198-A2C5-C38D9CDA0FB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21630DC1-A538-4198-A2C5-C38D9CDA0FB1}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -462,6 +571,11 @@ Global
{1AAC4923-A4E5-41D9-87FA-CFB028F802E5} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
{B86CE874-B470-4294-BF98-21BB603E1F46} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
{CB4B918C-3DBD-40AA-99F7-83EF033DB8A8} = {C4A7DBD6-6FB5-410A-9252-922C7909C82C}
+ {7AFF6421-B605-43F1-B849-D331E979B3B1} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
+ {E5A8D8A2-6219-4632-84EC-8F8BF625A596} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
+ {D78B2286-F75B-4FE6-990B-84117E722CD4} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
+ {95007D84-20A1-4711-9CBC-DEE3B1798E74} = {162FE1A9-890A-4101-AFF8-54F6B1483882}
+ {7955FADE-628E-4E41-B48B-350EFB5418E7} = {C4A7DBD6-6FB5-410A-9252-922C7909C82C}
{21630DC1-A538-4198-A2C5-C38D9CDA0FB1} = {C4A7DBD6-6FB5-410A-9252-922C7909C82C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
diff --git a/publish_win_arm64.cmd b/publish_win_arm64.cmd
index ed1d257f..afc4f0cc 100644
--- a/publish_win_arm64.cmd
+++ b/publish_win_arm64.cmd
@@ -1,3 +1,3 @@
@echo off
-msbuild /m /t:restore,cli\uupmediaconverter:publish,cli\uupdownload:publish /p:Platform=arm64 /p:RuntimeIdentifier=win-arm64 /p:PublishDir=%CD%\publish\artifacts\win-arm64\CLI /p:PublishSingleFile=true /p:PublishTrimmed=false /p:Configuration=Release UUPMediaCreator.sln
\ No newline at end of file
+msbuild /m /t:restore,cli\uupmediaconverter:publish,cli\uupdownload:publish,cli\computerhardwareids:publish /p:Platform=arm64 /p:RuntimeIdentifier=win-arm64 /p:PublishDir=%CD%\publish\artifacts\win-arm64\CLI /p:PublishSingleFile=true /p:PublishTrimmed=false /p:Configuration=Release UUPMediaCreator.sln
\ No newline at end of file
diff --git a/src/Applications/ComputerHardwareIds/ComputerHardwareIds.csproj b/src/Applications/ComputerHardwareIds/ComputerHardwareIds.csproj
new file mode 100644
index 00000000..b8202d58
--- /dev/null
+++ b/src/Applications/ComputerHardwareIds/ComputerHardwareIds.csproj
@@ -0,0 +1,18 @@
+
+
+
+ Exe
+ net8.0-windows10.0.22621
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Applications/ComputerHardwareIds/ComputerInformationFetcher.cs b/src/Applications/ComputerHardwareIds/ComputerInformationFetcher.cs
new file mode 100644
index 00000000..02221d92
--- /dev/null
+++ b/src/Applications/ComputerHardwareIds/ComputerInformationFetcher.cs
@@ -0,0 +1,59 @@
+using Microsoft.Management.Infrastructure;
+using Microsoft.Management.Infrastructure.Options;
+
+namespace ComputerHardwareIds
+{
+ public static class ComputerInformationFetcher
+ {
+ public static (string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ ushort EnclosureType,
+ string BIOSVersion,
+ byte BIOSMajorRelease,
+ byte BIOSMinorRelease) FetchComputerInformation()
+ {
+ using DComSessionOptions dcomSessionOptions = new();
+ using CimSession cimSession = CimSession.Create("localhost", dcomSessionOptions);
+
+ CimInstance result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_BIOS").Single();
+
+ string BIOSVendor = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string BIOSVersionString = (string)result.CimInstanceProperties["SMBIOSBIOSVersion"].Value;
+ byte SystemBIOSMajorRelease = (byte)result.CimInstanceProperties["SystemBiosMajorVersion"].Value;
+ byte SystemBIOSMinorRelease = (byte)result.CimInstanceProperties["SystemBiosMinorVersion"].Value;
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_ComputerSystem").Single();
+
+ string SystemManufacturer = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string SystemFamily = (string)result.CimInstanceProperties["SystemFamily"].Value;
+ string SystemProductName = (string)result.CimInstanceProperties["Model"].Value;
+ string SKUNumber = (string)result.CimInstanceProperties["SystemSKUNumber"].Value;
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_SystemEnclosure").Single();
+
+ ushort SystemEnclosureorChassisType = ((ushort[])result.CimInstanceProperties["ChassisTypes"].Value)[0];
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_BaseBoard").Single();
+
+ string BaseboardManufacturer = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string BaseboardProductName = (string)result.CimInstanceProperties["Product"].Value;
+
+ return (SystemManufacturer,
+ SystemFamily,
+ SystemProductName,
+ SKUNumber,
+ BIOSVendor,
+ BaseboardManufacturer,
+ BaseboardProductName,
+ SystemEnclosureorChassisType,
+ BIOSVersionString,
+ SystemBIOSMajorRelease,
+ SystemBIOSMinorRelease);
+ }
+ }
+}
diff --git a/src/Applications/ComputerHardwareIds/Program.cs b/src/Applications/ComputerHardwareIds/Program.cs
new file mode 100644
index 00000000..e1d5fd50
--- /dev/null
+++ b/src/Applications/ComputerHardwareIds/Program.cs
@@ -0,0 +1,85 @@
+using System.Diagnostics;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace ComputerHardwareIds
+{
+ internal class Program
+ {
+ public static void Main(string[] _)
+ {
+ Process currentProcess = Process.GetCurrentProcess();
+ ProcessModule MainModule = currentProcess.MainModule!;
+
+ (string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ ushort EnclosureType,
+ string BIOSVersion,
+ byte BIOSMajorRelease,
+ byte BIOSMinorRelease) = ComputerInformationFetcher.FetchComputerInformation();
+
+ string HardwareId1 = ComputerHardwareID.GenerateHardwareId1(Manufacturer, Family, ProductName, SKUNumber, BIOSVendor, BIOSVersion, BIOSMajorRelease.ToString("X").ToLower(), BIOSMinorRelease.ToString("X").ToLower());
+ string HardwareId2 = ComputerHardwareID.GenerateHardwareId2(Manufacturer, Family, ProductName, BIOSVendor, BIOSVersion, BIOSMajorRelease.ToString("X").ToLower(), BIOSMinorRelease.ToString("X").ToLower());
+ string HardwareId3 = ComputerHardwareID.GenerateHardwareId3(Manufacturer, ProductName, BIOSVendor, BIOSVersion, BIOSMajorRelease.ToString("X").ToLower(), BIOSMinorRelease.ToString("X").ToLower());
+ string HardwareId4 = ComputerHardwareID.GenerateHardwareId4(Manufacturer, Family, ProductName, SKUNumber, BaseboardManufacturer, BaseboardProduct);
+ string HardwareId5 = ComputerHardwareID.GenerateHardwareId5(Manufacturer, Family, ProductName, SKUNumber);
+ string HardwareId6 = ComputerHardwareID.GenerateHardwareId6(Manufacturer, Family, ProductName);
+ string HardwareId7 = ComputerHardwareID.GenerateHardwareId7(Manufacturer, SKUNumber, BaseboardManufacturer, BaseboardProduct);
+ string HardwareId8 = ComputerHardwareID.GenerateHardwareId8(Manufacturer, SKUNumber);
+ string HardwareId9 = ComputerHardwareID.GenerateHardwareId9(Manufacturer, ProductName, BaseboardManufacturer, BaseboardProduct);
+ string HardwareId10 = ComputerHardwareID.GenerateHardwareId10(Manufacturer, ProductName);
+ string HardwareId11 = ComputerHardwareID.GenerateHardwareId11(Manufacturer, Family, BaseboardManufacturer, BaseboardProduct);
+ string HardwareId12 = ComputerHardwareID.GenerateHardwareId12(Manufacturer, Family);
+ string HardwareId13 = ComputerHardwareID.GenerateHardwareId13(Manufacturer, EnclosureType.ToString());
+ string HardwareId14 = ComputerHardwareID.GenerateHardwareId14(Manufacturer, BaseboardManufacturer, BaseboardProduct);
+ string HardwareId15 = ComputerHardwareID.GenerateHardwareId15(Manufacturer);
+
+ Console.WriteLine("Using the BIOS to gather information");
+ Console.WriteLine();
+ Console.WriteLine("Tool Information");
+ Console.WriteLine("----------------");
+ Console.WriteLine($"{Path.GetFileName(MainModule.FileName)} version: {MainModule.FileVersionInfo.FileVersion}");
+ Console.WriteLine();
+ Console.WriteLine();
+ Console.WriteLine("Computer Information");
+ Console.WriteLine("--------------------");
+ Console.WriteLine($"BIOS Vendor: {BIOSVendor}");
+ Console.WriteLine($"BIOS Version String: {BIOSVersion}");
+ Console.WriteLine($"System BIOS Major Release: {BIOSMajorRelease}");
+ Console.WriteLine($"System BIOS Minor Release: {BIOSMinorRelease}");
+ Console.WriteLine();
+ Console.WriteLine($"System Manufacturer: {Manufacturer}");
+ Console.WriteLine($"System Family: {Family}");
+ Console.WriteLine($"System Product Name: {ProductName}");
+ Console.WriteLine($"SKU Number: {SKUNumber}");
+ Console.WriteLine();
+ Console.WriteLine($"System Enclosure or Chassis Type: {EnclosureType:X2}h");
+ Console.WriteLine();
+ Console.WriteLine($"Baseboard Manufacturer: {BaseboardManufacturer}");
+ Console.WriteLine($"Baseboard Product Name: {BaseboardProduct}");
+ Console.WriteLine();
+ Console.WriteLine();
+ Console.WriteLine("Hardware IDs");
+ Console.WriteLine("------------");
+ Console.WriteLine($"{HardwareId1} <- Manufacturer + Family + ProductName + SKUNumber + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release");
+ Console.WriteLine($"{HardwareId2} <- Manufacturer + Family + ProductName + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release");
+ Console.WriteLine($"{HardwareId3} <- Manufacturer + ProductName + BIOS Vendor + BIOS Version + BIOS Major Release + BIOS Minor Release");
+ Console.WriteLine($"{HardwareId4} <- Manufacturer + Family + ProductName + SKUNumber + Baseboard Manufacturer + Baseboard Product");
+ Console.WriteLine($"{HardwareId5} <- Manufacturer + Family + ProductName + SKUNumber");
+ Console.WriteLine($"{HardwareId6} <- Manufacturer + Family + ProductName");
+ Console.WriteLine($"{HardwareId7} <- Manufacturer + SKUNumber + Baseboard Manufacturer + Baseboard Product");
+ Console.WriteLine($"{HardwareId8} <- Manufacturer + SKUNumber");
+ Console.WriteLine($"{HardwareId9} <- Manufacturer + ProductName + Baseboard Manufacturer + Baseboard Product");
+ Console.WriteLine($"{HardwareId10} <- Manufacturer + ProductName");
+ Console.WriteLine($"{HardwareId11} <- Manufacturer + Family + Baseboard Manufacturer + Baseboard Product");
+ Console.WriteLine($"{HardwareId12} <- Manufacturer + Family");
+ Console.WriteLine($"{HardwareId13} <- Manufacturer + Enclosure Type");
+ Console.WriteLine($"{HardwareId14} <- Manufacturer + Baseboard Manufacturer + Baseboard Product");
+ Console.WriteLine($"{HardwareId15} <- Manufacturer");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Applications/Playground/Playground.csproj b/src/Applications/Playground/Playground.csproj
index 4e095025..40c7bdae 100644
--- a/src/Applications/Playground/Playground.csproj
+++ b/src/Applications/Playground/Playground.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/Applications/Playground/Program.cs b/src/Applications/Playground/Program.cs
index 3884f9e9..b07c4f88 100644
--- a/src/Applications/Playground/Program.cs
+++ b/src/Applications/Playground/Program.cs
@@ -2,7 +2,7 @@
{
internal class Program
{
- static void Main(string[] args)
+ private static void Main(string[] args)
{
Console.WriteLine(new Windows.Internal.Flighting.PlatformCTAC("WU_OS", "10.0.26058.1000").UriQuery);
}
diff --git a/src/Applications/UUPDownload/BuildTargets.EditionPlanningWithLanguage.cs b/src/Applications/UUPDownload/BuildTargets.EditionPlanningWithLanguage.cs
new file mode 100644
index 00000000..db6d491a
--- /dev/null
+++ b/src/Applications/UUPDownload/BuildTargets.EditionPlanningWithLanguage.cs
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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.Collections.Generic;
+using UnifiedUpdatePlatform.Media.Creator.Planning;
+
+namespace UUPDownload
+{
+ public static partial class BuildTargets
+ {
+ public class EditionPlanningWithLanguage
+ {
+ public List EditionTargets;
+ public string LanguageCode;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/BuildTargets.cs b/src/Applications/UUPDownload/BuildTargets.cs
index ff10fea0..f0687ad2 100644
--- a/src/Applications/UUPDownload/BuildTargets.cs
+++ b/src/Applications/UUPDownload/BuildTargets.cs
@@ -29,17 +29,11 @@
namespace UUPDownload
{
- public static class BuildTargets
+ public static partial class BuildTargets
{
- public class EditionPlanningWithLanguage
- {
- public List EditionTargets;
- public string LanguageCode;
- }
-
public static async Task GetTargetedPlanAsync(this UpdateData update, string LanguageCode)
{
- HashSet compDBs = await update.GetCompDBsAsync();
+ HashSet compDBs = await update.GetCompDBsAsync();
Package editionPackPkg = compDBs.GetEditionPackFromCompDBs();
string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.First(x => !x.Path.EndsWith(".psf")).PayloadHash);
@@ -48,7 +42,7 @@ public static async Task GetTargetedPlanAsync(this
public static async Task GetTargetedPlanAsync(this UpdateData update, string LanguageCode, string editionPkg)
{
- HashSet compDBs = await update.GetCompDBsAsync();
+ HashSet compDBs = await update.GetCompDBsAsync();
if (string.IsNullOrEmpty(editionPkg))
{
return null;
diff --git a/src/Applications/UUPDownload/DownloadRequest/Drivers/ProcessDrivers.cs b/src/Applications/UUPDownload/DownloadRequest/Drivers/ProcessDrivers.cs
new file mode 100644
index 00000000..9c7e9303
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/Drivers/ProcessDrivers.cs
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using UnifiedUpdatePlatform.Services.Composition.Database;
+using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+using UUPDownload.Downloading;
+using UUPDownload.Options;
+
+namespace UUPDownload.DownloadRequest.Drivers
+{
+ public partial class ProcessDrivers
+ {
+ internal static void ParseDownloadOptions(BSPDownloadRequestOptions opts)
+ {
+ CheckAndDownloadUpdates(
+ opts.ReportingSku,
+ opts.ReportingVersion,
+ opts.MachineType,
+ opts.FlightRing,
+ opts.FlightingBranchName,
+ opts.BranchReadinessLevel,
+ opts.CurrentBranch,
+ opts.ReleaseType,
+ opts.SyncCurrentVersionOnly,
+ opts.ContentType,
+ opts.Mail,
+ opts.Password,
+ opts.OutputFolder,
+ opts.BSPProductVersion,
+ opts.Manufacturer,
+ opts.Family,
+ opts.ProductName,
+ opts.SKUNumber,
+ opts.BIOSVendor,
+ opts.BaseboardManufacturer,
+ opts.BaseboardProduct,
+ opts.EnclosureType,
+ opts.BIOSVersion,
+ opts.BIOSMajorRelease,
+ opts.BIOSMinorRelease).Wait();
+ }
+
+ private static async Task CheckAndDownloadUpdates(OSSkuId ReportingSku,
+ string ReportingVersion,
+ MachineType MachineType,
+ string FlightRing,
+ string FlightingBranchName,
+ string BranchReadinessLevel,
+ string CurrentBranch,
+ string ReleaseType,
+ bool SyncCurrentVersionOnly,
+ string ContentType,
+ string Mail,
+ string Password,
+ string OutputFolder,
+ string BSPProductVersion,
+ string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ string EnclosureType,
+ string BIOSVersion,
+ string BIOSMajorRelease,
+ string BIOSMinorRelease)
+ {
+ Logging.Log("Checking for updates...");
+
+ CTAC NewestDriverProductCTAC = new(ReportingSku, ReportingVersion, MachineType, FlightRing, FlightingBranchName, BranchReadinessLevel, CurrentBranch, ReleaseType, SyncCurrentVersionOnly, ContentType: ContentType, IsDriverCheck: true);
+ string token = string.Empty;
+ if (!string.IsNullOrEmpty(Mail) && !string.IsNullOrEmpty(Password))
+ {
+ token = await MBIHelper.GenerateMicrosoftAccountTokenAsync(Mail, Password);
+ }
+
+ string[] ProductGUIDs = ComputerHardwareID.GenerateHardwareIds(Manufacturer, Family, ProductName, SKUNumber, BIOSVendor, BaseboardManufacturer, BaseboardProduct, EnclosureType, BIOSVersion, BIOSMajorRelease, BIOSMinorRelease);
+
+ foreach (string ProductGUID in ProductGUIDs)
+ {
+ NewestDriverProductCTAC.Products += $"PN={ProductGUID}_{MachineType}&V={BSPProductVersion}&Source=SMBIOS;";
+ }
+
+ IEnumerable NewestDriverProductUpdateData = await FE3Handler.GetUpdates(null, NewestDriverProductCTAC, token, FileExchangeV3UpdateFilter.ProductRelease);
+
+ string outputFolder = OutputFolder.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
+
+ if (!NewestDriverProductUpdateData.Any())
+ {
+ Logging.Log("No updates found that matched the specified criteria.", Logging.LoggingLevel.Error);
+ return;
+ }
+
+ for (int i = 0; i < NewestDriverProductUpdateData.Count(); i++)
+ {
+ UpdateData update = NewestDriverProductUpdateData.ElementAt(i);
+
+ if (update.Xml.LocalizedProperties.Title.Contains("Windows"))
+ {
+ continue;
+ }
+
+ Logging.Log($"{i}: Title: {update.Xml.LocalizedProperties.Title}");
+ Logging.Log($"{i}: Description: {update.Xml.LocalizedProperties.Description}");
+
+ Logging.Log("Gathering update metadata...");
+
+ HashSet compDBs = await update.GetCompDBsAsync();
+
+ BaseManifest firstCompDB = compDBs.First();
+ string UUPProduct = firstCompDB.UUPProduct;
+ string UUPProductVersion = firstCompDB.UUPProductVersion;
+
+ Logging.Log("BSP Product Name: " + UUPProduct);
+ Logging.Log("BSP Product Version: " + UUPProductVersion);
+
+ string outputName = Path.Combine(outputFolder, $"{UUPProductVersion}_{UUPProduct}_{update.Xml.UpdateIdentity.UpdateID.Split("-").Last()}");
+
+ _ = await UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.UpdateUtils.ProcessUpdateAsync(update, outputName, MachineType, new ReportProgress(), UseAutomaticDownloadFolder: false);
+ }
+
+ if (Debugger.IsAttached)
+ {
+ _ = Console.ReadLine();
+ }
+
+ Logging.Log("Completed.");
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ComputerInformationFetcher.cs b/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ComputerInformationFetcher.cs
new file mode 100644
index 00000000..eab37a13
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ComputerInformationFetcher.cs
@@ -0,0 +1,60 @@
+using Microsoft.Management.Infrastructure;
+using Microsoft.Management.Infrastructure.Options;
+using System.Linq;
+
+namespace UUPDownload.DownloadRequest.DriversAuto
+{
+ public static class ComputerInformationFetcher
+ {
+ public static (string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ ushort EnclosureType,
+ string BIOSVersion,
+ byte BIOSMajorRelease,
+ byte BIOSMinorRelease) FetchComputerInformation()
+ {
+ using DComSessionOptions dcomSessionOptions = new();
+ using CimSession cimSession = CimSession.Create("localhost", dcomSessionOptions);
+
+ CimInstance result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_BIOS").Single();
+
+ string BIOSVendor = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string BIOSVersionString = (string)result.CimInstanceProperties["SMBIOSBIOSVersion"].Value;
+ byte SystemBIOSMajorRelease = (byte)result.CimInstanceProperties["SystemBiosMajorVersion"].Value;
+ byte SystemBIOSMinorRelease = (byte)result.CimInstanceProperties["SystemBiosMinorVersion"].Value;
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_ComputerSystem").Single();
+
+ string SystemManufacturer = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string SystemFamily = (string)result.CimInstanceProperties["SystemFamily"].Value;
+ string SystemProductName = (string)result.CimInstanceProperties["Model"].Value;
+ string SKUNumber = (string)result.CimInstanceProperties["SystemSKUNumber"].Value;
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_SystemEnclosure").Single();
+
+ ushort SystemEnclosureorChassisType = ((ushort[])result.CimInstanceProperties["ChassisTypes"].Value)[0];
+
+ result = cimSession.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_BaseBoard").Single();
+
+ string BaseboardManufacturer = (string)result.CimInstanceProperties["Manufacturer"].Value;
+ string BaseboardProductName = (string)result.CimInstanceProperties["Product"].Value;
+
+ return (SystemManufacturer,
+ SystemFamily,
+ SystemProductName,
+ SKUNumber,
+ BIOSVendor,
+ BaseboardManufacturer,
+ BaseboardProductName,
+ SystemEnclosureorChassisType,
+ BIOSVersionString,
+ SystemBIOSMajorRelease,
+ SystemBIOSMinorRelease);
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ProcessDrivers.cs b/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ProcessDrivers.cs
new file mode 100644
index 00000000..a1c6e8af
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/DriversAuto/ProcessDrivers.cs
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using UnifiedUpdatePlatform.Services.Composition.Database;
+using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+using UUPDownload.Downloading;
+using UUPDownload.Options;
+
+namespace UUPDownload.DownloadRequest.DriversAuto
+{
+ public partial class ProcessDrivers
+ {
+ public static OSPlatform GetOperatingSystem()
+ {
+ return RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
+ ? OSPlatform.OSX
+ : RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
+ ? OSPlatform.Linux
+ : RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
+ ? OSPlatform.Windows
+ : RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)
+ ? OSPlatform.FreeBSD
+ : throw new Exception("Cannot determine operating system!");
+ }
+
+ internal static void ParseDownloadOptions(BSPDownloadRequestOptions3 opts)
+ {
+ // APIs are only avalable in windows right now.
+ if (GetOperatingSystem() != OSPlatform.Windows)
+ {
+ throw new PlatformNotSupportedException();
+ }
+
+ (string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ ushort EnclosureType,
+ string BIOSVersion,
+ byte BIOSMajorRelease,
+ byte BIOSMinorRelease) = ComputerInformationFetcher.FetchComputerInformation();
+
+ CheckAndDownloadUpdates(
+ opts.ReportingSku,
+ opts.ReportingVersion,
+ opts.MachineType,
+ opts.FlightRing,
+ opts.FlightingBranchName,
+ opts.BranchReadinessLevel,
+ opts.CurrentBranch,
+ opts.ReleaseType,
+ opts.SyncCurrentVersionOnly,
+ opts.ContentType,
+ opts.Mail,
+ opts.Password,
+ opts.OutputFolder,
+ opts.BSPProductVersion,
+ Manufacturer,
+ Family,
+ ProductName,
+ SKUNumber,
+ BIOSVendor,
+ BaseboardManufacturer,
+ BaseboardProduct,
+ EnclosureType.ToString(),
+ BIOSVersion,
+ BIOSMajorRelease.ToString("X").ToLower(),
+ BIOSMinorRelease.ToString("X").ToLower()).Wait();
+ }
+
+ private static async Task CheckAndDownloadUpdates(OSSkuId ReportingSku,
+ string ReportingVersion,
+ MachineType MachineType,
+ string FlightRing,
+ string FlightingBranchName,
+ string BranchReadinessLevel,
+ string CurrentBranch,
+ string ReleaseType,
+ bool SyncCurrentVersionOnly,
+ string ContentType,
+ string Mail,
+ string Password,
+ string OutputFolder,
+ string BSPProductVersion,
+ string Manufacturer,
+ string Family,
+ string ProductName,
+ string SKUNumber,
+ string BIOSVendor,
+ string BaseboardManufacturer,
+ string BaseboardProduct,
+ string EnclosureType,
+ string BIOSVersion,
+ string BIOSMajorRelease,
+ string BIOSMinorRelease)
+ {
+ Logging.Log("Checking for updates...");
+
+ CTAC NewestDriverProductCTAC = new(ReportingSku, ReportingVersion, MachineType, FlightRing, FlightingBranchName, BranchReadinessLevel, CurrentBranch, ReleaseType, SyncCurrentVersionOnly, ContentType: ContentType, IsDriverCheck: true);
+ string token = string.Empty;
+ if (!string.IsNullOrEmpty(Mail) && !string.IsNullOrEmpty(Password))
+ {
+ token = await MBIHelper.GenerateMicrosoftAccountTokenAsync(Mail, Password);
+ }
+
+ string[] ProductGUIDs = ComputerHardwareID.GenerateHardwareIds(Manufacturer, Family, ProductName, SKUNumber, BIOSVendor, BaseboardManufacturer, BaseboardProduct, EnclosureType, BIOSVersion, BIOSMajorRelease, BIOSMinorRelease);
+
+ foreach (string ProductGUID in ProductGUIDs)
+ {
+ NewestDriverProductCTAC.Products += $"PN={ProductGUID}_{MachineType}&V={BSPProductVersion}&Source=SMBIOS;";
+ }
+
+ IEnumerable NewestDriverProductUpdateData = await FE3Handler.GetUpdates(null, NewestDriverProductCTAC, token, FileExchangeV3UpdateFilter.ProductRelease);
+
+ string outputFolder = OutputFolder.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
+
+ if (!NewestDriverProductUpdateData.Any())
+ {
+ Logging.Log("No updates found that matched the specified criteria.", Logging.LoggingLevel.Error);
+ return;
+ }
+
+ for (int i = 0; i < NewestDriverProductUpdateData.Count(); i++)
+ {
+ UpdateData update = NewestDriverProductUpdateData.ElementAt(i);
+
+ if (update.Xml.LocalizedProperties.Title.Contains("Windows"))
+ {
+ continue;
+ }
+
+ Logging.Log($"{i}: Title: {update.Xml.LocalizedProperties.Title}");
+ Logging.Log($"{i}: Description: {update.Xml.LocalizedProperties.Description}");
+
+ Logging.Log("Gathering update metadata...");
+
+ HashSet compDBs = await update.GetCompDBsAsync();
+
+ BaseManifest firstCompDB = compDBs.First();
+ string UUPProduct = firstCompDB.UUPProduct;
+ string UUPProductVersion = firstCompDB.UUPProductVersion;
+
+ Logging.Log("BSP Product Name: " + UUPProduct);
+ Logging.Log("BSP Product Version: " + UUPProductVersion);
+
+ string outputName = Path.Combine(outputFolder, $"{UUPProductVersion}_{UUPProduct}_{update.Xml.UpdateIdentity.UpdateID.Split("-").Last()}");
+
+ _ = await UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.UpdateUtils.ProcessUpdateAsync(update, outputName, MachineType, new ReportProgress(), UseAutomaticDownloadFolder: false);
+ }
+
+ if (Debugger.IsAttached)
+ {
+ _ = Console.ReadLine();
+ }
+
+ Logging.Log("Completed.");
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/Process.cs b/src/Applications/UUPDownload/DownloadRequest/Process.cs
index fdd9bd8d..c7695f23 100644
--- a/src/Applications/UUPDownload/DownloadRequest/Process.cs
+++ b/src/Applications/UUPDownload/DownloadRequest/Process.cs
@@ -30,7 +30,9 @@
using System.Threading.Tasks;
using UnifiedUpdatePlatform.Services.Composition.Database;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
using UUPDownload.Downloading;
+using UUPDownload.Options;
namespace UUPDownload.DownloadRequest
{
@@ -102,7 +104,7 @@ private static async Task ApplyAppxFixUpAsync(UpdateData update, string appxRoot
update.CompDBs = await update.GetCompDBsAsync();
}
- CompDB canonicalCompdb = update.CompDBs
+ BaseManifest canonicalCompdb = update.CompDBs
.Where(compDB => compDB.Tags.Tag
.Find(x => x.Name
.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?
@@ -229,7 +231,7 @@ private static async Task ProcessUpdateAsync(UpdateData update, string pOutputFo
Logging.Log("Gathering update metadata...");
- HashSet compDBs = await update.GetCompDBsAsync();
+ HashSet compDBs = await update.GetCompDBsAsync();
await Task.WhenAll(
Task.Run(async () => buildstr = await update.GetBuildStringAsync()),
@@ -248,9 +250,9 @@ await Task.WhenAll(
// We need to fallback to CompDB (less accurate but we have no choice, due to CUs etc...
// Loop through all CompDBs to find the highest version reported
- CompDB selectedCompDB = null;
+ BaseManifest selectedCompDB = null;
Version currentHighest = null;
- foreach (CompDB compDB in compDBs)
+ foreach (BaseManifest compDB in compDBs)
{
if (compDB.TargetOSVersion != null)
{
diff --git a/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/DriverPlan.cs b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/DriverPlan.cs
new file mode 100644
index 00000000..310e4952
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/DriverPlan.cs
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 UUPDownload.DownloadRequest.ReferenceDriversRepo
+{
+ public class DriverPlan
+ {
+ public string outputFolder
+ {
+ get; set;
+ }
+ public string guid
+ {
+ get; set;
+ }
+ public int[] filteredIds
+ {
+ get; set;
+ }
+ public int[] excludedIds
+ {
+ get; set;
+ }
+ public string Manufacturer
+ {
+ get; set;
+ }
+ public string Family
+ {
+ get; set;
+ }
+ public string Product
+ {
+ get; set;
+ }
+ public string Sku
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.GenerateChangelog.cs b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.GenerateChangelog.cs
new file mode 100644
index 00000000..0ea2e6d0
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.GenerateChangelog.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using UnifiedUpdatePlatform.Services.Composition.Database;
+using UnifiedUpdatePlatform.Services.WindowsUpdate;
+
+namespace UUPDownload.DownloadRequest.ReferenceDriversRepo
+{
+ public partial class ProcessDrivers
+ {
+ private static async Task GenerateChangelog(UpdateData update, string changelogOutput, int i, BaseManifest pevCompDB)
+ {
+ File.AppendAllLines(changelogOutput, ["", $"## {update.Xml.LocalizedProperties.Title} - 200.0.{i}.0"]);
+
+ HashSet compDBs = await update.GetCompDBsAsync();
+ BaseManifest curCompDB = compDBs.First();
+
+ List added = [];
+ List updated = [];
+ List removed = [];
+ List modified = [];
+
+ if (pevCompDB != null)
+ {
+ IEnumerable prevPackageList = pevCompDB.Packages.Package.Select(pkg => $"| {pkg.Version} | {pkg.ID.Split("-")[1].Replace(".inf", ".cab", StringComparison.InvariantCultureIgnoreCase)} |");
+ IEnumerable curPackageList = curCompDB.Packages.Package.Select(pkg => $"| {pkg.Version} | {pkg.ID.Split("-")[1].Replace(".inf", ".cab", StringComparison.InvariantCultureIgnoreCase)} |");
+
+ foreach (string pkg in prevPackageList)
+ {
+ string version = pkg.Split("|")[1];
+ string id = pkg.Split("|")[2];
+
+ bool existsInNewer = curPackageList.Any(x => id.Equals(x.Split("|")[2], StringComparison.InvariantCultureIgnoreCase));
+
+ if (!existsInNewer)
+ {
+ removed.Add(pkg);
+ }
+ }
+
+ foreach (Package package in curCompDB.Packages.Package)
+ {
+ string pkg = $"| {package.Version} | {package.ID.Split("-")[1].Replace(".inf", ".cab", StringComparison.InvariantCultureIgnoreCase)} |";
+
+ string version = pkg.Split("|")[1];
+ string id = pkg.Split("|")[2];
+
+ bool existsInOlder = prevPackageList.Any(x => id.Equals(x.Split("|")[2], StringComparison.InvariantCultureIgnoreCase));
+
+ if (existsInOlder)
+ {
+ bool hasSameVersion = prevPackageList.Any(x => version.Equals(x.Split("|")[1], StringComparison.InvariantCultureIgnoreCase) && id.Equals(x.Split("|")[2], StringComparison.InvariantCultureIgnoreCase));
+
+ if (!hasSameVersion)
+ {
+ updated.Add(pkg);
+ }
+ else
+ {
+ bool hasSameHash = pevCompDB.Packages.Package.Any(x => x.Payload.PayloadItem[0].PayloadHash == package.Payload.PayloadItem[0].PayloadHash);
+ if (!hasSameHash)
+ {
+ modified.Add(pkg);
+ }
+ }
+ }
+ else
+ {
+ added.Add(pkg);
+ }
+ }
+ }
+ else
+ {
+ foreach (Package pkg in curCompDB.Packages.Package)
+ {
+ added.Add($"| {pkg.Version} | {pkg.ID.Split("-")[1].Replace(".inf", ".cab", StringComparison.CurrentCultureIgnoreCase)} |");
+ }
+ }
+
+ added.Sort();
+ updated.Sort();
+ modified.Sort();
+ removed.Sort();
+
+ if (added.Count > 0)
+ {
+ File.AppendAllLines(changelogOutput, ["", $"### Added", ""]);
+ File.AppendAllLines(changelogOutput, ["| Driver version | Package |"]);
+ File.AppendAllLines(changelogOutput, ["|----------------|---------|"]);
+ File.AppendAllLines(changelogOutput, added);
+ }
+
+
+ if (updated.Count > 0)
+ {
+ File.AppendAllLines(changelogOutput, ["", $"### Updated", ""]);
+ File.AppendAllLines(changelogOutput, ["| Driver version | Package |"]);
+ File.AppendAllLines(changelogOutput, ["|----------------|---------|"]);
+ File.AppendAllLines(changelogOutput, updated);
+ }
+
+
+ if (modified.Count > 0)
+ {
+ File.AppendAllLines(changelogOutput, ["", $"### Modified", ""]);
+ File.AppendAllLines(changelogOutput, ["| Driver version | Package |"]);
+ File.AppendAllLines(changelogOutput, ["|----------------|---------|"]);
+ File.AppendAllLines(changelogOutput, modified);
+ }
+
+
+ if (removed.Count > 0)
+ {
+ File.AppendAllLines(changelogOutput, ["", $"### Removed", ""]);
+ File.AppendAllLines(changelogOutput, ["| Driver version | Package |"]);
+ File.AppendAllLines(changelogOutput, ["|----------------|---------|"]);
+ File.AppendAllLines(changelogOutput, removed);
+ }
+
+ return curCompDB;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.cs b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.cs
new file mode 100644
index 00000000..ebfb3bf2
--- /dev/null
+++ b/src/Applications/UUPDownload/DownloadRequest/ReferenceDriversRepo/ProcessDrivers.cs
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using UnifiedUpdatePlatform.Services.Composition.Database;
+using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+using UUPDownload.Downloading;
+using UUPDownload.Options;
+
+namespace UUPDownload.DownloadRequest.ReferenceDriversRepo
+{
+ public partial class ProcessDrivers
+ {
+ internal static void ParseDownloadOptions(BSPDownloadRequestOptions2 opts)
+ {
+ CheckAndDownloadUpdates(
+ opts.ReportingSku,
+ opts.ReportingVersion,
+ opts.MachineType,
+ opts.FlightRing,
+ opts.FlightingBranchName,
+ opts.BranchReadinessLevel,
+ opts.CurrentBranch,
+ opts.ReleaseType,
+ opts.SyncCurrentVersionOnly,
+ opts.ContentType,
+ opts.Mail,
+ opts.Password,
+ opts.OutputFolder,
+ opts.Language,
+ opts.Edition).Wait();
+ }
+
+ private static async Task CheckAndDownloadUpdates(OSSkuId ReportingSku,
+ string ReportingVersion,
+ MachineType MachineType,
+ string FlightRing,
+ string FlightingBranchName,
+ string BranchReadinessLevel,
+ string CurrentBranch,
+ string ReleaseType,
+ bool SyncCurrentVersionOnly,
+ string ContentType,
+ string Mail,
+ string Password,
+ string OutputFolder,
+ string Language,
+ string Edition)
+ {
+ if (!File.Exists("DriverConfig.json"))
+ {
+ Logging.Log("Driver Configuration file (DriverConfig.json) could not be found in the current working directory.", Logging.LoggingLevel.Error);
+ return;
+ }
+
+ DriverPlan[] plans = System.Text.Json.JsonSerializer.Deserialize(File.ReadAllText("DriverConfig.json"));
+
+ foreach (DriverPlan plan in plans)
+ {
+ Logging.Log(plan.outputFolder);
+ await ProcessDriverPlan(plan, ReportingSku, ReportingVersion, MachineType, FlightRing, FlightingBranchName, BranchReadinessLevel, CurrentBranch, ReleaseType, SyncCurrentVersionOnly, ContentType, Mail, Password, Language, Edition, OutputFolder);
+ }
+
+ if (Debugger.IsAttached)
+ {
+ _ = Console.ReadLine();
+ }
+
+ Logging.Log("Completed.");
+ }
+
+ private static async Task ProcessDriverPlan(DriverPlan DriverPlan,
+ OSSkuId ReportingSku,
+ string ReportingVersion,
+ MachineType MachineType,
+ string FlightRing,
+ string FlightingBranchName,
+ string BranchReadinessLevel,
+ string CurrentBranch,
+ string ReleaseType,
+ bool SyncCurrentVersionOnly,
+ string ContentType,
+ string Mail,
+ string Password,
+ string Language,
+ string Edition,
+ string RepoLocation)
+ {
+ BaseManifest previousCompositionDatabase = null;
+
+ Logging.Log("Checking for updates...");
+
+ CTAC NewestDriverProductCTAC = new(ReportingSku, ReportingVersion, MachineType, FlightRing, FlightingBranchName, BranchReadinessLevel, CurrentBranch, ReleaseType, false, ContentType: ContentType, IsDriverCheck: true);
+ string token = string.Empty;
+ if (!string.IsNullOrEmpty(Mail) && !string.IsNullOrEmpty(Password))
+ {
+ token = await MBIHelper.GenerateMicrosoftAccountTokenAsync(Mail, Password);
+ }
+
+ string ProductGUID = DriverPlan.guid;
+ if (string.IsNullOrEmpty(ProductGUID))
+ {
+ ProductGUID = ComputerHardwareID.GenerateHardwareId5(DriverPlan.Manufacturer, DriverPlan.Family, DriverPlan.Product, DriverPlan.Sku);
+ }
+
+ NewestDriverProductCTAC.Products += $"PN={ProductGUID}_{MachineType}&V=0.0.0.0&Source=SMBIOS;";
+
+ IEnumerable NewestDriverProductUpdateData = await FE3Handler.GetUpdates(null, NewestDriverProductCTAC, token, FileExchangeV3UpdateFilter.ProductRelease);
+
+ string outputFolder = (RepoLocation + DriverPlan.outputFolder).Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
+
+ if (!NewestDriverProductUpdateData.Any())
+ {
+ Logging.Log("No updates found that matched the specified criteria.", Logging.LoggingLevel.Error);
+ return;
+ }
+
+ string newestDriverVersion = "0.0.0.0";
+
+ for (int i = 0; i < NewestDriverProductUpdateData.Count(); i++)
+ {
+ UpdateData update = NewestDriverProductUpdateData.ElementAt(i);
+
+ if (update.Xml.LocalizedProperties.Title.Contains("Windows"))
+ {
+ continue;
+ }
+
+ Logging.Log($"{i}: Title: {update.Xml.LocalizedProperties.Title}");
+ Logging.Log($"{i}: Description: {update.Xml.LocalizedProperties.Description}");
+
+ Logging.Log("Gathering update metadata...");
+
+ HashSet compDBs = await update.GetCompDBsAsync();
+
+ newestDriverVersion = compDBs.First().UUPProductVersion;
+ }
+
+ if (SyncCurrentVersionOnly)
+ {
+ foreach (UpdateData update in NewestDriverProductUpdateData)
+ {
+ if (update.Xml.LocalizedProperties.Title.Contains("Windows"))
+ {
+ continue;
+ }
+
+ Logging.Log("Title: " + update.Xml.LocalizedProperties.Title);
+ Logging.Log("Description: " + update.Xml.LocalizedProperties.Description);
+
+ _ = await UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.UpdateUtils.ProcessUpdateAsync(update, outputFolder, MachineType, new ReportProgress(), Language: Language, Edition: Edition);
+ }
+ }
+ else
+ {
+ string newestDriverOutput = $"{outputFolder}{Path.DirectorySeparatorChar}{newestDriverVersion}";
+ if (Directory.Exists(newestDriverOutput) && Directory.EnumerateFiles(newestDriverOutput).Any())
+ {
+ return;
+ }
+
+ string changelogOutput = $"{outputFolder}{Path.DirectorySeparatorChar}CHANGELOG.md";
+
+ if (File.Exists(changelogOutput))
+ {
+ File.Delete(changelogOutput);
+ }
+
+ int newestDriverBuildNumber = int.Parse(newestDriverVersion.Split(".")[2]);
+
+ for (int driverBuildNumber = 0; driverBuildNumber <= newestDriverBuildNumber; driverBuildNumber++)
+ {
+ if (DriverPlan.filteredIds.Length != 0 && !DriverPlan.filteredIds.Contains(driverBuildNumber))
+ {
+ continue;
+ }
+
+ if (DriverPlan.excludedIds.Length != 0 && DriverPlan.excludedIds.Contains(driverBuildNumber))
+ {
+ continue;
+ }
+
+ CTAC PreciseDriverProductVersionCTAC = new(ReportingSku, ReportingVersion, MachineType, FlightRing, FlightingBranchName, BranchReadinessLevel, CurrentBranch, ReleaseType, SyncCurrentVersionOnly, ContentType: ContentType, IsDriverCheck: true);
+
+ PreciseDriverProductVersionCTAC.Products += $"PN={ProductGUID}_{MachineType}&V=200.0.{driverBuildNumber}.0&Source=SMBIOS;";
+ PreciseDriverProductVersionCTAC.SyncCurrentVersionOnly = true;
+
+ Logging.Log($"Checking for updates... 200.0.{driverBuildNumber}.0 / {newestDriverVersion}");
+ IEnumerable PreciseDriverProductVersionUpdateData = await FE3Handler.GetUpdates(null, PreciseDriverProductVersionCTAC, token, FileExchangeV3UpdateFilter.ProductRelease);
+
+ if (!PreciseDriverProductVersionUpdateData.Any())
+ {
+ Logging.Log("No updates found that matched the specified criteria.", Logging.LoggingLevel.Error);
+ }
+ else
+ {
+ foreach (UpdateData update in PreciseDriverProductVersionUpdateData)
+ {
+ if (update.Xml.LocalizedProperties.Title.Contains("Windows"))
+ {
+ continue;
+ }
+
+ Logging.Log("Title: " + update.Xml.LocalizedProperties.Title);
+ Logging.Log("Description: " + update.Xml.LocalizedProperties.Description);
+
+ string fwOutput = $"{outputFolder}{Path.DirectorySeparatorChar}200.0.{driverBuildNumber}.0";
+ if (!Directory.Exists(fwOutput) || !Directory.EnumerateFiles(fwOutput).Any())
+ {
+ _ = await UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.UpdateUtils.ProcessUpdateAsync(update, fwOutput, MachineType, new ReportProgress(), Language, Edition, false, false);
+ }
+
+ previousCompositionDatabase = await GenerateChangelog(update, changelogOutput, driverBuildNumber, previousCompositionDatabase);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/DownloadRequest/UpdateScan.cs b/src/Applications/UUPDownload/DownloadRequest/UpdateScan.cs
index 78d73919..51bb715b 100644
--- a/src/Applications/UUPDownload/DownloadRequest/UpdateScan.cs
+++ b/src/Applications/UUPDownload/DownloadRequest/UpdateScan.cs
@@ -23,6 +23,7 @@
using System.Xml;
using System.Xml.Serialization;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
namespace UUPDownload.DownloadRequest
{
diff --git a/src/Applications/UUPDownload/Downloading/ReportProgress.cs b/src/Applications/UUPDownload/Downloading/ReportProgress.cs
index 9fab222b..3a8a5f43 100644
--- a/src/Applications/UUPDownload/Downloading/ReportProgress.cs
+++ b/src/Applications/UUPDownload/Downloading/ReportProgress.cs
@@ -28,13 +28,13 @@ namespace UUPDownload.Downloading
{
public class ReportProgress : IProgress, IDisposable
{
- private readonly Dictionary files = new();
+ private readonly Dictionary files = [];
private readonly Mutex mutex = new();
private static string FormatBytes(double bytes)
{
- string[] suffix = { "B", "KB", "MB", "GB", "TB" };
+ string[] suffix = ["B", "KB", "MB", "GB", "TB"];
int i;
double dblSByte = bytes;
for (i = 0; i < suffix.Length && bytes >= 1024; i++, bytes /= 1024)
diff --git a/src/Applications/UUPDownload/DriverConfig.json b/src/Applications/UUPDownload/DriverConfig.json
new file mode 100644
index 00000000..848d94d2
--- /dev/null
+++ b/src/Applications/UUPDownload/DriverConfig.json
@@ -0,0 +1,186 @@
+[
+ {
+ "outputFolder": "\\1000_CLS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SDM1000",
+ "Product": "CLS",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\7180_CLS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [
+ 1,
+ 9,
+ 10
+ ],
+ "Manufacturer": "Qualcomm",
+ "Family": "SC7180",
+ "Product": "CLS",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\7280_CLS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SC_KODIAK",
+ "Product": "CLS",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\7280_WINDOWS_CLS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SC_KODIAK_WINDOWS",
+ "Product": "CLS",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\8180_CLS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SC8180X",
+ "Product": "CLS",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\8280_QRD",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SCP_MAKENA",
+ "Product": "QRD",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\8380_CRD",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SCP_HAMOA",
+ "Product": "CRD",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\8380_RUN",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SCP_HAMOA",
+ "Product": "Snapdragon-Devkit",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\8380PA_CRD",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Qualcomm",
+ "Family": "SCP_PURWA",
+ "Product": "CRD",
+ "Sku": "6"
+ },
+ {
+ "outputFolder": "\\Surface\\8180_CAM",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Surface Pro X",
+ "Sku": "Surface_Pro_X_1876"
+ },
+ {
+ "outputFolder": "\\Surface\\8180_CAR",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Surface Pro X",
+ "Sku": "Surface_Pro_X_H_1876"
+ },
+ {
+ "outputFolder": "\\Surface\\8180_CAS",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Surface Pro X",
+ "Sku": "Surface_Pro_X_2010"
+ },
+ {
+ "outputFolder": "\\Surface\\8280_ARC_1996",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Surface Pro 9",
+ "Sku": "Surface_Pro_9_With_5G_1996"
+ },
+ {
+ "outputFolder": "\\Surface\\8280_ARC_1997",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Surface Pro 9",
+ "Sku": "Surface_Pro_9_With_5G_1997"
+ },
+ {
+ "outputFolder": "\\Surface\\8280_BLK",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Windows Dev Kit 2023",
+ "Sku": "2043"
+ },
+ {
+ "outputFolder": "\\Surface\\8380_ROM_2036",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Microsoft Surface Laptop, 7th Edition",
+ "Sku": "Surface_Laptop_7th_Edition_2036"
+ },
+ {
+ "outputFolder": "\\Surface\\8380_ROM_2037",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Microsoft Surface Laptop, 7th Edition",
+ "Sku": "Surface_Laptop_7th_Edition_2037"
+ },
+ {
+ "outputFolder": "\\Surface\\8380_DEN",
+ "guid": null,
+ "filteredIds": [],
+ "excludedIds": [],
+ "Manufacturer": "Microsoft Corporation",
+ "Family": "Surface",
+ "Product": "Microsoft Surface Pro, 11th Edition",
+ "Sku": "Surface_Pro_11th_Edition_2076"
+ }
+]
\ No newline at end of file
diff --git a/src/Applications/UUPDownload/FeatureManifestService.cs b/src/Applications/UUPDownload/FeatureManifestService.cs
index 8f6dbf23..b640ca5b 100644
--- a/src/Applications/UUPDownload/FeatureManifestService.cs
+++ b/src/Applications/UUPDownload/FeatureManifestService.cs
@@ -33,7 +33,7 @@ public static class FeatureManifestService
public static IDictionary GetAppxPackageLicenseFileMapFromCabs(IList cabPaths)
{
- Dictionary licenseMap = new();
+ Dictionary licenseMap = [];
foreach (string cabPath in cabPaths)
{
if (new FileInfo(cabPath).Length > MAXIMUM_CANDIDATE_CAB_SIZE)
diff --git a/src/Applications/UUPDownload/Logging.LoggingLevel.cs b/src/Applications/UUPDownload/Logging.LoggingLevel.cs
new file mode 100644
index 00000000..541cb7e1
--- /dev/null
+++ b/src/Applications/UUPDownload/Logging.LoggingLevel.cs
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 UUPDownload
+{
+ internal static partial class Logging
+ {
+ public enum LoggingLevel
+ {
+ Information,
+ Warning,
+ Error
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Applications/UUPDownload/Logging.cs b/src/Applications/UUPDownload/Logging.cs
index 22bb85a8..ad3a8f04 100644
--- a/src/Applications/UUPDownload/Logging.cs
+++ b/src/Applications/UUPDownload/Logging.cs
@@ -23,14 +23,8 @@
namespace UUPDownload
{
- internal static class Logging
+ internal static partial class Logging
{
- public enum LoggingLevel
- {
- Information,
- Warning,
- Error
- }
private static readonly ConsoleColor Foreground;
diff --git a/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions.cs b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions.cs
new file mode 100644
index 00000000..782bf302
--- /dev/null
+++ b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions.cs
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 CommandLine;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace UUPDownload.Options
+{
+ [Verb("request-bsp-download", HelpText = "Request a BSP download from zero using a number of different request parameters.")]
+ internal class BSPDownloadRequestOptions
+ {
+ [Option('s', "reporting-sku", HelpText = "The sku to report to the Windows Update servers. Example: Professional", Required = true)]
+ public OSSkuId ReportingSku
+ {
+ get; set;
+ }
+
+ [Option('v', "reporting-version", HelpText = "The version to report to the Windows Update servers. Example: 10.0.20152.1000", Required = true)]
+ public string ReportingVersion
+ {
+ get; set;
+ }
+
+ [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
+ public MachineType MachineType
+ {
+ get; set;
+ }
+
+ [Option('r', "flight-ring", HelpText = "The ring to report to the Windows Update servers. Example: Retail, other example: External or Internal", Required = true)]
+ public string FlightRing
+ {
+ get; set;
+ }
+
+ [Option('c', "current-branch", HelpText = "The branch to report to the Windows Update servers. Example: 19h1_release", Required = true)]
+ public string CurrentBranch
+ {
+ get; set;
+ }
+
+ [Option('b', "flighting-branch-name", HelpText = "The flighting branch name to report to the Windows Update servers. Example: Retail, other example: CanaryChannel, Dev, Beta or ReleasePreview", Required = false, Default = "")]
+ public string FlightingBranchName
+ {
+ get; set;
+ }
+
+ [Option('y', "sync-current-version-only", HelpText = "Only get updates for the current version, enables getting cumulative updates.", Required = false, Default = false)]
+ public bool SyncCurrentVersionOnly
+ {
+ get; set;
+ }
+
+ [Option('a', "branch-readiness-level", HelpText = "The branch readiness level to report to the Windows Update servers. Example: CB", Required = false, Default = "CB")]
+ public string BranchReadinessLevel
+ {
+ get; set;
+ }
+
+ [Option('o', "output-folder", HelpText = "The folder to use for downloading the update files.", Required = false, Default = ".")]
+ public string OutputFolder
+ {
+ get; set;
+ }
+
+ [Option('z', "releasetype", HelpText = "The release type to report to the Windows Update servers. Example: Production", Required = false, Default = "Production")]
+ public string ReleaseType
+ {
+ get; set;
+ }
+
+ [Option('n', "contenttype", HelpText = "The content type to report to the Windows Update servers. Example: Mainline, Custom", Required = false, Default = "Mainline")]
+ public string ContentType
+ {
+ get; set;
+ }
+
+ [Option('m', "mail", HelpText = "Email for the Windows Insider account to use to generate authorization tokens (Optional)", Required = false, Default = "")]
+ public string Mail
+ {
+ get; set;
+ }
+
+ [Option('p', "password", HelpText = "Password for the Windows Insider account to use to generate authorization tokens (If 2FA, must be generated app password) (Optional)", Required = false, Default = "")]
+ public string Password
+ {
+ get; set;
+ }
+
+ // Used above:
+ // a
+ // b
+ // c
+ // m
+ // n
+ // o
+ // p
+ // r
+ // s
+ // t
+ // v
+ // y
+ // z
+
+ [Option('d', "bsp-product-version", HelpText = "", Required = false, Default = "0.0.0.0")]
+ public string BSPProductVersion
+ {
+ get; set;
+ }
+
+ //
+ // Targeting for the BSP Product, see the ComputerHardwareIds.Windows project for knowing what these map to, programmatically
+ //
+
+ [Option('e', "targeting-manufacturer", HelpText = "", Required = true)]
+ public string Manufacturer
+ {
+ get; set;
+ }
+
+ [Option('f', "targeting-family", HelpText = "", Required = false, Default = null)]
+ public string Family
+ {
+ get; set;
+ }
+
+ [Option('g', "targeting-productname", HelpText = "", Required = false, Default = null)]
+ public string ProductName
+ {
+ get; set;
+ }
+
+ [Option('h', "targeting-skunumber", HelpText = "", Required = false, Default = null)]
+ public string SKUNumber
+ {
+ get; set;
+ }
+
+ [Option('i', "targeting-biosvendor", HelpText = "", Required = false, Default = null)]
+ public string BIOSVendor
+ {
+ get; set;
+ }
+
+ [Option('j', "targeting-baseboardmanufacturer", HelpText = "", Required = false, Default = null)]
+ public string BaseboardManufacturer
+ {
+ get; set;
+ }
+
+ [Option('k', "targeting-baseboardproduct", HelpText = "", Required = false, Default = null)]
+ public string BaseboardProduct
+ {
+ get; set;
+ }
+
+ [Option('l', "targeting-enclosuretype", HelpText = "", Required = false, Default = null)]
+ public string EnclosureType
+ {
+ get; set;
+ }
+
+ [Option('q', "targeting-biosversion", HelpText = "", Required = false, Default = null)]
+ public string BIOSVersion
+ {
+ get; set;
+ }
+
+ [Option('u', "targeting-biosmajorrelease", HelpText = "", Required = false, Default = null)]
+ public string BIOSMajorRelease
+ {
+ get; set;
+ }
+
+ [Option('w', "targeting-biosminorrelease", HelpText = "", Required = false, Default = null)]
+ public string BIOSMinorRelease
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions2.cs b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions2.cs
new file mode 100644
index 00000000..c7dc10ba
--- /dev/null
+++ b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions2.cs
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 CommandLine;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace UUPDownload.Options
+{
+ [Verb("request-bsp-download2", HelpText = "Request a BSP download from zero using a number of different request parameters.")]
+ internal class BSPDownloadRequestOptions2
+ {
+ [Option('s', "reporting-sku", HelpText = "The sku to report to the Windows Update servers. Example: Professional", Required = true)]
+ public OSSkuId ReportingSku
+ {
+ get; set;
+ }
+
+ [Option('v', "reporting-version", HelpText = "The version to report to the Windows Update servers. Example: 10.0.20152.1000", Required = true)]
+ public string ReportingVersion
+ {
+ get; set;
+ }
+
+ [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
+ public MachineType MachineType
+ {
+ get; set;
+ }
+
+ [Option('r', "flight-ring", HelpText = "The ring to report to the Windows Update servers. Example: Retail, other example: External or Internal", Required = true)]
+ public string FlightRing
+ {
+ get; set;
+ }
+
+ [Option('c', "current-branch", HelpText = "The branch to report to the Windows Update servers. Example: 19h1_release", Required = true)]
+ public string CurrentBranch
+ {
+ get; set;
+ }
+
+ [Option('b', "flighting-branch-name", HelpText = "The flighting branch name to report to the Windows Update servers. Example: Retail, other example: CanaryChannel, Dev, Beta or ReleasePreview", Required = false, Default = "")]
+ public string FlightingBranchName
+ {
+ get; set;
+ }
+
+ [Option('y', "sync-current-version-only", HelpText = "Only get updates for the current version, enables getting cumulative updates.", Required = false, Default = false)]
+ public bool SyncCurrentVersionOnly
+ {
+ get; set;
+ }
+
+ [Option('a', "branch-readiness-level", HelpText = "The branch readiness level to report to the Windows Update servers. Example: CB", Required = false, Default = "CB")]
+ public string BranchReadinessLevel
+ {
+ get; set;
+ }
+
+ [Option('o', "output-folder", HelpText = "The folder to use for downloading the update files.", Required = false, Default = ".")]
+ public string OutputFolder
+ {
+ get; set;
+ }
+
+ [Option('e', "edition", HelpText = "The edition to get. Must be used with the language parameter. Omit either of these to download everything. Example: Professional", Required = false, Default = "")]
+ public string Edition
+ {
+ get; set;
+ }
+
+ [Option('l', "language", HelpText = "The language to get. Must be used with the edition parameter. Omit either of these to download everything. Example: en-US", Required = false, Default = "")]
+ public string Language
+ {
+ get; set;
+ }
+
+ [Option('z', "releasetype", HelpText = "The release type to report to the Windows Update servers. Example: Production", Required = false, Default = "Production")]
+ public string ReleaseType
+ {
+ get; set;
+ }
+
+ [Option('n', "contenttype", HelpText = "The content type to report to the Windows Update servers. Example: Mainline, Custom", Required = false, Default = "Mainline")]
+ public string ContentType
+ {
+ get; set;
+ }
+
+ [Option('m', "mail", HelpText = "Email for the Windows Insider account to use to generate authorization tokens (Optional)", Required = false, Default = "")]
+ public string Mail
+ {
+ get; set;
+ }
+
+ [Option('p', "password", HelpText = "Password for the Windows Insider account to use to generate authorization tokens (If 2FA, must be generated app password) (Optional)", Required = false, Default = "")]
+ public string Password
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions3.cs b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions3.cs
new file mode 100644
index 00000000..f889b8e6
--- /dev/null
+++ b/src/Applications/UUPDownload/Options/BSPDownloadRequestOptions3.cs
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 CommandLine;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace UUPDownload.Options
+{
+ [Verb("request-bsp-download3", HelpText = "Request a BSP download from zero using a number of different request parameters.")]
+ internal class BSPDownloadRequestOptions3
+ {
+ [Option('s', "reporting-sku", HelpText = "The sku to report to the Windows Update servers. Example: Professional", Required = true)]
+ public OSSkuId ReportingSku
+ {
+ get; set;
+ }
+
+ [Option('v', "reporting-version", HelpText = "The version to report to the Windows Update servers. Example: 10.0.20152.1000", Required = true)]
+ public string ReportingVersion
+ {
+ get; set;
+ }
+
+ [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
+ public MachineType MachineType
+ {
+ get; set;
+ }
+
+ [Option('r', "flight-ring", HelpText = "The ring to report to the Windows Update servers. Example: Retail, other example: External or Internal", Required = true)]
+ public string FlightRing
+ {
+ get; set;
+ }
+
+ [Option('c', "current-branch", HelpText = "The branch to report to the Windows Update servers. Example: 19h1_release", Required = true)]
+ public string CurrentBranch
+ {
+ get; set;
+ }
+
+ [Option('b', "flighting-branch-name", HelpText = "The flighting branch name to report to the Windows Update servers. Example: Retail, other example: CanaryChannel, Dev, Beta or ReleasePreview", Required = false, Default = "")]
+ public string FlightingBranchName
+ {
+ get; set;
+ }
+
+ [Option('y', "sync-current-version-only", HelpText = "Only get updates for the current version, enables getting cumulative updates.", Required = false, Default = false)]
+ public bool SyncCurrentVersionOnly
+ {
+ get; set;
+ }
+
+ [Option('a', "branch-readiness-level", HelpText = "The branch readiness level to report to the Windows Update servers. Example: CB", Required = false, Default = "CB")]
+ public string BranchReadinessLevel
+ {
+ get; set;
+ }
+
+ [Option('o', "output-folder", HelpText = "The folder to use for downloading the update files.", Required = false, Default = ".")]
+ public string OutputFolder
+ {
+ get; set;
+ }
+
+ [Option('z', "releasetype", HelpText = "The release type to report to the Windows Update servers. Example: Production", Required = false, Default = "Production")]
+ public string ReleaseType
+ {
+ get; set;
+ }
+
+ [Option('n', "contenttype", HelpText = "The content type to report to the Windows Update servers. Example: Mainline, Custom", Required = false, Default = "Mainline")]
+ public string ContentType
+ {
+ get; set;
+ }
+
+ [Option('m', "mail", HelpText = "Email for the Windows Insider account to use to generate authorization tokens (Optional)", Required = false, Default = "")]
+ public string Mail
+ {
+ get; set;
+ }
+
+ [Option('p', "password", HelpText = "Password for the Windows Insider account to use to generate authorization tokens (If 2FA, must be generated app password) (Optional)", Required = false, Default = "")]
+ public string Password
+ {
+ get; set;
+ }
+
+ // Used above:
+ // a
+ // b
+ // c
+ // m
+ // n
+ // o
+ // p
+ // r
+ // s
+ // t
+ // v
+ // y
+ // z
+
+ [Option('d', "bsp-product-version", HelpText = "", Required = false, Default = "0.0.0.0")]
+ public string BSPProductVersion
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/Options/DownloadReplayOptions.cs b/src/Applications/UUPDownload/Options/DownloadReplayOptions.cs
new file mode 100644
index 00000000..9ab4ef33
--- /dev/null
+++ b/src/Applications/UUPDownload/Options/DownloadReplayOptions.cs
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 CommandLine;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace UUPDownload.Options
+{
+ [Verb("replay-download", isDefault: false, HelpText = "Replay a download from zero using a *.uupmcreplay file.")]
+ internal class DownloadReplayOptions
+ {
+ [Option('r', "replay-metadata", HelpText = @"The path to a *.uupmcreplay file to replay an older update and resume the download process. Example: D:\20236.1005.uupmcreplay", Required = true)]
+ public string ReplayMetadata
+ {
+ get; set;
+ }
+
+ [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
+ public MachineType MachineType
+ {
+ get; set;
+ }
+
+ [Option('o', "output-folder", HelpText = "The folder to use for downloading the update files.", Required = false, Default = ".")]
+ public string OutputFolder
+ {
+ get; set;
+ }
+
+ [Option('e', "edition", HelpText = "The edition to get. Must be used with the language parameter. Omit either of these to download everything. Example: Professional", Required = false, Default = "")]
+ public string Edition
+ {
+ get; set;
+ }
+
+ [Option('l', "language", HelpText = "The language to get. Must be used with the edition parameter. Omit either of these to download everything. Example: en-US", Required = false, Default = "")]
+ public string Language
+ {
+ get; set;
+ }
+
+ [Option("fixup", HelpText = @"Applies a fixup to files in output folder. Example: Appx", Required = false)]
+ public Fixup? Fixup
+ {
+ get; set;
+ }
+
+ [Option("appxroot", HelpText = @"The folder containing the appx files for use with the Appx fixup", Required = false)]
+ public string AppxRoot
+ {
+ get; set;
+ }
+
+ [Option("cabsroot", HelpText = @"The folder containing the cab files for use with the Appx fixup", Required = false)]
+ public string CabsRoot
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/CLIOptions.cs b/src/Applications/UUPDownload/Options/DownloadRequestOptions.cs
similarity index 59%
rename from src/Applications/UUPDownload/CLIOptions.cs
rename to src/Applications/UUPDownload/Options/DownloadRequestOptions.cs
index 9c198b35..390a93b4 100644
--- a/src/Applications/UUPDownload/CLIOptions.cs
+++ b/src/Applications/UUPDownload/Options/DownloadRequestOptions.cs
@@ -20,9 +20,9 @@
* SOFTWARE.
*/
using CommandLine;
-using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
-namespace UUPDownload
+namespace UUPDownload.Options
{
[Verb("request-download", isDefault: true, HelpText = "Request a download from zero using a number of different request parameters.")]
internal class DownloadRequestOptions
@@ -117,90 +117,4 @@ public string Password
get; set;
}
}
-
- [Verb("replay-download", isDefault: false, HelpText = "Replay a download from zero using a *.uupmcreplay file.")]
- internal class DownloadReplayOptions
- {
- [Option('r', "replay-metadata", HelpText = @"The path to a *.uupmcreplay file to replay an older update and resume the download process. Example: D:\20236.1005.uupmcreplay", Required = true)]
- public string ReplayMetadata
- {
- get; set;
- }
-
- [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
- public MachineType MachineType
- {
- get; set;
- }
-
- [Option('o', "output-folder", HelpText = "The folder to use for downloading the update files.", Required = false, Default = ".")]
- public string OutputFolder
- {
- get; set;
- }
-
- [Option('e', "edition", HelpText = "The edition to get. Must be used with the language parameter. Omit either of these to download everything. Example: Professional", Required = false, Default = "")]
- public string Edition
- {
- get; set;
- }
-
- [Option('l', "language", HelpText = "The language to get. Must be used with the edition parameter. Omit either of these to download everything. Example: en-US", Required = false, Default = "")]
- public string Language
- {
- get; set;
- }
-
- [Option("fixup", HelpText = @"Applies a fixup to files in output folder. Example: Appx", Required = false)]
- public Fixup? Fixup
- {
- get; set;
- }
-
- [Option("appxroot", HelpText = @"The folder containing the appx files for use with the Appx fixup", Required = false)]
- public string AppxRoot
- {
- get; set;
- }
-
- [Option("cabsroot", HelpText = @"The folder containing the cab files for use with the Appx fixup", Required = false)]
- public string CabsRoot
- {
- get; set;
- }
- }
-
- [Verb("get-builds", isDefault: false, HelpText = "Get builds in all rings matching the request type")]
- internal class GetBuildsOptions
- {
- [Option('s', "reporting-sku", HelpText = "The sku to report to the Windows Update servers. Example: Professional", Required = true)]
- public OSSkuId ReportingSku
- {
- get; set;
- }
-
- [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
- public MachineType MachineType
- {
- get; set;
- }
-
- [Option('m', "mail", HelpText = "Email for the Windows Insider account to use to generate authorization tokens (Optional)", Required = false, Default = "")]
- public string Mail
- {
- get; set;
- }
-
- [Option('p', "password", HelpText = "Password for the Windows Insider account to use to generate authorization tokens (If 2FA, must be generated app password) (Optional)", Required = false, Default = "")]
- public string Password
- {
- get; set;
- }
-
- [Option("preview-targeting-attribute", HelpText = "The name of the set of targeting attributes to use. (Optional, Preview)", Required = false, Default = "")]
- public string TargetingAttribute
- {
- get; set;
- }
- }
}
diff --git a/src/Applications/UUPDownload/Options/GetBuildsOptions.cs b/src/Applications/UUPDownload/Options/GetBuildsOptions.cs
new file mode 100644
index 00000000..d35f25c3
--- /dev/null
+++ b/src/Applications/UUPDownload/Options/GetBuildsOptions.cs
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 CommandLine;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+
+namespace UUPDownload.Options
+{
+ [Verb("get-builds", isDefault: false, HelpText = "Get builds in all rings matching the request type")]
+ internal class GetBuildsOptions
+ {
+ [Option('s', "reporting-sku", HelpText = "The sku to report to the Windows Update servers. Example: Professional", Required = true)]
+ public OSSkuId ReportingSku
+ {
+ get; set;
+ }
+
+ [Option('t', "machine-type", HelpText = "The architecture to report to the Windows Update servers. Example: amd64", Required = true)]
+ public MachineType MachineType
+ {
+ get; set;
+ }
+
+ [Option('m', "mail", HelpText = "Email for the Windows Insider account to use to generate authorization tokens (Optional)", Required = false, Default = "")]
+ public string Mail
+ {
+ get; set;
+ }
+
+ [Option('p', "password", HelpText = "Password for the Windows Insider account to use to generate authorization tokens (If 2FA, must be generated app password) (Optional)", Required = false, Default = "")]
+ public string Password
+ {
+ get; set;
+ }
+
+ [Option("preview-targeting-attribute", HelpText = "The name of the set of targeting attributes to use. (Optional, Preview)", Required = false, Default = "")]
+ public string TargetingAttribute
+ {
+ get; set;
+ }
+ }
+}
diff --git a/src/Applications/UUPDownload/Program.cs b/src/Applications/UUPDownload/Program.cs
index 898daa8f..8764418a 100644
--- a/src/Applications/UUPDownload/Program.cs
+++ b/src/Applications/UUPDownload/Program.cs
@@ -24,6 +24,7 @@
using System.Diagnostics;
using System.Net;
using System.Reflection;
+using UUPDownload.Options;
namespace UUPDownload
{
@@ -74,12 +75,27 @@ private static int Main(string[] args)
{
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
- return Parser.Default.ParseArguments(args).MapResult(
+ return Parser.Default.ParseArguments(args).MapResult(
(DownloadRequestOptions opts) =>
{
PrintLogo();
return WrapAction(() => DownloadRequest.Process.ParseDownloadOptions(opts));
},
+ (BSPDownloadRequestOptions opts) =>
+ {
+ PrintLogo();
+ return WrapAction(() => DownloadRequest.Drivers.ProcessDrivers.ParseDownloadOptions(opts));
+ },
+ (BSPDownloadRequestOptions2 opts) =>
+ {
+ PrintLogo();
+ return WrapAction(() => DownloadRequest.ReferenceDriversRepo.ProcessDrivers.ParseDownloadOptions(opts));
+ },
+ (BSPDownloadRequestOptions3 opts) =>
+ {
+ PrintLogo();
+ return WrapAction(() => DownloadRequest.DriversAuto.ProcessDrivers.ParseDownloadOptions(opts));
+ },
(DownloadReplayOptions opts) =>
{
PrintLogo();
diff --git a/src/Applications/UUPDownload/Properties/launchSettings.json b/src/Applications/UUPDownload/Properties/launchSettings.json
index 1c8bc178..aba8c7d5 100644
--- a/src/Applications/UUPDownload/Properties/launchSettings.json
+++ b/src/Applications/UUPDownload/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"UnifiedUpdatePlatform.Media.Download": {
"commandName": "Project",
- "commandLineArgs": "-s Professional -v 10.0.22635.2483 -t amd64 -r External -b Dev -a CB -c ni_release -y"
+ "commandLineArgs": "request-bsp-download3 -s Professional -v 10.0.26200.2483 -t arm64 -r Retail -b Retail -a CB -c ge_release -o C:\\Users\\gus33\\Documents\\GitHub\\WOA-Project\\Reference\\Qualcomm-Reference-Drivers\\TESTING -y --bsp-product-version 200.0.9.0"
}
}
}
\ No newline at end of file
diff --git a/src/Applications/UUPDownload/RingCheck.cs b/src/Applications/UUPDownload/RingCheck.cs
index 53b5e756..975c06b5 100644
--- a/src/Applications/UUPDownload/RingCheck.cs
+++ b/src/Applications/UUPDownload/RingCheck.cs
@@ -24,6 +24,8 @@
using System.Linq;
using System.Threading.Tasks;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
+using UUPDownload.Options;
namespace UUPDownload
{
@@ -59,7 +61,7 @@ internal static void ParseGetBuildsOptions(GetBuildsOptions opts)
private static async Task GetRingBuilds(GetBuildsOptions opts)
{
- Dictionary CTACs = new();
+ Dictionary CTACs = [];
CTACs = string.IsNullOrWhiteSpace(opts.TargetingAttribute)
? GetRingCTACs(opts.MachineType, opts.ReportingSku)
diff --git a/src/Applications/UUPDownload/UUPDownload.csproj b/src/Applications/UUPDownload/UUPDownload.csproj
index 4af18b76..892d52c9 100644
--- a/src/Applications/UUPDownload/UUPDownload.csproj
+++ b/src/Applications/UUPDownload/UUPDownload.csproj
@@ -9,6 +9,14 @@
MinimumRecommendedRules.ruleset
AnyCPU;x64;x86;arm64
+
+
+
+
+
+ Always
+
+
@@ -19,5 +27,6 @@
+
\ No newline at end of file
diff --git a/src/Applications/UUPDownload/UpdateUtils.cs b/src/Applications/UUPDownload/UpdateUtils.cs
index f00a503d..2a35ddb4 100644
--- a/src/Applications/UUPDownload/UpdateUtils.cs
+++ b/src/Applications/UUPDownload/UpdateUtils.cs
@@ -30,7 +30,7 @@ namespace UUPDownload
{
public static class UpdateUtils
{
- public static string GetFilenameForCEUIFile(CExtendedUpdateInfoXml.File file2, IEnumerable payloadItems)
+ public static string GetFilenameForCEUIFile(UnifiedUpdatePlatform.Services.WindowsUpdate.Models.FE3.XML.ExtendedUpdateInfo.File file2, IEnumerable payloadItems)
{
string filename = file2.FileName.Replace('\\', Path.DirectorySeparatorChar);
if (payloadItems.Any(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest))
@@ -38,7 +38,7 @@ public static string GetFilenameForCEUIFile(CExtendedUpdateInfoXml.File file2, I
PayloadItem payload = payloadItems.First(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest);
return payload.Path.Replace('\\', Path.DirectorySeparatorChar);
}
- else if (!payloadItems.Any() && filename.Contains('_') && !filename.StartsWith("_") && (!filename.Contains('-') || filename.IndexOf('-') > filename.IndexOf('_')))
+ else if (!payloadItems.Any() && filename.Contains('_') && !filename.StartsWith('_') && (!filename.Contains('-') || filename.IndexOf('-') > filename.IndexOf('_')))
{
filename = filename[..filename.IndexOf('_')] + Path.DirectorySeparatorChar + filename[(filename.IndexOf('_') + 1)..];
return filename.TrimStart(Path.DirectorySeparatorChar);
@@ -46,7 +46,7 @@ public static string GetFilenameForCEUIFile(CExtendedUpdateInfoXml.File file2, I
return filename;
}
- public static bool ShouldFileGetDownloaded(CExtendedUpdateInfoXml.File file2, IEnumerable payloadItems)
+ public static bool ShouldFileGetDownloaded(UnifiedUpdatePlatform.Services.WindowsUpdate.Models.FE3.XML.ExtendedUpdateInfo.File file2, IEnumerable payloadItems)
{
string filename = file2.FileName.Replace('\\', Path.DirectorySeparatorChar);
if (payloadItems.Any(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest))
diff --git a/src/Applications/UUPMediaConverter/CLIOptions.cs b/src/Applications/UUPMediaConverter/CLIOptions.cs
index bada263a..a83cc0fc 100644
--- a/src/Applications/UUPMediaConverter/CLIOptions.cs
+++ b/src/Applications/UUPMediaConverter/CLIOptions.cs
@@ -63,6 +63,9 @@ public UnifiedUpdatePlatform.Common.Messaging.Common.CompressionType Compression
}
[Option("no-key-prompt", HelpText = "Use the alternate efisys and cdboot implementations to suppress the 'press any key' prompt", Required = false)]
- public bool SuppressAnyKeyPrompt { get; set; }
+ public bool SuppressAnyKeyPrompt
+ {
+ get; set;
+ }
}
}
diff --git a/src/Cabinet/Cabinet.cs b/src/Cabinet/Cabinet.cs
index e82ee1b5..ccb42de1 100644
--- a/src/Cabinet/Cabinet.cs
+++ b/src/Cabinet/Cabinet.cs
@@ -224,7 +224,7 @@ private CabinetHeader ReadHeader(Stream cabinetStream)
{
byte cbCFFolder = 0;
byte cbCFData = 0;
- byte[] AdditionalData = Array.Empty();
+ byte[] AdditionalData = [];
BinaryReader cabinetBinaryReader = new(cabinetStream);
@@ -272,13 +272,13 @@ private IReadOnlyCollection ReadVolumes(Stream cabinetStream)
{
BinaryReader cabinetBinaryReader = new(cabinetStream);
- List volumes = new();
+ List volumes = [];
for (int i = 0; i < cabinetHeader.CabinetFileHeader.cFolders; i++)
{
CabinetVolume volume = new()
{
CabinetFileVolume = cabinetStream.ReadStruct(),
- AdditionalApplicationData = cabinetHeader.VolumeAdditionalApplicationDataSize > 0 ? cabinetBinaryReader.ReadBytes(cabinetHeader.VolumeAdditionalApplicationDataSize) : Array.Empty()
+ AdditionalApplicationData = cabinetHeader.VolumeAdditionalApplicationDataSize > 0 ? cabinetBinaryReader.ReadBytes(cabinetHeader.VolumeAdditionalApplicationDataSize) : []
};
if (volume.CabinetFileVolume.typeCompress is not CFFOLDER.CFTYPECOMPRESS.TYPE_LZX and
@@ -311,7 +311,7 @@ private IReadOnlyCollection ReadVolumeFiles(Stream cabinetStr
throw new Exception("Bad Cabinet: First File Block does not match header");
}
- List files = new();
+ List files = [];
for (int i = 0; i < cabinetHeader.CabinetFileHeader.cFiles; i++)
{
CFFILE file = cabinetBinaryReader.BaseStream.ReadStruct();
@@ -330,7 +330,7 @@ private IReadOnlyCollection ReadVolumeFiles(Stream cabinetStr
private List<(CFDATA dataStruct, int dataOffsetCabinet, int beginFolderOffset, int endFolderOffset, int index)> BuildDataMap(CabinetVolume volume)
{
- List<(CFDATA dataStruct, int dataOffsetCabinet, int beginFolderOffset, int endFolderOffset, int index)> datas = new();
+ List<(CFDATA dataStruct, int dataOffsetCabinet, int beginFolderOffset, int endFolderOffset, int index)> datas = [];
// Build Data Map
using BinaryReader cabinetBinaryReader = new(InputStream, System.Text.Encoding.UTF8, true);
@@ -351,7 +351,7 @@ private IReadOnlyCollection ReadVolumeFiles(Stream cabinetStr
private List<(CabinetVolumeFile file, int startingBlock, int startingBlockOffset, int endingBlock, int endingBlockOffset)> BuildBlockMap(int volumeIndex, List<(CFDATA dataStruct, int dataOffsetCabinet, int beginFolderOffset, int endFolderOffset, int index)> datas)
{
- List<(CabinetVolumeFile file, int startingBlock, int startingBlockOffset, int endingBlock, int endingBlockOffset)> fileBlockMap = new();
+ List<(CabinetVolumeFile file, int startingBlock, int startingBlockOffset, int endingBlock, int endingBlockOffset)> fileBlockMap = [];
// Build Block Map
foreach (CabinetVolumeFile file in files)
diff --git a/src/CompDB/Applications/AppxInstallWorkload.cs b/src/CompDB/Applications/AppxInstallWorkload.cs
index 87267f10..a5850280 100644
--- a/src/CompDB/Applications/AppxInstallWorkload.cs
+++ b/src/CompDB/Applications/AppxInstallWorkload.cs
@@ -1,12 +1,10 @@
-using System;
-
-namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
+namespace UnifiedUpdatePlatform.Services.Composition.Database.Applications
{
public class AppxInstallWorkload
{
public string AppXPath { get; set; } = "";
public string LicensePath { get; set; } = "";
- public string[] DependenciesPath { get; set; } = Array.Empty();
+ public string[] DependenciesPath { get; set; } = [];
public string StubPackageOption { get; set; } = "";
public override string ToString()
diff --git a/src/CompDB/Applications/AppxSelectionEngine.cs b/src/CompDB/Applications/AppxSelectionEngine.cs
index 2eff4bd8..0956856a 100644
--- a/src/CompDB/Applications/AppxSelectionEngine.cs
+++ b/src/CompDB/Applications/AppxSelectionEngine.cs
@@ -37,7 +37,7 @@ public static class AppxSelectionEngine
///
///
///
- private static (Dictionary preinstalledApps, Feature[] appsFeatures) SetupVariables(CompDB editionCdb, IEnumerable appsCdbs)
+ private static (Dictionary preinstalledApps, Feature[] appsFeatures) SetupVariables(BaseManifest editionCdb, IEnumerable appsCdbs)
{
Dictionary preinstalledApps = editionCdb.Features.Feature
.First(x => x.Type == "DesktopMedia")
@@ -48,9 +48,9 @@ private static (Dictionary preinstalledApps, Featu
.Distinct()
.ToDictionary(x => x, _ => new DeploymentProperties());
- List appsFeatures = new();
+ List appsFeatures = [];
- foreach (CompDB appsCdb in appsCdbs)
+ foreach (BaseManifest appsCdb in appsCdbs)
{
appsFeatures.AddRange(appsCdb.Features.Feature);
}
@@ -80,7 +80,7 @@ private static (Dictionary preinstalledApps, Featu
continue;
}
- HashSet depsForApp = new();
+ HashSet depsForApp = [];
foreach (Feature dep in dependencies)
{
string depAppId = dep.FeatureID;
@@ -108,7 +108,7 @@ private static (Dictionary preinstalledApps, Featu
/// The edition Composition Database to generate licenses for
/// The application Composition Database
/// The path to the repository file set
- public static void GenerateLicenseXmlFiles(CompDB editionCdb, IEnumerable appsCdbs, string repositoryPath)
+ public static void GenerateLicenseXmlFiles(BaseManifest editionCdb, IEnumerable appsCdbs, string repositoryPath)
{
(Dictionary preinstalledApps, Feature[] appsFeatures) = SetupVariables(editionCdb, appsCdbs);
@@ -142,15 +142,15 @@ public static void GenerateLicenseXmlFiles(CompDB editionCdb, IEnumerableThe application Composition Database
/// The path to the repository file set
///
- public static AppxInstallWorkload[] GetAppxInstallationWorkloads(CompDB editionCdb, IEnumerable appsCdbs, string editionLanguage)
+ public static AppxInstallWorkload[] GetAppxInstallationWorkloads(BaseManifest editionCdb, IEnumerable appsCdbs, string editionLanguage)
{
- List workloads = new();
+ List workloads = [];
IEnumerable applicableLanguageTags = GetAllPossibleLanguageCombinations(editionLanguage);
(Dictionary preinstalledApps, Feature[] appsFeatures) = SetupVariables(editionCdb, appsCdbs);
- HashSet allPackageIDs = new();
+ HashSet allPackageIDs = [];
// Pick packages and dump licenses
foreach (Feature ftr in appsFeatures)
{
@@ -184,8 +184,8 @@ public static AppxInstallWorkload[] GetAppxInstallationWorkloads(CompDB editionC
}
}
- Dictionary packageHashDict = new();
- foreach (CompDB appsCdb in appsCdbs)
+ Dictionary packageHashDict = [];
+ foreach (BaseManifest appsCdb in appsCdbs)
{
foreach (Package p in appsCdb.Packages.Package)
{
@@ -217,13 +217,13 @@ public static AppxInstallWorkload[] GetAppxInstallationWorkloads(CompDB editionC
if (deployProps.Dependencies != null)
{
- List dependencies = new();
+ List dependencies = [];
foreach (string dependency in deployProps.Dependencies)
{
DeploymentProperties dependProps = preinstalledApps[dependency];
dependencies.Add(packageHashDict[dependProps.MainPackageID].Path);
}
- workload.DependenciesPath = dependencies.ToArray();
+ workload.DependenciesPath = [.. dependencies];
}
if (deployProps.HasLicense)
@@ -239,7 +239,7 @@ public static AppxInstallWorkload[] GetAppxInstallationWorkloads(CompDB editionC
workloads.Add(workload);
}
- return workloads.ToArray();
+ return [.. workloads];
}
private static readonly Dictionary languageMap = new()
@@ -496,13 +496,13 @@ private static IEnumerable GetAllPossibleLanguageCombinations(string edi
/// The application Composition Database
/// The path to the repository file set
///
- public static PackageProperties[] GetAppxFilesToKeep(CompDB editionCdb, IEnumerable appsCdbs, string editionLanguage)
+ public static PackageProperties[] GetAppxFilesToKeep(BaseManifest editionCdb, IEnumerable appsCdbs, string editionLanguage)
{
IEnumerable applicableLanguageTags = GetAllPossibleLanguageCombinations(editionLanguage);
(Dictionary preinstalledApps, Feature[] appsFeatures) = SetupVariables(editionCdb, appsCdbs);
- HashSet allPackageIDs = new();
+ HashSet allPackageIDs = [];
// Pick packages and dump licenses
foreach (Feature ftr in appsFeatures)
{
@@ -536,8 +536,8 @@ public static PackageProperties[] GetAppxFilesToKeep(CompDB editionCdb, IEnumera
}
}
- Dictionary packageHashDict = new();
- foreach (CompDB appsCdb in appsCdbs)
+ Dictionary packageHashDict = [];
+ foreach (BaseManifest appsCdb in appsCdbs)
{
foreach (Package p in appsCdb.Packages.Package)
{
diff --git a/src/CompDB/Applications/DeploymentProperties.cs b/src/CompDB/Applications/DeploymentProperties.cs
index d11667af..11407a80 100644
--- a/src/CompDB/Applications/DeploymentProperties.cs
+++ b/src/CompDB/Applications/DeploymentProperties.cs
@@ -57,7 +57,7 @@ public bool HasLicense
public void AddApplicablePackages(IEnumerable packageElements, IEnumerable applicableLanguageTags)
{
- PackageIDs = new HashSet();
+ PackageIDs = [];
Dictionary scaleDictionary = null;
foreach (Package package in packageElements)
{
diff --git a/src/CompDB/ApplyTo.cs b/src/CompDB/ApplyTo.cs
index e2540b09..c8c5c370 100644
--- a/src/CompDB/ApplyTo.cs
+++ b/src/CompDB/ApplyTo.cs
@@ -23,15 +23,15 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "ApplyTo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "ApplyTo")]
public class ApplyTo
{
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
}
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
diff --git a/src/CompDB/ApplyToInfo.cs b/src/CompDB/ApplyToInfo.cs
index e643ec57..7480b28c 100644
--- a/src/CompDB/ApplyToInfo.cs
+++ b/src/CompDB/ApplyToInfo.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "ApplyToInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "ApplyToInfo")]
public class ApplyToInfo
{
- [XmlElement(ElementName = "ApplyTo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ApplyTo")]
public List ApplyTo
{
get; set;
diff --git a/src/CompDB/Appx.cs b/src/CompDB/Appx.cs
index c10e58f2..5ef088f8 100644
--- a/src/CompDB/Appx.cs
+++ b/src/CompDB/Appx.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "AppX", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "AppX")]
public class Appx
{
- [XmlElement(ElementName = "AppXPackages", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "AppXPackages")]
public AppxPackages AppXPackages
{
get; set;
diff --git a/src/CompDB/AppxPackage.cs b/src/CompDB/AppxPackage.cs
index 921051b8..347d16c6 100644
--- a/src/CompDB/AppxPackage.cs
+++ b/src/CompDB/AppxPackage.cs
@@ -23,7 +23,7 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Package", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Package")]
public class AppxPackage
{
[XmlAttribute(AttributeName = "AppXPackageType")]
@@ -41,12 +41,12 @@ public string FamilyName
{
get; set;
}
- [XmlElement(ElementName = "Payload", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Payload")]
public Payload Payload
{
get; set;
}
- [XmlElement(ElementName = "LicenseData", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "LicenseData")]
public string LicenseData
{
get; set;
diff --git a/src/CompDB/AppxPackages.cs b/src/CompDB/AppxPackages.cs
index 36c6ab26..f882ec54 100644
--- a/src/CompDB/AppxPackages.cs
+++ b/src/CompDB/AppxPackages.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "AppXPackages", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "AppXPackages")]
public class AppxPackages
{
- [XmlElement(ElementName = "Package", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Package")]
public List Package
{
get; set;
diff --git a/src/CompDB/BaseManifest.cs b/src/CompDB/BaseManifest.cs
new file mode 100644
index 00000000..f0b23d79
--- /dev/null
+++ b/src/CompDB/BaseManifest.cs
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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.Xml.Serialization;
+
+namespace UnifiedUpdatePlatform.Services.Composition.Database
+{
+ public class BaseManifest
+ {
+ [XmlElement(ElementName = "Tags")]
+ public Tags Tags
+ {
+ get; set;
+ }
+ [XmlElement(ElementName = "Features")]
+ public Features Features
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "xsi", Namespace = "http://www.w3.org/2000/xmlns/")]
+ public string Xsi
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "xsd", Namespace = "http://www.w3.org/2000/xmlns/")]
+ public string Xsd
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "CreatedDate")]
+ public string CreatedDate
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "Revision")]
+ public string Revision
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "SchemaVersion")]
+ public string SchemaVersion
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "Product")]
+ public string Product
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "BuildID")]
+ public string BuildID
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "BuildInfo")]
+ public string BuildInfo
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "OSVersion")]
+ public string OSVersion
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "BuildArch")]
+ public string BuildArch
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "ReleaseType")]
+ public string ReleaseType
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "Type")]
+ public string Type
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "Name")]
+ public string Name
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "xmlns")]
+ public string Xmlns
+ {
+ get; set;
+ }
+ [XmlElement(ElementName = "Packages")]
+ public Packages Packages
+ {
+ get; set;
+ }
+ [XmlElement(ElementName = "AppX")]
+ public Appx AppX
+ {
+ get; set;
+ }
+ [XmlElement(ElementName = "MSConditionalFeatures")]
+ public MSConditionalFeatures MSConditionalFeatures
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "TargetBuildID")]
+ public string TargetBuildID
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "TargetBuildInfo")]
+ public string TargetBuildInfo
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "TargetOSVersion")]
+ public string TargetOSVersion
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "UUPProduct")]
+ public string UUPProduct
+ {
+ get; set;
+ }
+ [XmlAttribute(AttributeName = "UUPProductVersion")]
+ public string UUPProductVersion
+ {
+ get; set;
+ }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+}
diff --git a/src/CompDB/CompDBExtensions.cs b/src/CompDB/BaseManifestExtensions.cs
similarity index 53%
rename from src/CompDB/CompDBExtensions.cs
rename to src/CompDB/BaseManifestExtensions.cs
index 159e22d0..b3110377 100644
--- a/src/CompDB/CompDBExtensions.cs
+++ b/src/CompDB/BaseManifestExtensions.cs
@@ -26,134 +26,134 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- public static class CompDBExtensions
+ public static class BaseManifestExtensions
{
public static string GetCommonlyUsedIncorrectFileName(this Package pkg)
{
return pkg.Payload.PayloadItem.First(x => !x.Path.EndsWith(".psf")).Path.Replace('\\', Path.DirectorySeparatorChar).Split(Path.DirectorySeparatorChar).Last().Replace("~31bf3856ad364e35", "").Replace("~.", ".").Replace("~", "-").Replace("-.", ".");
}
- public static CompDB GetNeutralCompDB(this IEnumerable compDBs)
+ public static BaseManifest GetNeutralCompDB(this IEnumerable BaseManifests)
{
- foreach (CompDB compDB in compDBs)
+ foreach (BaseManifest BaseManifest in BaseManifests)
{
- if (compDB.Type != "Build")
+ if (BaseManifest.Type != "Build")
{
continue;
}
- if (compDB.Name?.Contains("Desktop_FOD") == true)
+ if (BaseManifest.Name?.Contains("Desktop_FOD") == true)
{
continue;
}
//
- // Newer style compdbs have a tag attribute, make use of it.
+ // Newer style BaseManifests have a tag attribute, make use of it.
//
- if (compDB.Tags != null)
+ if (BaseManifest.Tags != null)
{
- if (compDB.Tags.Type.Equals("Neutral", StringComparison.InvariantCultureIgnoreCase) &&
- compDB.Tags.Tag?.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
- compDB.Features?.Feature != null &&
- compDB.Packages?.Package != null)
+ if (BaseManifest.Tags.Type.Equals("Neutral", StringComparison.InvariantCultureIgnoreCase) &&
+ BaseManifest.Tags.Tag?.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
+ BaseManifest.Features?.Feature != null &&
+ BaseManifest.Packages?.Package != null)
{
- return compDB;
+ return BaseManifest;
}
}
//
- // Older style compdbs have no tag elements, we need to find out if it's a neutral compdb using another way
+ // Older style BaseManifests have no tag elements, we need to find out if it's a neutral BaseManifest using another way
//
- else if (compDB.Features?.Feature?.FirstOrDefault(x =>
+ else if (BaseManifest.Features?.Feature?.FirstOrDefault(x =>
x.Type?.Contains("BaseNeutral", StringComparison.InvariantCultureIgnoreCase) == true) != null)
{
- return compDB;
+ return BaseManifest;
}
}
return null;
}
- public static HashSet GetEditionCompDBsForLanguage(
- this IEnumerable compDBs,
+ public static HashSet GetEditionCompDBsForLanguage(
+ this IEnumerable BaseManifests,
string LanguageCode)
{
- HashSet filteredCompDBs = new();
+ HashSet filteredBaseManifests = [];
- foreach (CompDB compDB in compDBs)
+ foreach (BaseManifest BaseManifest in BaseManifests)
{
//
- // Newer style compdbs have a tag attribute, make use of it.
+ // Newer style BaseManifests have a tag attribute, make use of it.
// TODO: Do not do contains
//
- if (compDB.Tags != null)
+ if (BaseManifest.Tags != null)
{
- if (compDB.Tags.Type.Equals("Edition", StringComparison.InvariantCultureIgnoreCase) &&
- compDB.Tags.Tag?.Count == 3 &&
- compDB.Tags.Tag.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
- compDB.Tags.Tag.Find(x => x.Name.Equals("Language", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals(LanguageCode, StringComparison.InvariantCultureIgnoreCase) == true &&
- compDB.Tags.Tag.Any(x => x.Name.Equals("Edition", StringComparison.InvariantCultureIgnoreCase)) &&
- compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
- compDB.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
+ if (BaseManifest.Tags.Type.Equals("Edition", StringComparison.InvariantCultureIgnoreCase) &&
+ BaseManifest.Tags.Tag?.Count == 3 &&
+ BaseManifest.Tags.Tag.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
+ BaseManifest.Tags.Tag.Find(x => x.Name.Equals("Language", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals(LanguageCode, StringComparison.InvariantCultureIgnoreCase) == true &&
+ BaseManifest.Tags.Tag.Any(x => x.Name.Equals("Edition", StringComparison.InvariantCultureIgnoreCase)) &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps~~") != true &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
{
- _ = filteredCompDBs.Add(compDB);
+ _ = filteredBaseManifests.Add(BaseManifest);
}
}
//
- // Older style compdbs have no tag elements, we need to find out if it's an edition compdb using another way
+ // Older style BaseManifests have no tag elements, we need to find out if it's an edition BaseManifest using another way
//
- else if (compDB.Features?.Feature?.FirstOrDefault(x =>
+ else if (BaseManifest.Features?.Feature?.FirstOrDefault(x =>
x.Type?.Contains("DesktopMedia", StringComparison.InvariantCultureIgnoreCase) == true &&
x.FeatureID?.Contains(LanguageCode, StringComparison.InvariantCultureIgnoreCase) == true) != null &&
- compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
- compDB.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
+ BaseManifest.Name?.EndsWith("~Desktop_Apps~~") != true &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
{
- _ = filteredCompDBs.Add(compDB);
+ _ = filteredBaseManifests.Add(BaseManifest);
}
}
- return filteredCompDBs;
+ return filteredBaseManifests;
}
- public static HashSet GetEditionCompDBs(this IEnumerable compDBs)
+ public static HashSet GetEditionCompDBs(this IEnumerable BaseManifests)
{
- HashSet filteredCompDBs = new();
+ HashSet filteredBaseManifests = [];
- foreach (CompDB compDB in compDBs)
+ foreach (BaseManifest BaseManifest in BaseManifests)
{
//
- // Newer style compdbs have a tag attribute, make use of it.
+ // Newer style BaseManifests have a tag attribute, make use of it.
// TODO: Do not do contains
//
- if (compDB.Tags != null)
+ if (BaseManifest.Tags != null)
{
- if (compDB.Tags.Type.Equals("Edition", StringComparison.InvariantCultureIgnoreCase) &&
- compDB.Tags.Tag?.Count == 3 &&
- compDB.Tags.Tag.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
- compDB.Tags.Tag.Any(x => x.Name.Equals("Edition", StringComparison.InvariantCultureIgnoreCase)) &&
- compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
- compDB.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
+ if (BaseManifest.Tags.Type.Equals("Edition", StringComparison.InvariantCultureIgnoreCase) &&
+ BaseManifest.Tags.Tag?.Count == 3 &&
+ BaseManifest.Tags.Tag.Find(x => x.Name.Equals("UpdateType", StringComparison.InvariantCultureIgnoreCase))?.Value?.Equals("Canonical", StringComparison.InvariantCultureIgnoreCase) == true &&
+ BaseManifest.Tags.Tag.Any(x => x.Name.Equals("Edition", StringComparison.InvariantCultureIgnoreCase)) &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps~~") != true &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
{
- _ = filteredCompDBs.Add(compDB);
+ _ = filteredBaseManifests.Add(BaseManifest);
}
}
//
- // Older style compdbs have no tag elements, we need to find out if it's an edition compdb using another way
+ // Older style BaseManifests have no tag elements, we need to find out if it's an edition BaseManifest using another way
//
- else if (compDB.Features?.Feature?.FirstOrDefault(x =>
+ else if (BaseManifest.Features?.Feature?.FirstOrDefault(x =>
x.Type?.Contains("DesktopMedia", StringComparison.InvariantCultureIgnoreCase) == true) != null &&
- compDB.Name?.EndsWith("~Desktop_Apps~~") != true &&
- compDB.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
+ BaseManifest.Name?.EndsWith("~Desktop_Apps~~") != true &&
+ BaseManifest.Name?.EndsWith("~Desktop_Apps_Moment~~") != true)
{
- _ = filteredCompDBs.Add(compDB);
+ _ = filteredBaseManifests.Add(BaseManifest);
}
}
- return filteredCompDBs;
+ return filteredBaseManifests;
}
- public static IEnumerable GetAvailableLanguages(this IEnumerable compDBs)
+ public static IEnumerable GetAvailableLanguages(this IEnumerable BaseManifests)
{
- return compDBs.GetEditionCompDBs().Select(x =>
+ return BaseManifests.GetEditionCompDBs().Select(x =>
{
if (x.Tags != null)
{
@@ -171,22 +171,22 @@ public static IEnumerable GetAvailableLanguages(this IEnumerable
}).Where(x => !string.IsNullOrEmpty(x)).Distinct();
}
- public static Package GetEditionPackFromCompDBs(this IEnumerable compDBs)
+ public static Package GetEditionPackFromCompDBs(this IEnumerable BaseManifests)
{
- HashSet pkgs = new();
+ HashSet pkgs = [];
//
// Get base editions that are available with all their files
//
- HashSet filteredCompDBs = compDBs.GetEditionCompDBs();
+ HashSet filteredBaseManifests = BaseManifests.GetEditionCompDBs();
- if (filteredCompDBs.Count > 0)
+ if (filteredBaseManifests.Count > 0)
{
- foreach (CompDB compDB in filteredCompDBs)
+ foreach (BaseManifest BaseManifest in filteredBaseManifests)
{
- foreach (Package feature in filteredCompDBs.First().Features.Feature[0].Packages.Package)
+ foreach (Package feature in filteredBaseManifests.First().Features.Feature[0].Packages.Package)
{
- Package pkg = filteredCompDBs.First().Packages.Package.First(x => x.ID == feature.ID);
+ Package pkg = filteredBaseManifests.First().Packages.Package.First(x => x.ID == feature.ID);
IEnumerable files = pkg.Payload.PayloadItem.Select(x => x.Path.Replace('\\', Path.DirectorySeparatorChar));
diff --git a/src/CompDB/CompDB.cs b/src/CompDB/CompDB.cs
index a841ae40..18aeef74 100644
--- a/src/CompDB/CompDB.cs
+++ b/src/CompDB/CompDB.cs
@@ -24,133 +24,8 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "CompDB", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public class CompDB
+ [XmlRoot(ElementName = "CompDB", Namespace = Constants.ImageUpdateNamespace)]
+ public class CompDB : BaseManifest
{
- [XmlElement(ElementName = "Tags", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public Tags Tags
- {
- get; set;
- }
- [XmlElement(ElementName = "Features", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public Features Features
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "xsi", Namespace = "http://www.w3.org/2000/xmlns/")]
- public string Xsi
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "xsd", Namespace = "http://www.w3.org/2000/xmlns/")]
- public string Xsd
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "CreatedDate", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string CreatedDate
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "Revision", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string Revision
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "SchemaVersion", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string SchemaVersion
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "Product", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string Product
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "BuildID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string BuildID
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "BuildInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string BuildInfo
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "OSVersion", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string OSVersion
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "BuildArch", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string BuildArch
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "ReleaseType", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string ReleaseType
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string Type
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "Name", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string Name
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "xmlns", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string Xmlns
- {
- get; set;
- }
- [XmlElement(ElementName = "Packages", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public Packages Packages
- {
- get; set;
- }
- [XmlElement(ElementName = "AppX", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public Appx AppX
- {
- get; set;
- }
- [XmlElement(ElementName = "MSConditionalFeatures", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public MSConditionalFeatures MSConditionalFeatures
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "TargetBuildID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string TargetBuildID
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "TargetBuildInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string TargetBuildInfo
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "TargetOSVersion", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string TargetOSVersion
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "UUPProduct", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string UUPProduct
- {
- get; set;
- }
- [XmlAttribute(AttributeName = "UUPProductVersion", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public string UUPProductVersion
- {
- get; set;
- }
-
- public override string ToString()
- {
- return Name;
- }
}
}
\ No newline at end of file
diff --git a/src/CompDB/Condition.cs b/src/CompDB/Condition.cs
index 1b62c537..bba9ce2c 100644
--- a/src/CompDB/Condition.cs
+++ b/src/CompDB/Condition.cs
@@ -23,50 +23,50 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Condition", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Condition")]
public class Condition
{
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
}
- [XmlAttribute(AttributeName = "Name", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Name")]
public string Name
{
get; set;
}
- [XmlAttribute(AttributeName = "FMID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FMID")]
public string FMID
{
get; set;
}
- [XmlAttribute(AttributeName = "Operator", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Operator")]
public string Operator
{
get; set;
}
- [XmlAttribute(AttributeName = "RegistryKey", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "RegistryKey")]
public string RegistryKey
{
get; set;
}
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
}
- [XmlAttribute(AttributeName = "RegistryKeyType", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "RegistryKeyType")]
public string RegistryKeyType
{
get; set;
}
- [XmlAttribute(AttributeName = "Status", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Status")]
public string Status
{
get; set;
}
- [XmlAttribute(AttributeName = "FeatureStatus", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FeatureStatus")]
public string FeatureStatus
{
get; set;
diff --git a/src/CompDB/ConditionSet.cs b/src/CompDB/ConditionSet.cs
index 6cb6b5a2..67f6214b 100644
--- a/src/CompDB/ConditionSet.cs
+++ b/src/CompDB/ConditionSet.cs
@@ -23,20 +23,20 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "ConditionSet", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "ConditionSet")]
public class ConditionSet
{
- [XmlElement(ElementName = "Conditions", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Conditions")]
public Conditions Conditions
{
get; set;
}
- [XmlAttribute(AttributeName = "Operator", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Operator")]
public string Operator
{
get; set;
}
- [XmlElement(ElementName = "ConditionSets", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ConditionSets")]
public ConditionSets ConditionSets
{
get; set;
diff --git a/src/CompDB/ConditionSets.cs b/src/CompDB/ConditionSets.cs
index 55d4fcf5..8dd9b71d 100644
--- a/src/CompDB/ConditionSets.cs
+++ b/src/CompDB/ConditionSets.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "ConditionSets", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "ConditionSets")]
public class ConditionSets
{
- [XmlElement(ElementName = "ConditionSet", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ConditionSet")]
public ConditionSet ConditionSet
{
get; set;
diff --git a/src/CompDB/ConditionalFeature.cs b/src/CompDB/ConditionalFeature.cs
index f3924f03..de9af0de 100644
--- a/src/CompDB/ConditionalFeature.cs
+++ b/src/CompDB/ConditionalFeature.cs
@@ -23,35 +23,35 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "ConditionalFeature", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "ConditionalFeature")]
public class ConditionalFeature
{
- [XmlElement(ElementName = "Condition", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Condition")]
public Condition Condition
{
get; set;
}
- [XmlAttribute(AttributeName = "InstallAction", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "InstallAction")]
public string InstallAction
{
get; set;
}
- [XmlAttribute(AttributeName = "FeatureID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FeatureID")]
public string FeatureID
{
get; set;
}
- [XmlAttribute(AttributeName = "FMID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FMID")]
public string FMID
{
get; set;
}
- [XmlElement(ElementName = "ConditionSet", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ConditionSet")]
public ConditionSet ConditionSet
{
get; set;
}
- [XmlAttribute(AttributeName = "UpdateAction", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "UpdateAction")]
public string UpdateAction
{
get; set;
diff --git a/src/CompDB/Conditions.cs b/src/CompDB/Conditions.cs
index 8d723b77..315ccbfc 100644
--- a/src/CompDB/Conditions.cs
+++ b/src/CompDB/Conditions.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Conditions", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Conditions")]
public class Conditions
{
- [XmlElement(ElementName = "Condition", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Condition")]
public List Condition
{
get; set;
diff --git a/src/CompDB/Constants.cs b/src/CompDB/Constants.cs
new file mode 100644
index 00000000..1fb0239b
--- /dev/null
+++ b/src/CompDB/Constants.cs
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) Gustave Monce and Contributors
+ *
+ * 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 UnifiedUpdatePlatform.Services.Composition.Database
+{
+ public static class Constants
+ {
+ public const string ImageUpdateNamespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate";
+ }
+}
\ No newline at end of file
diff --git a/src/CompDB/CustomInfo.cs b/src/CompDB/CustomInfo.cs
index 3273e602..55fb1cc7 100644
--- a/src/CompDB/CustomInfo.cs
+++ b/src/CompDB/CustomInfo.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "CustomInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "CustomInfo")]
public class CustomInfo
{
- [XmlAttribute(AttributeName = "Key", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Key")]
public string Key
{
get; set;
diff --git a/src/CompDB/CustomInformation.cs b/src/CompDB/CustomInformation.cs
index 830c28de..3331c8e2 100644
--- a/src/CompDB/CustomInformation.cs
+++ b/src/CompDB/CustomInformation.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "CustomInformation", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "CustomInformation")]
public class CustomInformation
{
- [XmlElement(ElementName = "CustomInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "CustomInfo")]
public CustomInfo[] CustomInfo
{
get; set;
diff --git a/src/CompDB/Declare.cs b/src/CompDB/Declare.cs
index dea2c09c..cc681894 100644
--- a/src/CompDB/Declare.cs
+++ b/src/CompDB/Declare.cs
@@ -23,15 +23,15 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Declare", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Declare")]
public class Declare
{
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
}
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
diff --git a/src/CompDB/DeclareInfo.cs b/src/CompDB/DeclareInfo.cs
index e67d0e92..d679f251 100644
--- a/src/CompDB/DeclareInfo.cs
+++ b/src/CompDB/DeclareInfo.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "DeclareInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "DeclareInfo")]
public class DeclareInfo
{
- [XmlElement(ElementName = "Declare", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Declare")]
public Declare Declare
{
get; set;
diff --git a/src/CompDB/Dependencies.cs b/src/CompDB/Dependencies.cs
index 0c76ac22..e4392439 100644
--- a/src/CompDB/Dependencies.cs
+++ b/src/CompDB/Dependencies.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Dependencies", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Dependencies")]
public class Dependencies
{
- [XmlElement(ElementName = "Feature", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Feature")]
public List Feature
{
get; set;
diff --git a/src/CompDB/DeviceManifest.cs b/src/CompDB/DeviceManifest.cs
index b5f5f48f..db481657 100644
--- a/src/CompDB/DeviceManifest.cs
+++ b/src/CompDB/DeviceManifest.cs
@@ -23,8 +23,8 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "DeviceManifest", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
- public class DeviceManifest : CompDB
+ [XmlRoot(ElementName = "DeviceManifest")]
+ public class DeviceManifest : BaseManifest
{
}
}
\ No newline at end of file
diff --git a/src/CompDB/Feature.cs b/src/CompDB/Feature.cs
index acc5c34a..305b83ef 100644
--- a/src/CompDB/Feature.cs
+++ b/src/CompDB/Feature.cs
@@ -23,50 +23,50 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Feature", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Feature")]
public class Feature
{
- [XmlElement(ElementName = "Packages", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Packages")]
public Packages Packages
{
get; set;
}
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
}
- [XmlAttribute(AttributeName = "FeatureID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FeatureID")]
public string FeatureID
{
get; set;
}
- [XmlAttribute(AttributeName = "FMID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "FMID")]
public string FMID
{
get; set;
}
- [XmlAttribute(AttributeName = "Group", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Group")]
public string Group
{
get; set;
}
- [XmlElement(ElementName = "Dependencies", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Dependencies")]
public Dependencies Dependencies
{
get; set;
}
- [XmlElement(ElementName = "InitialIntents", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "InitialIntents")]
public InitialIntents InitialIntents
{
get; set;
}
- [XmlElement(ElementName = "CustomInformation", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "CustomInformation")]
public CustomInformation CustomInformation
{
get; set;
}
- [XmlAttribute(AttributeName = "Family", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Family")]
public string Family
{
get; set;
diff --git a/src/CompDB/Features.cs b/src/CompDB/Features.cs
index c6d93a16..2bdecdcd 100644
--- a/src/CompDB/Features.cs
+++ b/src/CompDB/Features.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Features", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Features")]
public class Features
{
- [XmlElement(ElementName = "Feature", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Feature")]
public Feature[] Feature
{
get; set;
diff --git a/src/CompDB/InitialIntent.cs b/src/CompDB/InitialIntent.cs
index 8e1f5fcc..6d2da505 100644
--- a/src/CompDB/InitialIntent.cs
+++ b/src/CompDB/InitialIntent.cs
@@ -23,10 +23,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "InitialIntent", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "InitialIntent")]
public class InitialIntent
{
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
diff --git a/src/CompDB/InitialIntents.cs b/src/CompDB/InitialIntents.cs
index 26478725..3a0bdae3 100644
--- a/src/CompDB/InitialIntents.cs
+++ b/src/CompDB/InitialIntents.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "InitialIntents", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "InitialIntents")]
public class InitialIntents
{
- [XmlElement(ElementName = "InitialIntent", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "InitialIntent")]
public List InitialIntent
{
get; set;
diff --git a/src/CompDB/MSConditionalFeatures.cs b/src/CompDB/MSConditionalFeatures.cs
index 49309015..bc41d323 100644
--- a/src/CompDB/MSConditionalFeatures.cs
+++ b/src/CompDB/MSConditionalFeatures.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "MSConditionalFeatures", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "MSConditionalFeatures")]
public class MSConditionalFeatures
{
- [XmlElement(ElementName = "ConditionalFeature", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ConditionalFeature")]
public List ConditionalFeature
{
get; set;
diff --git a/src/CompDB/Package.cs b/src/CompDB/Package.cs
index ded84baa..5a2c9a94 100644
--- a/src/CompDB/Package.cs
+++ b/src/CompDB/Package.cs
@@ -23,40 +23,40 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Package", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Package")]
public class Package
{
- [XmlAttribute(AttributeName = "ID", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "ID")]
public string ID
{
get; set;
}
- [XmlAttribute(AttributeName = "PackageType", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "PackageType")]
public string PackageType
{
get; set;
}
- [XmlElement(ElementName = "SatelliteInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "SatelliteInfo")]
public SatelliteInfo SatelliteInfo
{
get; set;
}
- [XmlElement(ElementName = "Payload", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Payload")]
public Payload Payload
{
get; set;
}
- [XmlAttribute(AttributeName = "InstalledSize", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "InstalledSize")]
public string InstalledSize
{
get; set;
}
- [XmlAttribute(AttributeName = "Version", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Version")]
public string Version
{
get; set;
}
- [XmlAttribute(AttributeName = "UpdateType", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "UpdateType")]
public string UpdateType
{
get; set;
diff --git a/src/CompDB/Packages.cs b/src/CompDB/Packages.cs
index 960a277c..80f05548 100644
--- a/src/CompDB/Packages.cs
+++ b/src/CompDB/Packages.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Packages", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Packages")]
public class Packages
{
- [XmlElement(ElementName = "Package", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Package")]
public List Package
{
get; set;
diff --git a/src/CompDB/Payload.cs b/src/CompDB/Payload.cs
index 4d61d6d0..e38cd19a 100644
--- a/src/CompDB/Payload.cs
+++ b/src/CompDB/Payload.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Payload", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Payload")]
public class Payload
{
- [XmlElement(ElementName = "PayloadItem", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "PayloadItem")]
public List PayloadItem
{
get; set;
diff --git a/src/CompDB/PayloadItem.cs b/src/CompDB/PayloadItem.cs
index 3449a4de..b0d958a2 100644
--- a/src/CompDB/PayloadItem.cs
+++ b/src/CompDB/PayloadItem.cs
@@ -23,35 +23,35 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "PayloadItem", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "PayloadItem")]
public class PayloadItem
{
- [XmlAttribute(AttributeName = "PayloadHash", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "PayloadHash")]
public string SourceHash
{
get; set;
}
- [XmlAttribute(AttributeName = "PayloadSize", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "PayloadSize")]
public string PayloadSize
{
get; set;
}
- [XmlAttribute(AttributeName = "Path", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Path")]
public string SourceName
{
get; set;
}
- [XmlAttribute(AttributeName = "PayloadType", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "PayloadType")]
public string PayloadType
{
get; set;
}
- [XmlAttribute(AttributeName = "AltSourceName", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "AltSourceName")]
public string AltSourceName
{
get; set;
}
- [XmlAttribute(AttributeName = "AltSourceHash", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "AltSourceHash")]
public string AltSourceHash
{
get; set;
diff --git a/src/CompDB/Require.cs b/src/CompDB/Require.cs
index c952a0de..e29f54d4 100644
--- a/src/CompDB/Require.cs
+++ b/src/CompDB/Require.cs
@@ -23,15 +23,15 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Require", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Require")]
public class Require
{
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
}
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
diff --git a/src/CompDB/RequireInfo.cs b/src/CompDB/RequireInfo.cs
index 4a8206e2..ddd73dcc 100644
--- a/src/CompDB/RequireInfo.cs
+++ b/src/CompDB/RequireInfo.cs
@@ -24,10 +24,10 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "RequireInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "RequireInfo")]
public class RequireInfo
{
- [XmlElement(ElementName = "Require", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Require")]
public List Require
{
get; set;
diff --git a/src/CompDB/SatelliteInfo.cs b/src/CompDB/SatelliteInfo.cs
index 1808885c..6fb45cb8 100644
--- a/src/CompDB/SatelliteInfo.cs
+++ b/src/CompDB/SatelliteInfo.cs
@@ -23,20 +23,20 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "SatelliteInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "SatelliteInfo")]
public class SatelliteInfo
{
- [XmlElement(ElementName = "RequireInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "RequireInfo")]
public RequireInfo RequireInfo
{
get; set;
}
- [XmlElement(ElementName = "ApplyToInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "ApplyToInfo")]
public ApplyToInfo ApplyToInfo
{
get; set;
}
- [XmlElement(ElementName = "DeclareInfo", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "DeclareInfo")]
public DeclareInfo DeclareInfo
{
get; set;
diff --git a/src/CompDB/Tag.cs b/src/CompDB/Tag.cs
index 3b93c561..33d4be89 100644
--- a/src/CompDB/Tag.cs
+++ b/src/CompDB/Tag.cs
@@ -23,15 +23,15 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Tag", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Tag")]
public class Tag
{
- [XmlAttribute(AttributeName = "Name", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Name")]
public string Name
{
get; set;
}
- [XmlAttribute(AttributeName = "Value", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Value")]
public string Value
{
get; set;
diff --git a/src/CompDB/Tags.cs b/src/CompDB/Tags.cs
index 36cb8146..ef2def51 100644
--- a/src/CompDB/Tags.cs
+++ b/src/CompDB/Tags.cs
@@ -24,15 +24,15 @@
namespace UnifiedUpdatePlatform.Services.Composition.Database
{
- [XmlRoot(ElementName = "Tags", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlRoot(ElementName = "Tags")]
public class Tags
{
- [XmlElement(ElementName = "Tag", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlElement(ElementName = "Tag")]
public List Tag
{
get; set;
}
- [XmlAttribute(AttributeName = "Type", Namespace = "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")]
+ [XmlAttribute(AttributeName = "Type")]
public string Type
{
get; set;
diff --git a/src/Microsoft.StoreServices.DisplayCatalog/Microsoft.StoreServices.DisplayCatalog.csproj b/src/Microsoft.StoreServices.DisplayCatalog/Microsoft.StoreServices.DisplayCatalog.csproj
index 937a5f05..76cbed33 100644
--- a/src/Microsoft.StoreServices.DisplayCatalog/Microsoft.StoreServices.DisplayCatalog.csproj
+++ b/src/Microsoft.StoreServices.DisplayCatalog/Microsoft.StoreServices.DisplayCatalog.csproj
@@ -1,14 +1,11 @@
-
net8.0
AnyCPU;x64;x86;arm64
$(SolutionDir)build\$(Platform)\$(Configuration)\Microsoft.StoreServices.DisplayCatalog\
$(SolutionDir)intermediate\$(Platform)\$(Configuration)\Microsoft.StoreServices.DisplayCatalog\
-
-
-
+
\ No newline at end of file
diff --git a/src/TempManager/TempManager.cs b/src/TempManager/TempManager.cs
index d77752a4..12c7ea4f 100644
--- a/src/TempManager/TempManager.cs
+++ b/src/TempManager/TempManager.cs
@@ -24,7 +24,7 @@ namespace UnifiedUpdatePlatform.Services.Temp
public class TempManager : IDisposable
{
private ulong i = 0;
- private readonly List tempPaths = new();
+ private readonly List tempPaths = [];
private bool disposed = false;
private readonly string Temp = Environment.GetEnvironmentVariable("TEMP") ?? "";
diff --git a/src/TempManager/UnifiedUpdatePlatform.Services.Temp.csproj b/src/TempManager/UnifiedUpdatePlatform.Services.Temp.csproj
index feb7253e..5f3dc4ae 100644
--- a/src/TempManager/UnifiedUpdatePlatform.Services.Temp.csproj
+++ b/src/TempManager/UnifiedUpdatePlatform.Services.Temp.csproj
@@ -1,11 +1,8 @@
-
net8.0
enable
enable
AnyCPU;x64;x86;arm64
-
-
-
+
\ No newline at end of file
diff --git a/src/UnifiedUpdatePlatform.Common.Messaging/UnifiedUpdatePlatform.Common.Messaging.csproj b/src/UnifiedUpdatePlatform.Common.Messaging/UnifiedUpdatePlatform.Common.Messaging.csproj
index 54250a0f..4865b2f2 100644
--- a/src/UnifiedUpdatePlatform.Common.Messaging/UnifiedUpdatePlatform.Common.Messaging.csproj
+++ b/src/UnifiedUpdatePlatform.Common.Messaging/UnifiedUpdatePlatform.Common.Messaging.csproj
@@ -8,4 +8,4 @@
$(SolutionDir)intermediate\$(Platform)\$(Configuration)\UnifiedUpdatePlatform.Common.Messaging\
MinimumRecommendedRules.ruleset
-
+
\ No newline at end of file
diff --git a/src/UnifiedUpdatePlatform.Imaging/UnifiedUpdatePlatform.Services.Imaging.csproj b/src/UnifiedUpdatePlatform.Imaging/UnifiedUpdatePlatform.Services.Imaging.csproj
index c475edd1..154bc6c8 100644
--- a/src/UnifiedUpdatePlatform.Imaging/UnifiedUpdatePlatform.Services.Imaging.csproj
+++ b/src/UnifiedUpdatePlatform.Imaging/UnifiedUpdatePlatform.Services.Imaging.csproj
@@ -9,7 +9,7 @@
$(SolutionDir)intermediate\$(Platform)\$(Configuration)\UnifiedUpdatePlatform.Imaging\
9.0
MinimumRecommendedRules.ruleset
- false
+ false
@@ -19,4 +19,4 @@
-
+
\ No newline at end of file
diff --git a/src/UnifiedUpdatePlatform.Media.Creator.Planning/ConversionPlanBuilder.cs b/src/UnifiedUpdatePlatform.Media.Creator.Planning/ConversionPlanBuilder.cs
index 0a671661..7390de10 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator.Planning/ConversionPlanBuilder.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator.Planning/ConversionPlanBuilder.cs
@@ -36,8 +36,8 @@ namespace UnifiedUpdatePlatform.Media.Creator.Planning
public class EditionTarget
{
public PlannedEdition PlannedEdition { get; set; } = new PlannedEdition();
- public List NonDestructiveTargets = new();
- public List DestructiveTargets = new();
+ public List NonDestructiveTargets = [];
+ public List DestructiveTargets = [];
}
public class PlannedEdition
@@ -47,7 +47,7 @@ public AvailabilityType AvailabilityType
{
get; set;
}
- public AppxInstallWorkload[] AppXInstallWorkloads { get; set; } = Array.Empty();
+ public AppxInstallWorkload[] AppXInstallWorkloads { get; set; } = [];
}
public enum AvailabilityType
@@ -155,7 +155,7 @@ ref List editionsAdded
//
// Sort editions by name
//
- target.NonDestructiveTargets = target.NonDestructiveTargets.OrderBy(x => x.PlannedEdition.EditionName).ToList();
+ target.NonDestructiveTargets = [.. target.NonDestructiveTargets.OrderBy(x => x.PlannedEdition.EditionName)];
//
// Handle editions that we can upgrade to using a full upgrade process
@@ -269,25 +269,25 @@ ref List editionsAdded
}
}
- target.DestructiveTargets = target.DestructiveTargets.OrderBy(x => x.PlannedEdition.EditionName).ToList();
+ target.DestructiveTargets = [.. target.DestructiveTargets.OrderBy(x => x.PlannedEdition.EditionName)];
return target;
}
private static (List, List) GetEditionsThatCanBeTargetedUsingPackageDowngrade(
string UUPPath,
- IEnumerable compDBs,
+ IEnumerable compDBs,
IEnumerable availableCanonicalEditions,
List possibleEditionUpgrades,
ProgressCallback? progressCallback = null)
{
- List availableEditionsByDowngradingInPriority = new();
- List availableEditionsByDowngrading = new();
+ List availableEditionsByDowngradingInPriority = [];
+ List availableEditionsByDowngrading = [];
//
// Attempt to get the neutral Composition Database listing all available files
//
- CompDB? neutralCompDB = compDBs.GetNeutralCompDB();
+ BaseManifest? neutralCompDB = compDBs.GetNeutralCompDB();
if (neutralCompDB != null &&
neutralCompDB.Features.Feature.FirstOrDefault(x => x.FeatureID == "BaseNeutral")?
@@ -387,7 +387,7 @@ private static (List, List) GetEditionsThatCanBe
}
public static bool GetTargetedPlan(
- IEnumerable compDBs,
+ IEnumerable compDBs,
string EditionPack,
string LanguageCode,
bool IncludeServicingCapableOnlyTargets,
@@ -400,10 +400,10 @@ public static bool GetTargetedPlan(
public static List PrintEditionTarget(EditionTarget editionTarget, int padding = 0)
{
- List lines = new()
- {
+ List lines =
+ [
$"-> Name: {editionTarget.PlannedEdition.EditionName}, Availability: {editionTarget.PlannedEdition.AvailabilityType}"
- };
+ ];
if (editionTarget.PlannedEdition.AppXInstallWorkloads?.Length > 0)
{
@@ -444,7 +444,7 @@ public static List PrintEditionTarget(EditionTarget editionTarget, int p
public static bool GetTargetedPlan(
string UUPPath,
- IEnumerable compDBs,
+ IEnumerable compDBs,
string EditionPack,
string LanguageCode,
bool IncludeServicingCapableOnlyTargets,
@@ -454,7 +454,7 @@ public static bool GetTargetedPlan(
{
bool VerifyFiles = !string.IsNullOrEmpty(UUPPath);
- EditionTargets = new List();
+ EditionTargets = [];
bool result = true;
@@ -463,7 +463,7 @@ public static bool GetTargetedPlan(
//
// Get base editions that are available with all their files
//
- IEnumerable filteredCompDBs = compDBs.GetEditionCompDBsForLanguage(LanguageCode).Where(x =>
+ IEnumerable filteredCompDBs = compDBs.GetEditionCompDBsForLanguage(LanguageCode).Where(x =>
{
bool success = !VerifyFiles;
if (!success)
@@ -504,7 +504,7 @@ public static bool GetTargetedPlan(
if (compDBs.Any(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true)))
{
- IEnumerable AppCompDBs = compDBs.Where(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true));
+ IEnumerable AppCompDBs = compDBs.Where(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true));
edition.AppXInstallWorkloads = AppxSelectionEngine.GetAppxInstallationWorkloads(compDB, AppCompDBs, LanguageCode);
}
@@ -523,13 +523,13 @@ public static bool GetTargetedPlan(
// This dictionary holds the possible virtual edition upgrades
// Example: Professional -> ProfessionalEducation
//
- List virtualWindowsEditions = new();
+ List virtualWindowsEditions = [];
//
// This dictionary holds the possible edition upgrades
// Example: Core -> Professional
//
- List possibleEditionUpgrades = new();
+ List possibleEditionUpgrades = [];
if (!string.IsNullOrEmpty(EditionPack) && File.Exists(EditionPack))
{
@@ -576,7 +576,7 @@ public static bool GetTargetedPlan(
!string.IsNullOrEmpty(x.Virtual) &&
x.Virtual.Equals("true", StringComparison.InvariantCultureIgnoreCase)).OrderBy(x => x.ParentEdition);
- virtualWindowsEditions = virtualeditions.ToList();
+ virtualWindowsEditions = [.. virtualeditions];
}
catch { }
}
@@ -648,7 +648,7 @@ public static bool GetTargetedPlan(
progressCallback?.Invoke("Building Targets");
- List editionsAdded = new();
+ List editionsAdded = [];
foreach (PlannedEdition? ed in availableCanonicalEditions)
{
diff --git a/src/UnifiedUpdatePlatform.Media.Creator.Planning/FileLocator.cs b/src/UnifiedUpdatePlatform.Media.Creator.Planning/FileLocator.cs
index 6bf1cfea..c136f068 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator.Planning/FileLocator.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator.Planning/FileLocator.cs
@@ -34,9 +34,9 @@ namespace UnifiedUpdatePlatform.Media.Creator.Planning
{
public static class FileLocator
{
- public static List GetCompDBsFromUUPFiles(string UUPPath, TempManager tempManager)
+ public static List GetCompDBsFromUUPFiles(string UUPPath, TempManager tempManager)
{
- List compDBs = new();
+ List compDBs = [];
try
{
@@ -87,9 +87,9 @@ public static List GetCompDBsFromUUPFiles(string UUPPath, TempManager te
return compDBs;
}
- public static (bool, HashSet) VerifyFilesAreAvailableForCompDB(CompDB compDB, string UUPPath)
+ public static (bool, HashSet) VerifyFilesAreAvailableForCompDB(BaseManifest compDB, string UUPPath)
{
- HashSet missingPackages = new();
+ HashSet missingPackages = [];
foreach (Package feature in compDB.Features.Feature[0].Packages.Package)
{
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/BaseEditions/BaseEditionBuilder.cs b/src/UnifiedUpdatePlatform.Media.Creator/BaseEditions/BaseEditionBuilder.cs
index 9c2e3788..b848384e 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/BaseEditions/BaseEditionBuilder.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/BaseEditions/BaseEditionBuilder.cs
@@ -45,7 +45,7 @@ public static bool CreateBaseEdition(
string InputWindowsREPath,
string OutputInstallImage,
Common.Messaging.Common.CompressionType CompressionType,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
TempManager tempManager,
ProgressCallback progressCallback = null)
{
@@ -178,7 +178,7 @@ public static bool CreateBaseEditionWithAppXs(
string OutputInstallImage,
Common.Messaging.Common.CompressionType CompressionType,
AppxInstallWorkload[] appxWorkloads,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
TempManager tempManager,
bool keepVhd,
out string vhdPath,
@@ -355,7 +355,7 @@ private static (bool result, string BaseESD, HashSet ReferencePackages)
string UUPPath,
string LanguageCode,
string EditionID,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
TempManager tempManager,
ProgressCallback progressCallback = null)
{
@@ -398,7 +398,7 @@ private static (bool result, string BaseESD, HashSet ReferencePackages)
goto exit;
}
- Dictionary> iniSections = new();
+ Dictionary> iniSections = [];
foreach (string referencePackageToConvert in referencePackagesToConvert)
{
@@ -413,7 +413,7 @@ private static (bool result, string BaseESD, HashSet ReferencePackages)
{
if (!iniSections.ContainsKey(section.SectionName))
{
- iniSections.Add(section.SectionName, new List());
+ iniSections.Add(section.SectionName, []);
}
foreach (KeyData element in section.Keys)
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/Constants.cs b/src/UnifiedUpdatePlatform.Media.Creator/Constants.cs
index 20f62bd5..f17bfabc 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/Constants.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/Constants.cs
@@ -28,8 +28,8 @@ public static class Constants
{
internal static readonly IImaging imagingInterface = new WimLibImaging();
- internal static byte[] winpejpg = new byte[]
- {
+ internal static byte[] winpejpg =
+ [
0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46,
0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60,
0x00, 0x60, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x43,
@@ -111,7 +111,7 @@ public static class Constants
0xBE, 0x8A, 0x28, 0xAF, 0xEB, 0x03, 0xF8, 0xAC,
0x28, 0xA2, 0x8A, 0x00, 0x28, 0xA2, 0x8A, 0x00,
0x28, 0xA2, 0x8A, 0x00, 0xFF, 0xD9
- };
+ ];
internal static string SOFTWARE_Hive_Location = Path.Combine("Windows", "System32", "config", "SOFTWARE");
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/DismOperations.cs b/src/UnifiedUpdatePlatform.Media.Creator/DismOperations.cs
index ac76ee4c..6061580a 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/DismOperations.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/DismOperations.cs
@@ -41,7 +41,7 @@ private List GetRemovableREPackages(string mountDir)
XDocument sessDoc = XDocument.Load(Path.Combine(mountDir, @"Windows\servicing\Sessions\Sessions.xml"));
IEnumerable sessions = sessDoc.Element("Sessions").Elements("Session");
bool dupeFound = false;
- List pkgsToRemove = new();
+ List pkgsToRemove = [];
foreach (XElement test in sessions)
{
bool phasesEmpty = !test.Element("Actions").Elements("Phase").First().Elements().Any();
@@ -79,7 +79,7 @@ public bool PerformAppxWorkloadInstallation(string ospath, string repositoryPath
DismApi.AddProvisionedAppxPackage(
session,
Path.Combine(repositoryPath, workload.AppXPath),
- workload.DependenciesPath?.Select(x => Path.Combine(repositoryPath, x)).ToList() ?? new List(),
+ workload.DependenciesPath?.Select(x => Path.Combine(repositoryPath, x)).ToList() ?? [],
string.IsNullOrEmpty(workload.LicensePath) ? null : Path.Combine(licenseFolder, workload.LicensePath),
null,
string.IsNullOrEmpty(workload.StubPackageOption) ? DismStubPackageOption.None : DismStubPackageOption.InstallStub); // TODO: proper handling
@@ -142,7 +142,7 @@ public bool PerformAppxWorkloadsInstallation(string ospath, string repositoryPat
DismApi.AddProvisionedAppxPackage(
session,
Path.Combine(repositoryPath, workload.AppXPath),
- workload.DependenciesPath?.Select(x => Path.Combine(repositoryPath, x)).ToList() ?? new List(),
+ workload.DependenciesPath?.Select(x => Path.Combine(repositoryPath, x)).ToList() ?? [],
string.IsNullOrEmpty(workload.LicensePath) ? null : Path.Combine(licenseFolder, workload.LicensePath),
null,
string.IsNullOrEmpty(workload.StubPackageOption) ? DismStubPackageOption.None : DismStubPackageOption.InstallStub); // TODO: proper handling
@@ -203,7 +203,7 @@ public bool UninstallPEComponents(string ospath, ProgressCallback progressCallba
DismSession session = DismApi.OpenOfflineSession(ospath);
DismPackageCollection packages = DismApi.GetPackages(session);
- List componentsToRemove = new();
+ List componentsToRemove = [];
//
// Queue components we don't need according to our hardcoded list for removal
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/FileLocator.cs b/src/UnifiedUpdatePlatform.Media.Creator/FileLocator.cs
index 2c5540d3..d001cb5c 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/FileLocator.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/FileLocator.cs
@@ -32,11 +32,11 @@ namespace UnifiedUpdatePlatform.Media.Creator
{
internal static class FileLocator
{
- internal static (bool, HashSet) VerifyFilesAreAvailableForCompositionDatabases(HashSet CompositionDatabases, string UUPPath)
+ internal static (bool, HashSet) VerifyFilesAreAvailableForCompositionDatabases(HashSet CompositionDatabases, string UUPPath)
{
- HashSet missingPackages = new();
+ HashSet missingPackages = [];
- foreach (CompDB compDB in CompositionDatabases)
+ foreach (BaseManifest compDB in CompositionDatabases)
{
(bool succeeded, HashSet missingFiles) = Planning.FileLocator.VerifyFilesAreAvailableForCompDB(compDB, UUPPath);
foreach (string? missingFile in missingFiles)
@@ -51,12 +51,12 @@ internal static (bool, HashSet) VerifyFilesAreAvailableForCompositionDat
return (missingPackages.Count == 0, missingPackages);
}
- internal static CompDB? GetEditionCompDBForLanguage(
- IEnumerable CompositionDatabases,
+ internal static BaseManifest? GetEditionCompDBForLanguage(
+ IEnumerable CompositionDatabases,
string Edition,
string LanguageCode)
{
- foreach (CompDB? compDB in CompositionDatabases)
+ foreach (BaseManifest? compDB in CompositionDatabases)
{
//
// Newer style compdbs have a tag attribute, make use of it.
@@ -95,15 +95,15 @@ internal static (bool, HashSet) VerifyFilesAreAvailableForCompositionDat
internal static (bool Succeeded, string BaseESD) LocateFilesForSetupMediaCreation(
string UUPPath,
string LanguageCode,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
ProgressCallback? progressCallback = null)
{
progressCallback?.Invoke(Common.Messaging.Common.ProcessPhase.ReadingMetadata, true, 0, "Looking up Composition Database in order to find a Base ESD image appropriate for building windows setup files.");
- HashSet filteredCompositionDatabases = CompositionDatabases.GetEditionCompDBsForLanguage(LanguageCode);
+ HashSet filteredCompositionDatabases = CompositionDatabases.GetEditionCompDBsForLanguage(LanguageCode);
if (filteredCompositionDatabases.Count > 0)
{
- foreach (CompDB? currentCompDB in filteredCompositionDatabases)
+ foreach (BaseManifest? currentCompDB in filteredCompositionDatabases)
{
foreach (Package feature in currentCompDB.Features.Feature[0].Packages.Package)
{
@@ -136,14 +136,14 @@ internal static bool GenerateAppXLicenseFiles(
string UUPPath,
string LanguageCode,
string EditionID,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
ProgressCallback? progressCallback = null)
{
bool success = true;
progressCallback?.Invoke(Common.Messaging.Common.ProcessPhase.ReadingMetadata, true, 0, "Enumerating files");
- CompDB? compDB = GetEditionCompDBForLanguage(CompositionDatabases, EditionID, LanguageCode);
+ BaseManifest? compDB = GetEditionCompDBForLanguage(CompositionDatabases, EditionID, LanguageCode);
if (compDB == null)
{
@@ -153,7 +153,7 @@ internal static bool GenerateAppXLicenseFiles(
if (CompositionDatabases.Any(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true)))
{
- IEnumerable AppCompDBs = CompositionDatabases.Where(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true));
+ IEnumerable AppCompDBs = CompositionDatabases.Where(x => x.Name?.StartsWith("Build~") == true && (x.Name?.EndsWith("~Desktop_Apps~~") == true || x.Name?.EndsWith("~Desktop_Apps_Moment~~") == true));
AppxSelectionEngine.GenerateLicenseXmlFiles(compDB, AppCompDBs, UUPPath);
}
@@ -170,17 +170,17 @@ internal static (bool Succeeded, string BaseESD, HashSet ReferencePackag
string UUPPath,
string LanguageCode,
string EditionID,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
ProgressCallback? progressCallback = null)
{
bool success = true;
- HashSet ReferencePackages = new();
- HashSet referencePackagesToConvert = new();
+ HashSet ReferencePackages = [];
+ HashSet referencePackagesToConvert = [];
string? BaseESD = null;
progressCallback?.Invoke(Common.Messaging.Common.ProcessPhase.ReadingMetadata, true, 0, "Enumerating files");
- CompDB? compDB = GetEditionCompDBForLanguage(CompositionDatabases, EditionID, LanguageCode);
+ BaseManifest? compDB = GetEditionCompDBForLanguage(CompositionDatabases, EditionID, LanguageCode);
if (compDB == null)
{
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/Installer/SetupMediaCreator.cs b/src/UnifiedUpdatePlatform.Media.Creator/Installer/SetupMediaCreator.cs
index a2284966..4a605e79 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/Installer/SetupMediaCreator.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/Installer/SetupMediaCreator.cs
@@ -35,7 +35,7 @@ public static bool CreateSetupMedia(
string OutputMediaPath,
string OutputWindowsREPath,
Common.Messaging.Common.CompressionType CompressionType,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
TempManager tempManager,
ProgressCallback progressCallback = null)
{
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/Installer/WindowsInstallerBuilder.cs b/src/UnifiedUpdatePlatform.Media.Creator/Installer/WindowsInstallerBuilder.cs
index 3527e7da..bc2146f7 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/Installer/WindowsInstallerBuilder.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/Installer/WindowsInstallerBuilder.cs
@@ -282,11 +282,11 @@ private static bool IntegrateSetupFilesIntoImage(
string winpejpgtmp = tempManager.GetTempPath();
File.WriteAllBytes(winpejpgtmp, Constants.winpejpg);
- List<(string fileToAdd, string destination)> updateDirectives = new()
- {
+ List<(string fileToAdd, string destination)> updateDirectives =
+ [
(bgfile, Path.Combine("Windows", "System32", "setup.bmp")),
(winpejpgtmp, Path.Combine("Windows", "System32", "winpe.jpg"))
- };
+ ];
progressCallback?.Log("Backporting missing files");
@@ -383,10 +383,10 @@ private static bool PreparePEImage(
string peshellini = Path.Combine(sys32, "winpeshl.ini");
progressCallback?.Log("Preparing PE for cleanup");
- List<(string fileToAdd, string destination)> updateDirectives = new()
- {
+ List<(string fileToAdd, string destination)> updateDirectives =
+ [
(null, peshellini)
- };
+ ];
//
// Cleanup log file from RE conversion phase mentions
@@ -403,7 +403,7 @@ private static bool PreparePEImage(
string[] lines = File.ReadAllLines(logfile);
int bootsessioncount = 0;
- List finallines = new();
+ List finallines = [];
foreach (string line in lines)
{
if (line.StartsWith("[Boot Session: ", StringComparison.InvariantCultureIgnoreCase))
diff --git a/src/UnifiedUpdatePlatform.Media.Creator/MediaCreator.cs b/src/UnifiedUpdatePlatform.Media.Creator/MediaCreator.cs
index 566b366e..1495b8ea 100644
--- a/src/UnifiedUpdatePlatform.Media.Creator/MediaCreator.cs
+++ b/src/UnifiedUpdatePlatform.Media.Creator/MediaCreator.cs
@@ -48,7 +48,7 @@ private static bool HandleEditionPlan(
string InstallWIMFilePath,
string WinREWIMFilePath,
Common.Messaging.Common.CompressionType CompressionType,
- IEnumerable CompositionDatabases,
+ IEnumerable CompositionDatabases,
TempManager tempManager,
string VHDMountPath = null,
string CurrentBackupVHD = null,
@@ -285,7 +285,7 @@ void callback(string Operation, int ProgressPercentage, bool IsIndeterminate)
public static bool GetTargetedPlan(
string UUPPath,
string LanguageCode,
- List CompositionDatabases,
+ List CompositionDatabases,
out List EditionTargets,
TempManager tempManager,
ProgressCallback progressCallback = null)
@@ -297,7 +297,7 @@ public static bool GetTargetedPlan(
//
// Get base editions that are available with all their files
//
- IEnumerable filteredCompositionDatabases = CompositionDatabases.GetEditionCompDBsForLanguage(LanguageCode).Where(x =>
+ IEnumerable filteredCompositionDatabases = CompositionDatabases.GetEditionCompDBsForLanguage(LanguageCode).Where(x =>
{
(bool success, HashSet missingfiles) = Planning.FileLocator.VerifyFilesAreAvailableForCompDB(x, UUPPath);
return success;
@@ -388,7 +388,7 @@ public static void CreateISOMedia(
try
{
- List CompositionDatabases = Planning.FileLocator.GetCompDBsFromUUPFiles(UUPPath, tempManager);
+ List CompositionDatabases = Planning.FileLocator.GetCompDBsFromUUPFiles(UUPPath, tempManager);
result = GetTargetedPlan(UUPPath, LanguageCode, CompositionDatabases, out List editionTargets, tempManager, progressCallback);
if (!result)
diff --git a/src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads/DownloadHelpers.cs b/src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads/DownloadHelpers.cs
index f4941af0..f051e80b 100644
--- a/src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads/DownloadHelpers.cs
+++ b/src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads/DownloadHelpers.cs
@@ -29,28 +29,96 @@
using UnifiedUpdatePlatform.Services.Composition.Database;
using UnifiedUpdatePlatform.Services.Composition.Database.Applications;
using UnifiedUpdatePlatform.Services.WindowsUpdate;
+using UnifiedUpdatePlatform.Services.WindowsUpdate.Targeting;
namespace UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads
{
public static partial class UpdateUtils
{
- public static string[] GetFilenameForCEUIFile(CExtendedUpdateInfoXml.File file2, IEnumerable payloadItems)
+ public static string[] GetFilenameForCEUIFile(Models.FE3.XML.ExtendedUpdateInfo.File extendedUpdateInfoFile, IEnumerable payloadItems)
{
- string filename = file2.FileName.Replace('\\', Path.DirectorySeparatorChar);
- if (payloadItems.Any(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest))
+ string filename = extendedUpdateInfoFile.FileName.Replace('\\', Path.DirectorySeparatorChar);
+
+ if (payloadItems.Any(x => x.PayloadHash == extendedUpdateInfoFile.AdditionalDigest.Text || x.PayloadHash == extendedUpdateInfoFile.Digest))
{
- IEnumerable payloads = payloadItems.Where(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest);
- return payloads.Select(p => p.Path.Replace('\\', Path.DirectorySeparatorChar)).ToArray();
+ IEnumerable payloads = payloadItems.Where(x => x.PayloadHash == extendedUpdateInfoFile.AdditionalDigest.Text || x.PayloadHash == extendedUpdateInfoFile.Digest);
+ return payloads.Select(p => p.Path.Replace('\\', Path.DirectorySeparatorChar)).DistinctBy(x => x.ToLower()).ToArray();
}
else if (!payloadItems.Any() && filename.Contains('_') && !filename.StartsWith("_") && (!filename.Contains('-') || filename.IndexOf('-') > filename.IndexOf('_')))
{
filename = filename[..filename.IndexOf('_')] + Path.DirectorySeparatorChar + filename[(filename.IndexOf('_') + 1)..];
- return new string[] { filename.TrimStart(Path.DirectorySeparatorChar) };
+ return [filename.TrimStart(Path.DirectorySeparatorChar)];
+ }
+
+ return [filename];
+ }
+
+ public static string FixFilePath((Models.FE3.XML.ExtendedUpdateInfo.File, FileExchangeV3FileDownloadInformation) boundFile, HashSet pathList, HashSet compDBs, string path)
+ {
+ string newPath = path;
+
+ MatchCollection guidMatches = guidRegex().Matches(newPath);
+
+ // Some file packages (especially for device manifests) contain guids as part of their name and often the actual name of the file after, so trim that right away
+ foreach (Match match in guidMatches.OrderByDescending(x => x.Index + x.Length))
+ {
+ newPath = string.Concat(newPath.AsSpan(0, match.Index), newPath.AsSpan(match.Index + match.Length));
+ }
+
+ // It is possible that above operation caused the file to go empty, check for that and if thats the case, revert now.
+ if (newPath != path && (string.IsNullOrEmpty(newPath) || newPath.StartsWith('.')))
+ {
+ newPath = path;
+ }
+
+ try
+ {
+ foreach (BaseManifest compDb in compDBs)
+ {
+ foreach (Package pkg in compDb.Packages.Package)
+ {
+ string payloadHash = pkg.Payload.PayloadItem[0].PayloadHash;
+ if (payloadHash == boundFile.Item1.AdditionalDigest.Text || payloadHash == boundFile.Item1.Digest)
+ {
+ if (pkg.ID.Contains('-') && pkg.ID.Contains(".inf", StringComparison.InvariantCultureIgnoreCase))
+ {
+ newPath = pkg.ID.Split("-")[1].Replace(".inf", ".cab", StringComparison.InvariantCultureIgnoreCase);
+ }
+ break;
+ }
+ }
+ }
+ }
+ catch { }
+
+ if (!pathList.Add(newPath.ToLower()))
+ {
+ string basePath, suffix;
+
+ if (Path.HasExtension(newPath))
+ {
+ basePath = Path.Combine(Path.GetDirectoryName(newPath), Path.GetFileNameWithoutExtension(newPath));
+ suffix = Path.GetExtension(newPath);
+ }
+ else
+ {
+ basePath = Path.Combine(Path.GetDirectoryName(newPath), Path.GetFileName(newPath));
+ suffix = "";
+ }
+
+ uint i = 1;
+
+ do
+ {
+ newPath = $"{basePath} ({i++}){suffix}";
+ }
+ while (!pathList.Add(newPath.ToLower()));
}
- return new string[] { filename };
+
+ return newPath;
}
- public static bool ShouldFileGetDownloaded(CExtendedUpdateInfoXml.File file2, IEnumerable payloadItems)
+ public static bool ShouldFileGetDownloaded(Models.FE3.XML.ExtendedUpdateInfo.File file2, IEnumerable payloadItems)
{
string filename = file2.FileName.Replace('\\', Path.DirectorySeparatorChar);
if (payloadItems.Any(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest))
@@ -77,24 +145,24 @@ public static UpdateData TrimDeltasFromUpdateData(UpdateData update)
return update;
}
- private static bool IsFileBanned(CExtendedUpdateInfoXml.File file2, IEnumerable bannedItems)
+ private static bool IsFileBanned(Models.FE3.XML.ExtendedUpdateInfo.File file2, IEnumerable bannedItems)
{
return bannedItems.Any(x => x.PayloadHash == file2.AdditionalDigest.Text || x.PayloadHash == file2.Digest);
}
private static
(
- HashSet