Add BITS transfer priority configuration support

Introduces a new parameter to control BITS download priority across the build system and UI, allowing users to optimize transfer speeds when needed.

The feature adds a priority selector to the UI with four options (Foreground, High, Normal, Low) and propagates the selection through the build script and common modules. Priority can be set via UI, command-line parameter, or environment variable, with Normal as the default.

Updates the BITS transfer retry logic to respect the configured priority instead of hardcoding Normal priority, and fixes minor code formatting inconsistencies.
This commit is contained in:
rbalsleyMSFT
2025-11-21 14:04:52 -08:00
parent e67590d0a1
commit 8229aa73fe
9 changed files with 121 additions and 23 deletions
+29 -13
View File
@@ -641,7 +641,7 @@
<TabItem Header="Build" Padding="20">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Margin="10">
<!-- Define 10 rows for the Build tab -->
<!-- Define 12 rows for the Build tab -->
<Grid.RowDefinitions>
<!-- Row 0: Header -->
<RowDefinition Height="Auto"/>
@@ -657,13 +657,15 @@
<RowDefinition Height="Auto"/>
<!-- Row 6: Threads -->
<RowDefinition Height="Auto"/>
<!-- Row 7: General Build Options Header -->
<!-- Row 7: BITS Priority -->
<RowDefinition Height="Auto"/>
<!-- Row 8: General Build Options Checkboxes -->
<!-- Row 8: General Build Options Header -->
<RowDefinition Height="Auto"/>
<!-- Row 9: Build USB Drive Section -->
<!-- Row 9: General Build Options Checkboxes -->
<RowDefinition Height="Auto"/>
<!-- Row 10: Post-Build Cleanup -->
<!-- Row 10: Build USB Drive Section -->
<RowDefinition Height="Auto"/>
<!-- Row 11: Post-Build Cleanup -->
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -729,11 +731,25 @@
<TextBlock Grid.Column="0" Text="Threads" VerticalAlignment="Center" ToolTip="Controls the number of parallel threads used by ForEach-Object -Parallel and sets the value of the -ThrottleLimit parameter. Default is 5. Used in Winget, Application Copy, and driver downloads"/>
<TextBox x:Name="txtThreads" Grid.Column="1" Margin="5" VerticalAlignment="Center" Width="50" HorizontalAlignment="Left" Text="5" ToolTip="Controls the number of parallel threads used by ForEach-Object -Parallel and sets the value of the -ThrottleLimit parameter. Default is 5. Used in Winget, Application Copy, and driver downloads"/>
</Grid>
<!-- Row 7: General Build Options Header -->
<TextBlock Grid.Row="7" Text="General Build Options" FontWeight="Bold" FontSize="16" Margin="0,10,0,5"/>
<!-- Row 7: BITS Priority -->
<Grid Grid.Row="7" Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="BITS Priority" VerticalAlignment="Center" ToolTip="Controls the BITS download priority used by the UI and BuildFFUVM.ps1. Switch to Foreground to maximize download speed if needed."/>
<ComboBox x:Name="cmbBitsPriority" Grid.Column="1" Margin="5" VerticalAlignment="Center" Width="150" HorizontalAlignment="Left" ToolTip="Controls the BITS download priority used by the UI and BuildFFUVM.ps1. Switch to Foreground to maximize download speed if needed.">
<sys:String>Foreground</sys:String>
<sys:String>High</sys:String>
<sys:String>Normal</sys:String>
<sys:String>Low</sys:String>
</ComboBox>
</Grid>
<!-- Row 8: General Build Options Header -->
<TextBlock Grid.Row="8" Text="General Build Options" FontWeight="Bold" FontSize="16" Margin="0,10,0,5"/>
<!-- Row 8: General Build Options Checkboxes -->
<WrapPanel Grid.Row="8" Margin="0,5">
<!-- Row 9: General Build Options Checkboxes -->
<WrapPanel Grid.Row="9" Margin="0,5">
<CheckBox x:Name="chkBuildUSBDriveEnable" Content="Build USB Drive" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will partition and format a USB drive and copy the captured FFU to the drive."/>
<CheckBox x:Name="chkCompactOS" Content="Compact OS" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will compact the OS when building the FFU."/>
<CheckBox x:Name="chkUpdateADK" Content="Update ADK" Margin="5" VerticalAlignment="Center" Tag="When set to $true, the script will check for and install/update to the latest Windows ADK and WinPE add-on."/>
@@ -745,8 +761,8 @@
<CheckBox x:Name="chkVerbose" Content="Verbose" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will enable write-verbose output to the console for the build script."/>
</WrapPanel>
<!-- Row 9: Build USB Drive Section -->
<StackPanel Grid.Row="9" Margin="0,10,0,5" x:Name="usbDriveSection" Visibility="Collapsed">
<!-- Row 10: Build USB Drive Section -->
<StackPanel Grid.Row="10" Margin="0,10,0,5" x:Name="usbDriveSection" Visibility="Collapsed">
<TextBlock Text="Build USB Drive Settings" FontWeight="Bold" FontSize="16" Margin="0,0,0,10"/>
<StackPanel Margin="5,0,0,10">
<CheckBox x:Name="chkAllowExternalHardDiskMedia" Content="Allow External Hard Disk Media" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will allow the use of external hard disk media."/>
@@ -811,8 +827,8 @@
</StackPanel>
</StackPanel>
<!-- Row 10: Post-Build Cleanup -->
<StackPanel Grid.Row="10" Margin="0,10,0,5">
<!-- Row 11: Post-Build Cleanup -->
<StackPanel Grid.Row="11" Margin="0,10,0,5">
<TextBlock Text="Post-Build Cleanup" FontWeight="Bold" FontSize="16" Margin="0,0,0,5"/>
<CheckBox x:Name="chkCleanupAppsISO" Content="Cleanup Apps ISO" Margin="5" VerticalAlignment="Center" Tag="Remove Apps ISO after FFU capture."/>
<CheckBox x:Name="chkCleanupCaptureISO" Content="Cleanup Capture ISO" Margin="5" VerticalAlignment="Center" Tag="Remove WinPE capture ISO after FFU capture."/>