view jet-symbols/src/JetBrains.CommandLine.Symbols/DumpBinaryFileSignCommand.cs @ 117:d2c79f95c2a6 tip

remove tailing slash in teamcity server url when constructing symbol server url
author Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
date Fri, 27 May 2016 15:27:30 +0300
parents 0e927b14ccf1
children
line wrap: on
line source
// Decompiled with JetBrains decompiler
// Type: JetBrains.CommandLine.Symbols.DumpBinaryFileSignCommand
// Assembly: JetBrains.CommandLine.Symbols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325
// MVID: EF046BF6-60AC-48EA-9121-8AF3D8D08853
// Assembly location: C:\Data\Work\TeamCity\misc\tc-symbol-server\tools\JetSymbols\JetBrains.CommandLine.Symbols.exe

using JetBrains.Metadata.Utils;
using JetBrains.Metadata.Utils.PE;
using JetBrains.Util;
using System;
using System.Collections.Generic;
using System.IO;

namespace JetBrains.CommandLine.Symbols
{
  public class DumpBinaryFileSignCommand : DumpFilesSignCommandBase
  {
    public const string CMD_NAME = "dumpBinSign";

    public DumpBinaryFileSignCommand(FileSystemPath outputFilePath, IEnumerable<FileSystemPath> targetFilePaths)
      : base(outputFilePath, targetFilePaths)
    {
    }

    protected override string GetFileSignature(FileSystemPath targetFilePath)
    {
      try
      {
        using (Stream stream = targetFilePath.OpenFileForReading())
        {
          PEFile peFile = new PEFile((IBinaryReader) new StreamBinaryReader(stream));
          return string.Format("{0:X}{1:X}", (object) peFile.COFFheader.TimeStamp, (object) peFile.NTHeader.ImageSize);
        }
      }
      catch (Exception ex)
      {
        Console.Error.WriteLine(ex.Message);
        return (string) null;
      }
    }
  }
}