-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (34 loc) · 1.37 KB
/
Program.cs
File metadata and controls
37 lines (34 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Microsoft.VisualStudio.CommandTable;
using System;
using System.IO;
namespace VsctDecompile;
internal class Program {
static void Main(string[] args) {
var sourceFile = args[0];
if (string.IsNullOrWhiteSpace(sourceFile)) {
Console.WriteLine("Source file is required.");
return;
}
if (!File.Exists(sourceFile)) {
Console.WriteLine($"Source file '{sourceFile}' does not exist.");
return;
}
if (Path.GetExtension(sourceFile).ToLowerInvariant() != ".dll") {
Console.WriteLine("Source file must be a dll.");
return;
}
var ct = new CommandTable();
var messageProcessor = new SimpleMessageProcessor();
if (ct.Read(sourceFile, messageProcessor) && messageProcessor.Errors.Count == 0) {
var sourceFileAsCtSym = Path.ChangeExtension(sourceFile, ".ctsym");
ct.ImportSymbols(sourceFileAsCtSym, null, null);
if (!ct.ContainsSymbols) {
var message = $"No symbols found in '{sourceFileAsCtSym}'.";
messageProcessor.Error(0, null, 0, 0, message);
}
// Save to disk:
// var outputName = Path.ChangeExtension(sourceFile, ".vsct");
// ct.Save(outputName, new SaveOptions(SaveOptions.SaveFormat.XML), messageProcessor);
}
}
}