ConfigMethods
public static class ConfigMethods
1. Methods
1.1. CheckConnectivity(ISystemHost, AbsolutePath, ILogger)
Checks network connectivity, attempting driver installation and WiFi if needed. Returns the final online status.
public static bool CheckConnectivity(ISystemHost host, AbsolutePath netsetupRoot, ILogger logger)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
The system host. |
netsetupRoot |
AbsolutePath |
The NETSetup root path. |
logger |
ILogger |
The logger instance. |
Returns: bool — True if the machine is online after all attempts.
1.2. DownloadMapFileAndConfig(ISystemHost, IFileOperator, IFileProvider, string)
public static void DownloadMapFileAndConfig(ISystemHost host, IFileOperator configs, IFileProvider remoteSource, string mapFile)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
|
configs |
IFileOperator |
|
remoteSource |
IFileProvider |
|
mapFile |
string |
1.3. EnsureVmConfigPartition(ISystemHost, ILogger)
Ensures a temporary NETSetup partition exists on the VM’s largest fixed disk. Only acts when running in WinPE on a virtual machine that has no USB drives attached. Creates a 40GB GPT partition named "NETSetup" mounted at Z: so 7z image extraction (Windows .7z + drivers) has enough scratch room in WinPE.
public static void EnsureVmConfigPartition(ISystemHost host, ILogger logger)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
The system host. |
logger |
ILogger |
The logger instance. |
1.4. FetchConfigOnline(ISystemHost, IServiceProvider, IFileOperator)
public static (bool HasSingleMatchingMapFile, string MapFile, string ConfigName) FetchConfigOnline(ISystemHost host, IServiceProvider serviceProvider, IFileOperator netsetupRootFileOp)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
|
serviceProvider |
IServiceProvider |
|
netsetupRootFileOp |
IFileOperator |
Returns: (bool HasSingleMatchingMapFile, string MapFile, string ConfigName)
1.5. FindConfigNameFromMapFile(string, bool, ILogger)
Extracts the config name from a map file path when a single matching map file exists. Splits the map file by '', takes the last segment, removes the ".map" suffix, and returns the config name as "{ticketNumber}.json".
public static string FindConfigNameFromMapFile(string mapFile, bool hasSingleMapFile, ILogger logger)
| Name | Type | Description |
|---|---|---|
mapFile |
string |
The map file path (e.g. "SN123#12345.map"). |
hasSingleMapFile |
bool |
Whether exactly one matching map file was found. |
logger |
ILogger |
The logger instance. |
Returns: string — The config name (e.g. "#12345.json"), or null if no matching map file.
1.6. GetConfig(ISystemHost, IServiceProvider, string, string)
public static NETSetupConfig GetConfig(ISystemHost host, IServiceProvider serviceProvider, string ticket = null, string hostname = null)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
|
serviceProvider |
IServiceProvider |
|
ticket |
string |
|
hostname |
string |
Returns: NETSetupConfig
1.7. ModifyConfigGetConfigName(ISystemHost, string, string, JsonSerializerOptions)
public static string ModifyConfigGetConfigName(ISystemHost host, string ticket, string hostname, JsonSerializerOptions jsonOptions)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
|
ticket |
string |
|
hostname |
string |
|
jsonOptions |
JsonSerializerOptions |
Returns: string
1.8. ReadAndParseConfig(ISystemHost, AbsolutePath, string, ILogger, JsonSerializerOptions)
Reads and parses a NETSetup config JSON file from the config directory. Falls back to Z:/Config/ for VMs without USB when the primary path fails.
public static NETSetupConfig ReadAndParseConfig(ISystemHost host, AbsolutePath netsetupRoot, string configName, ILogger logger, JsonSerializerOptions jsonOptions)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
The system host. |
netsetupRoot |
AbsolutePath |
The NETSetup root path. |
configName |
string |
The config file name to read. |
logger |
ILogger |
The logger instance. |
jsonOptions |
JsonSerializerOptions |
JSON serializer options for deserialization. |
Returns: NETSetupConfig — The parsed NETSetup config.
1.9. ResolveConfigNameFallback(ISystemHost, IServiceProvider, IFileOperator, bool, string, string, JsonSerializerOptions)
Resolves the config name using various fallback strategies when no map file match was found. For VMs without USB, falls back to #VirtualMachines.json if it exists. For online machines, copies configs from remote source and allows user selection.
public static (string configName, string hostname) ResolveConfigNameFallback(ISystemHost host, IServiceProvider serviceProvider, IFileOperator netsetupRootFileOp, bool online, string ticket, string hostname, JsonSerializerOptions jsonOptions)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
The system host. |
serviceProvider |
IServiceProvider |
The service provider for resolving remote sources. |
netsetupRootFileOp |
IFileOperator |
File operator for the NETSetup root directory. |
online |
bool |
Whether the machine is currently online. |
ticket |
string |
Optional ticket number from CLI. |
hostname |
string |
Optional hostname from CLI. |
jsonOptions |
JsonSerializerOptions |
JSON serializer options. |
Returns: (string configName, string hostname) — The resolved config file name.