annotate jet-symbols/src/JetBrains.CommandLine.Symbols/DumpFilesSignCommandBase.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 9ff982a9213e
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.DumpFilesSignCommandBase
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.Linq;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
11 using System.Xml;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
12
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
13 namespace JetBrains.CommandLine.Symbols
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
14 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
15 public abstract class DumpFilesSignCommandBase : ICommand
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
16 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
17 private FileSystemPath myOutputFilePath;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
18 private IEnumerable<FileSystemPath> myTargetFilePaths;
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 protected DumpFilesSignCommandBase(FileSystemPath outputFilePath, IEnumerable<FileSystemPath> targetFilePaths)
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 this.myOutputFilePath = outputFilePath;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
23 this.myTargetFilePaths = targetFilePaths;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
24 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
25
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
26 public int Execute()
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
27 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
28 try
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
29 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
30 if (this.myOutputFilePath.IsEmpty)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
31 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
32 Console.Error.WriteLine("Output file path is empty.");
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
33 return 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
34 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
35 Dictionary<FileSystemPath, string> dictionary = this.myTargetFilePaths.ToDictionary<FileSystemPath, FileSystemPath, string>((Func<FileSystemPath, FileSystemPath>) (targetFilePath => targetFilePath), new Func<FileSystemPath, string>(this.GetFileSignature));
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
36 if (!dictionary.IsEmpty<KeyValuePair<FileSystemPath, string>>())
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 DumpFilesSignCommandBase.WriteToFile(this.myOutputFilePath, dictionary);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
39 Console.Out.WriteLine("Dumped {0} signature entries to the file {1}", (object) dictionary.Count, (object) this.myOutputFilePath);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
40 return 0;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
41 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
42 Console.Error.WriteLine("Nothing to dump.");
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
43 return 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
44 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
45 catch (Exception ex)
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 Console.Error.WriteLine((object) ex);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
48 return 1;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
49 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
50 }
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
51
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
52 private static void WriteToFile(FileSystemPath outputFilePath, Dictionary<FileSystemPath, string> signatures)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
53 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
54 XmlDocument xmlDocument = new XmlDocument();
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
55 XmlNode node = xmlDocument.CreateNode(XmlNodeType.Element, "file-signs", "");
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
56 foreach (KeyValuePair<FileSystemPath, string> signature in signatures)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
57 {
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
58 XmlElement element = node.CreateElement("file-sign-entry");
103
9ff982a9213e report full pdb file path instead of file name when collecting pdb signatures
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents: 102
diff changeset
59 element.CreateAttributeWithNonEmptyValue("file", signature.Key.FullPath);
102
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
60 string str = signature.Value;
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
61 if (str != null)
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
62 element.CreateAttributeWithNonEmptyValue("sign", str);
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 xmlDocument.AppendChild(node);
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
65 using (XmlWriter w = XmlWriter.Create(outputFilePath.FullPath))
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
66 xmlDocument.WriteContentTo(w);
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
0e927b14ccf1 restored jet-symbols native tool sources
Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
parents:
diff changeset
69 protected abstract string GetFileSignature(FileSystemPath targetFilePath);
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 }