private static PdbxFile TryPdbxFile(string path, WireProtocol.Commands.Debugging_Resolve_Assembly.Version version) { try { path += ".pdbx"; if (File.Exists(path)) { XmlSerializer xmls = new Serialization.PdbxFile.PdbxFileSerializer(); PdbxFile file = (PdbxFile)Utility.XmlDeserialize(path, xmls); //Check version Assembly.VersionStruct version2 = file.Assembly.Version; if (version2.Major == version.iMajorVersion && version2.Minor == version.iMinorVersion) { file.Initialize(path); return(file); } } } catch { } return(null); }
private static PdbxFile Open(string name, WireProtocol.Commands.Debugging_Resolve_Assembly.Version version, string[] assemblyPaths, string[] assemblyDirectories, bool fIsTargetBigEndian) { PdbxFile file = null; if (assemblyPaths != null) { for (int iPath = 0; iPath < assemblyPaths.Length; iPath++) { string path = assemblyPaths[iPath]; string pathNoExt = Path.ChangeExtension(path, null); if (0 == string.Compare(name, Path.GetFileName(pathNoExt), true)) { if ((file = TryPdbxFile(pathNoExt, version)) != null) { break; } } } } if (file == null && assemblyDirectories != null) { file = OpenHelper(name, version, assemblyDirectories, null); if (file == null) { if (fIsTargetBigEndian) { file = OpenHelper(name, version, assemblyDirectories, Path.Combine("..", "pe", "be")); if (file == null) { file = OpenHelper(name, version, assemblyDirectories, @"be"); } } else { file = OpenHelper(name, version, assemblyDirectories, Path.Combine("..", "pe", "le")); if (file == null) { file = OpenHelper(name, version, assemblyDirectories, @"le"); } } } } //Try other paths here... return(file); }
private static PdbxFile OpenHelper(string name, WireProtocol.Commands.Debugging_Resolve_Assembly.Version version, string[] assemblyDirectories, string directorySuffix) { PdbxFile file = null; for (int iDirectory = 0; iDirectory < assemblyDirectories.Length; iDirectory++) { string directory = assemblyDirectories[iDirectory]; if (!string.IsNullOrEmpty(directorySuffix)) { directory = Path.Combine(directory, directorySuffix); } string pathNoExt = Path.Combine(directory, name); if ((file = TryPdbxFile(pathNoExt, version)) != null) { break; } } return(file); }
public PdbxFile Resolve(string name, WireProtocol.Commands.Debugging_Resolve_Assembly.Version version, bool fIsTargetBigEndian) { PdbxFile file = PdbxFile.Open(name, version, _assemblyPaths, _assemblyDirectories, fIsTargetBigEndian); return(file); }