public static IList<PotentialFile> FindFiles(NVidiaService service, string deviceToPatch) { var result = new List<PotentialFile>(); var deviceToReplace = long.Parse(deviceToPatch, System.Globalization.NumberStyles.HexNumber); var patternToLocate = BitConverter.GetBytes(deviceToReplace); if (service.ImagePath != null) { foreach (var file in Directory.GetFiles(service.ImagePath)) { var filePatcher = new FilePatcher(file, patternToLocate); if (filePatcher.Count != 2) { continue; } var potentialFile = new PotentialFile { Patcher = filePatcher, }; result.Add(potentialFile); } } return result; }
public static IList <PotentialFile> FindFiles(NVidiaService service, string deviceToPatch) { var result = new List <PotentialFile>(); var deviceToReplace = long.Parse(deviceToPatch, System.Globalization.NumberStyles.HexNumber); var patternToLocate = BitConverter.GetBytes(deviceToReplace); if (service.ImagePath != null) { foreach (var file in Directory.GetFiles(service.ImagePath)) { var filePatcher = new FilePatcher(file, patternToLocate); if (filePatcher.Count != 2) { continue; } var potentialFile = new PotentialFile { Patcher = filePatcher, }; result.Add(potentialFile); } } return(result); }
public MainWindow() { InitializeComponent(); DataContext = this; Task.Factory.StartNew( () => PotentialFile.FindFiles(Service, DeviceToPatch).ToList().ForEach(x => PotentialFiles.Add(x)), default(CancellationToken), TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext() ); Closed += (sender, args) => Service.Dispose(); }