Exemplo n.º 1
0
 /// <summary>
 /// Compares <see cref="Debugger.WireProtocol.Commands.DebuggingResolveAssembly.Version"/> and <see cref="System.Version"/> values.
 /// </summary>
 /// <param name="pane"></param>
 /// <param name="pszOutputString">Version value to compare to.</param>
 public static bool Equals(this Tools.Debugger.WireProtocol.Commands.DebuggingResolveAssembly.Version version, Version value)
 {
     return(version.MajorVersion == value.Major &&
            version.MinorVersion == value.Minor &&
            version.BuildNumber == value.Build &&
            version.RevisionNumber == value.Revision);
 }
            private static PdbxFile TryPdbxFile(string path, Tools.Debugger.WireProtocol.Commands.DebuggingResolveAssembly.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.MajorVersion && version2.Minor == version.MinorVersion)
                        {
                            file.Initialize(path);
                            return(file);
                        }
                    }
                }
                catch
                {
                }

                return(null);
            }
            private static PdbxFile Open(string name, Tools.Debugger.WireProtocol.Commands.DebuggingResolveAssembly.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, @"..\pe\be");

                            if (file == null)
                            {
                                file = OpenHelper(name, version, assemblyDirectories, @"be");
                            }
                        }
                        else
                        {
                            file = OpenHelper(name, version, assemblyDirectories, @"..\pe\le");

                            if (file == null)
                            {
                                file = OpenHelper(name, version, assemblyDirectories, @"le");
                            }
                        }
                    }
                }

                //Try other paths here...
                return(file);
            }
            private static PdbxFile OpenHelper(string name, Tools.Debugger.WireProtocol.Commands.DebuggingResolveAssembly.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, Tools.Debugger.WireProtocol.Commands.DebuggingResolveAssembly.Version version, bool fIsTargetBigEndian)
                {
                    PdbxFile file = PdbxFile.Open(name, version, _assemblyPaths, _assemblyDirectories, fIsTargetBigEndian);

                    return(file);
                }