public static bool DoesVolumeHaveBadBlocks(string volumeId, out string mountPoint, out Exception ex, out string eventXML) { bool flag = false; mountPoint = null; eventXML = null; Dictionary <string, string> mountPointVolumeIDMappings = BitlockerUtil.GetMountPointVolumeIDMappings(out ex); if (mountPointVolumeIDMappings == null) { ex = new MountPointsFindException(ex.Message, ex); return(false); } if (!mountPointVolumeIDMappings.ContainsValue(volumeId)) { ex = new InvalidVolumeIdException(volumeId); return(false); } foreach (string text in mountPointVolumeIDMappings.Keys) { if (mountPointVolumeIDMappings[text].Equals(volumeId)) { flag = BitlockerUtil.DoesMountPointHaveBadBlocks(text, out ex, out eventXML); if (flag) { mountPoint = text; break; } } } return(flag); }
public static bool IsFilePathOnLockedVolume(string filePath, out Exception ex) { ex = null; List <string> lockedVolumes = BitlockerLockUtil.GetLockedVolumes(out ex); if (ex != null) { ex = new LockedVolumesFindException(ex.Message, ex); return(false); } if (lockedVolumes == null || lockedVolumes.Count == 0) { return(false); } Dictionary <string, string> mountPointVolumeIDMappings = BitlockerUtil.GetMountPointVolumeIDMappings(out ex); if (mountPointVolumeIDMappings == null) { ex = new MountPointsFindException(ex.Message, ex); return(false); } bool flag = false; foreach (string text in mountPointVolumeIDMappings.Keys) { if (filePath.StartsWith(text)) { flag = true; if (lockedVolumes.Contains(mountPointVolumeIDMappings[text])) { return(true); } } } if (!flag) { ex = new InvalidFilePathException(filePath); } return(false); }