private void SetVariables(WimMetadataViewModel wimMetadataViewModel) { if (wimMetadataViewModel is null) { Requirements[Requirement.WimFile] = null; Requirements[Requirement.WimImageIndex] = null; return; } Requirements[Requirement.WimFile] = wimMetadataViewModel.Path; Requirements[Requirement.WimImageIndex] = wimMetadataViewModel.SelectedDiskImage.Index; }
private static WimMetadataViewModel LoadWimMetadata(string path) { Log.Verbose("Trying to load WIM metadata file at '{ImagePath}'", path); using (var file = File.OpenRead(path)) { var imageReader = new WindowsImageMetadataReader(); var windowsImageInfo = imageReader.Load(file); if (windowsImageInfo.Images.All(x => x.Architecture != Architecture.Arm64)) { throw new InvalidWimFileException(Resources.WimFileNoValidArchitecture); } var vm = new WimMetadataViewModel(windowsImageInfo, path); Log.Verbose("WIM metadata file at '{ImagePath}' retrieved correctly", path); return(vm); } }