|
|
|
|
@ -3,6 +3,8 @@
@@ -3,6 +3,8 @@
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Collections.ObjectModel; |
|
|
|
|
using System.Linq; |
|
|
|
|
using ICSharpCode.CodeQuality.Engine.Dom; |
|
|
|
|
using ICSharpCode.NRefactory.TypeSystem; |
|
|
|
|
using ICSharpCode.NRefactory.TypeSystem.Implementation; |
|
|
|
|
@ -14,11 +16,26 @@ namespace ICSharpCode.CodeQuality.Engine
@@ -14,11 +16,26 @@ namespace ICSharpCode.CodeQuality.Engine
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AssemblyAnalyzer |
|
|
|
|
{ |
|
|
|
|
public IEnumerable<AssemblyNode> Assemblies { get; private set; } |
|
|
|
|
CecilLoader loader = new CecilLoader(true); |
|
|
|
|
ICompilation compilation = null; |
|
|
|
|
IUnresolvedAssembly mainAssem = null; |
|
|
|
|
|
|
|
|
|
public AssemblyAnalyzer() |
|
|
|
|
public AssemblyAnalyzer(params string[] fileNames) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
List<IUnresolvedAssembly> references = new List<IUnresolvedAssembly>(); |
|
|
|
|
foreach (string fileName in fileNames) { |
|
|
|
|
if (mainAssem == null) |
|
|
|
|
mainAssem = loader.LoadAssemblyFile(fileName); |
|
|
|
|
else |
|
|
|
|
references.Add(loader.LoadAssemblyFile(fileName)); |
|
|
|
|
} |
|
|
|
|
compilation = new SimpleCompilation(mainAssem, references); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ReadOnlyCollection<AssemblyNode> Analyze() |
|
|
|
|
{ |
|
|
|
|
AssemblyNode mainAssembly = new AssemblyNode(); |
|
|
|
|
return new ReadOnlyCollection<AssemblyNode>(new AssemblyNode[] { mainAssembly }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|