-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAssemblyDocument.cs
More file actions
42 lines (36 loc) · 1.14 KB
/
AssemblyDocument.cs
File metadata and controls
42 lines (36 loc) · 1.14 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
38
39
40
41
42
using System;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using Mono.Cecil;
namespace APITool
{
public class AssemblyDocument
{
Dictionary<string, XmlNode> _xmlNodes = new Dictionary<string, XmlNode>();
public AssemblyDocument(AssemblyDefinition asm)
{
string xmlpath = Path.ChangeExtension(asm.MainModule.FileName, "xml");
if (File.Exists(xmlpath))
{
var xmlDoc = new XmlDocument();
xmlDoc.Load(xmlpath);
foreach (XmlNode docNode in xmlDoc.DocumentElement.ChildNodes)
{
foreach (XmlNode memberNode in docNode)
{
if (memberNode.Name == "member")
{
_xmlNodes[memberNode.Attributes["name"].Value] = memberNode;
}
}
}
}
}
public XmlNode GetMemberNode(string docId) {
XmlNode xmlNode = null;
_xmlNodes.TryGetValue(docId, out xmlNode);
return xmlNode;
}
}
}