public void FindInfInfo(string infName, out string originalInfName, out string driverFolderLocation, out long estimateSize) { originalInfName = "[Unknown]"; driverFolderLocation = string.Empty; estimateSize = -1; try { string content = GetSystemRootInfContent(infName); if (!string.IsNullOrEmpty(content)) { DriverStoreContent driverStoreContent = this.FindInfInfo(content); if (driverStoreContent != null) { originalInfName = driverStoreContent.InfName; driverFolderLocation = driverStoreContent.FolderPath; estimateSize = driverStoreContent.EstimateSize; } } } catch (UnauthorizedAccessException) { // Ignore this entry if we don't have access to it. } }
private DriverStoreContent FindInfInfo(string content) { for (int i = 0; i < this.driverStoreContents.Count; i++) { if (this.driverStoreContents[i].Content == content) { DriverStoreContent driverStoreContent = this.driverStoreContents[i]; this.driverStoreContents.RemoveAt(i); return(driverStoreContent); } } while (this.directoryInfoEnumerator.MoveNext()) { var item = this.directoryInfoEnumerator.Current; Match match = DriverStoreRepositoryDirNameRegex.Match(item.Name); if (match.Success) { string infName = match.Groups[1].Value; string infPath = Path.Combine(item.FullName, infName); if (File.Exists(infPath)) { try { string infContent = File.ReadAllText(infPath); long estimateSize = GetFolderSize(item); DriverStoreContent driverStoreContent = new DriverStoreContent() { InfName = infName, FolderPath = item.FullName, Content = infContent, EstimateSize = estimateSize }; if (infContent == content) { return(driverStoreContent); } else { this.driverStoreContents.Add(driverStoreContent); } } catch (UnauthorizedAccessException) { // Ignore this entry if we don't have access to it. } } } } return(null); }
public void FindInfInfo(string infName, out string originalInfName, out long estimateSize) { originalInfName = null; estimateSize = -1; string content = GetSystemRootInfContent(infName); if (!string.IsNullOrEmpty(content)) { DriverStoreContent driverStoreContent = FindInfInfo(content); if (driverStoreContent != null) { originalInfName = driverStoreContent.InfName; estimateSize = driverStoreContent.EstimateSize; } } }