Пример #1
0
        protected override string GetFileSignature(FileSystemPath targetFilePath)
        {
            if (!targetFilePath.ExistsFile)
            {
                Console.Error.WriteLine("PDB file does not exists " + targetFilePath);
                return(null);
            }

            if (targetFilePath.GetFileLength() == 0)
            {
                Console.Error.WriteLine("Empty PDB file " + targetFilePath);
                return(null);
            }

            if (PdbUtils.GetPdbType(targetFilePath) == DebugInfoType.Windows)
            {
                using (var pdbStream = targetFilePath.OpenFileForReading())
                {
                    var pdbFile    = new WindowsPdbFile(pdbStream);
                    var dbiStream  = pdbFile.GetDbiStream();
                    var ageFromDbi = 1;
                    if (dbiStream.Length > 0)
                    {
                        var binaryStream = new StreamBinaryReader(dbiStream);
                        var dbiHeader    = new DbiHeader(binaryStream);
                        ageFromDbi = dbiHeader.PdbAge;
                    }
                    var root      = pdbFile.GetRoot();
                    var signature = root.PdbSignature;
                    return(string.Format("{0}{1:X}", signature.ToString("N").ToUpperInvariant(), ageFromDbi));
                }
            }

            var debugInfo = PdbUtils.TryGetPdbDebugInfo(targetFilePath);

            if (debugInfo == null)
            {
                Console.Error.WriteLine("Unsupport PDB file " + targetFilePath);
                return(null);
            }

            return(string.Format("{0}{1:X}", debugInfo.Signature.ToString("N").ToUpperInvariant(), debugInfo.AgeOrTimestamp));
        }
Пример #2
0
        protected override string GetFileSignature(FileSystemPath targetFilePath)
        {
            if (!targetFilePath.ExistsFile)
            {
                Console.Error.WriteLine("PDB file does not exists " + targetFilePath);
                return(null);
            }

            if (targetFilePath.GetFileLength() == 0)
            {
                Console.Error.WriteLine("Empty PDB file " + targetFilePath);
                return(null);
            }

            var debugInfo = PdbUtils.TryGetPdbDebugInfo(targetFilePath);

            if (debugInfo == null)
            {
                Console.Error.WriteLine("Unsupport PDB file " + targetFilePath);
                return(null);
            }

            return(string.Format("{0}{1:X}", debugInfo.Signature.ToString("N").ToUpperInvariant(), debugInfo.AgeOrTimestamp));
        }