comparison jet-symbols/src/JetBrains.CommandLine.Symbols/DumpBinaryFileSignCommand.cs @ 102:0e927b14ccf1

restored jet-symbols native tool sources
author Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
date Mon, 16 May 2016 19:40:51 +0300
parents
children
comparison
equal deleted inserted replaced
101:52fc27842bc1 102:0e927b14ccf1
1 // Decompiled with JetBrains decompiler
2 // Type: JetBrains.CommandLine.Symbols.DumpBinaryFileSignCommand
3 // Assembly: JetBrains.CommandLine.Symbols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325
4 // MVID: EF046BF6-60AC-48EA-9121-8AF3D8D08853
5 // Assembly location: C:\Data\Work\TeamCity\misc\tc-symbol-server\tools\JetSymbols\JetBrains.CommandLine.Symbols.exe
6
7 using JetBrains.Metadata.Utils;
8 using JetBrains.Metadata.Utils.PE;
9 using JetBrains.Util;
10 using System;
11 using System.Collections.Generic;
12 using System.IO;
13
14 namespace JetBrains.CommandLine.Symbols
15 {
16 public class DumpBinaryFileSignCommand : DumpFilesSignCommandBase
17 {
18 public const string CMD_NAME = "dumpBinSign";
19
20 public DumpBinaryFileSignCommand(FileSystemPath outputFilePath, IEnumerable<FileSystemPath> targetFilePaths)
21 : base(outputFilePath, targetFilePaths)
22 {
23 }
24
25 protected override string GetFileSignature(FileSystemPath targetFilePath)
26 {
27 try
28 {
29 using (Stream stream = targetFilePath.OpenFileForReading())
30 {
31 PEFile peFile = new PEFile((IBinaryReader) new StreamBinaryReader(stream));
32 return string.Format("{0:X}{1:X}", (object) peFile.COFFheader.TimeStamp, (object) peFile.NTHeader.ImageSize);
33 }
34 }
35 catch (Exception ex)
36 {
37 Console.Error.WriteLine(ex.Message);
38 return (string) null;
39 }
40 }
41 }
42 }