annotate jet-symbols/src/JetBrains.CommandLine.Symbols/Program.cs @ 103:9ff982a9213e

report full pdb file path instead of file name when collecting pdb signatures
author Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
date Mon, 16 May 2016 19:43:39 +0300
parents 0e927b14ccf1
children
rev   line source
102
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
1 // Decompiled with JetBrains decompiler
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
2 // Type: JetBrains.CommandLine.Symbols.Program
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
3 // Assembly: JetBrains.CommandLine.Symbols, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
4 // MVID: EF046BF6-60AC-48EA-9121-8AF3D8D08853
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
5 // Assembly location: C:\Data\Work\TeamCity\misc\tc-symbol-server\tools\JetSymbols\JetBrains.CommandLine.Symbols.exe
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
6
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
7 using JetBrains.Util;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
8 using System;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
9 using System.Collections.Generic;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
10 using System.IO;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
11 using System.Linq;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
12 using System.Text;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
13
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
14 namespace JetBrains.CommandLine.Symbols
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
15 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
16 internal static class Program
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
17 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
18 private const int ERROR_EXIT_CODE = 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
19
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
20 public static int Main(string[] args)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
21 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
22 try
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
23 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
24 string error;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
25 ICommand commandToExecute = Program.GetCommandToExecute(args, out error);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
26 if (commandToExecute != null)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
27 return commandToExecute.Execute();
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
28 Program.PrintIncorrectUsageMessage(error);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
29 return 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
30 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
31 catch (Exception ex)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
32 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
33 Console.Error.WriteLine((object) ex);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
34 return 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
35 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
36 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
37
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
38 private static ICommand GetCommandToExecute(string[] args, out string error)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
39 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
40 error = string.Empty;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
41 string str = ((IEnumerable<string>) args).First<string>();
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
42 FileSystemPath inputFilePath = FileSystemPath.TryParse(args[2].Substring(3));
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
43 FileSystemPath outputFilePath = FileSystemPath.TryParse(args[1].Substring(3));
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
44 IEnumerable<FileSystemPath> targetFilePaths = Program.LoadPathsFromFile(inputFilePath);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
45 switch (str)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
46 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
47 case "dumpSymbolSign":
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
48 return (ICommand) new DumpSymbolsFileSignCommand(outputFilePath, targetFilePaths);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
49 case "dumpBinSign":
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
50 return (ICommand) new DumpBinaryFileSignCommand(outputFilePath, targetFilePaths);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
51 default:
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
52 error = string.Format("{0} command is unknown.", (object) str);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
53 return (ICommand) null;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
54 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
55 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
56
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
57 private static IEnumerable<FileSystemPath> LoadPathsFromFile(FileSystemPath inputFilePath)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
58 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
59 ICollection<FileSystemPath> result = (ICollection<FileSystemPath>) new HashSet<FileSystemPath>();
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
60 inputFilePath.ReadTextStream((Action<StreamReader>) (streamReader =>
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
61 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
62 while (!streamReader.EndOfStream)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
63 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
64 FileSystemPath fileSystemPath = FileSystemPath.TryParse(streamReader.ReadLine());
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
65 if (!fileSystemPath.IsEmpty)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
66 result.Add(fileSystemPath);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
67 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
68 }), (Encoding) null);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
69 return (IEnumerable<FileSystemPath>) result;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
70 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
71
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
72 private static void PrintIncorrectUsageMessage(string error)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
73 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
74 Console.Error.WriteLine(error);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
75 Console.Error.WriteLine("Usage: Symbols /<command_name> <command_parameters>");
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
76 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
77 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
78 }