本文整理汇总了C#中ICSharpCode.ILSpy.AssemblyList类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyList类的具体用法?C# AssemblyList怎么用?C# AssemblyList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyList类属于ICSharpCode.ILSpy命名空间,在下文中一共展示了AssemblyList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToList
private void AddToList(AssemblyList list, string FullName)
{
AssemblyNameInfo reference = new AssemblyNameInfo(FullName);
string file = GacInterop.FindAssemblyInNetGac(reference);
if (file != null)
list.OpenAssembly(file);
}
示例2: CreateList
public bool CreateList(AssemblyList list)
{
if (!AssemblyLists.Contains(list.ListName))
{
AssemblyLists.Add(list.ListName);
SaveList(list);
return true;
}
return false;
}
示例3: LoadedAssembly
public LoadedAssembly(AssemblyList assemblyList, string fileName, Stream stream = null)
{
if (assemblyList == null)
throw new ArgumentNullException("assemblyList");
if (fileName == null)
throw new ArgumentNullException("fileName");
this.assemblyList = assemblyList;
this.fileName = fileName;
this.assemblyTask = Task.Factory.StartNew<ModuleDefinition>(LoadAssembly, stream); // requires that this.fileName is set
this.shortName = Path.GetFileNameWithoutExtension(fileName);
}
示例4: SaveList
/// <summary>
/// Saves the specifies assembly list into the config file.
/// </summary>
public static void SaveList(AssemblyList list)
{
ILSpySettings.Update(
delegate (XElement root) {
XElement doc = root.Element("AssemblyLists");
if (doc == null) {
doc = new XElement("AssemblyLists");
root.Add(doc);
}
XElement listElement = doc.Elements("List").FirstOrDefault(e => (string)e.Attribute("name") == list.ListName);
if (listElement != null)
listElement.ReplaceWith(list.SaveAsXml());
else
doc.Add(list.SaveAsXml());
});
}
示例5: LoadedAssembly
/// <summary>
/// Constructor to create modules present in multi-module assemblies
/// </summary>
/// <param name="assemblyList"></param>
/// <param name="module"></param>
public LoadedAssembly(AssemblyList assemblyList, ModuleDef module)
{
if (assemblyList == null)
throw new ArgumentNullException("assemblyList");
if (module == null)
throw new ArgumentNullException("module");
this.assemblyList = assemblyList;
this.fileName = module.Location ?? string.Empty;
this.assemblyTask = Task.Factory.StartNew<ModuleDef>(() => LoadModule(module));
this.shortName = GetShortName(fileName);
if (string.IsNullOrEmpty(this.shortName))
this.shortName = module.Name;
// Make sure IsLoaded is set to true
if (ModuleDefinition != null) { }
}
示例6: MemberPickerVM
public MemberPickerVM(Language language, ITreeViewNodeFilter filter, IEnumerable<LoadedAssembly> assemblies)
{
this.Language = language;
this.ShowInternalApi = true;
this.filter = filter;
this.origFilter = filter;
assemblyList = new AssemblyList("Member Picker List", false);
foreach (var asm in assemblies)
assemblyList.ForceAddAssemblyToList(asm, true, false, -1, false);
this.assemblyListTreeNode = new AssemblyListTreeNode(assemblyList);
this.assemblyListTreeNode.DisableDrop = true;
if (assemblyListTreeNode.Children.Count > 0)
SelectedItem = assemblyListTreeNode.Children[0];
// Make sure we don't hook this event before the assembly list node because we depend
// on the new asm node being present when we restart the search.
assemblyList.CollectionChanged += (s, e) => RestartSearch();
CreateNewFilterSettings();
}
示例7: DumpNetModule
static void DumpNetModule(ProjectInfo info, List<ProjectInfo> projectFiles)
{
var fileName = info.AssemblyFileName;
if (string.IsNullOrEmpty(fileName))
throw new Exception(".NET module filename is empty or null");
var asmList = new AssemblyList("dnspc.exe", false);
asmList.UseGAC = !noGac;
asmList.AddSearchPath(Path.GetDirectoryName(fileName));
foreach (var path in asmPaths)
asmList.AddSearchPath(path);
var lasm = new LoadedAssembly(asmList, fileName);
var opts = new DecompilationOptions {
FullDecompilation = true,
CancellationToken = new CancellationToken(),
};
TextWriter writer = null;
try {
var lang = GetLanguage();
if (useStdout)
writer = System.Console.Out;
else {
var baseDir = GetProjectDir(lang, fileName);
Directory.CreateDirectory(baseDir);
writer = new StreamWriter(info.ProjectFileName, false, Encoding.UTF8);
opts.SaveAsProjectDirectory = baseDir;
opts.DontReferenceStdLib = noCorlibRef;
opts.ProjectFiles = projectFiles;
opts.ProjectGuid = info.ProjectGuid;
opts.DontShowCreateMethodBodyExceptions = dontMaskErr;
Console.WriteLine("Saving {0} to {1}", fileName, baseDir);
}
lang.DecompileAssembly(lasm, new PlainTextOutput(writer), opts);
}
finally {
if (!useStdout && writer != null)
writer.Dispose();
}
}
示例8: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
// This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
ShowAssemblyList(this.assemblyList);
string[] args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++) {
assemblyList.OpenAssembly(args[i]);
}
if (assemblyList.GetAssemblies().Length == 0)
LoadInitialAssemblies();
SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
if (node != null) {
SelectNode(node);
// only if not showing the about page, perform the update check:
ShowMessageIfUpdatesAvailableAsync(spySettings);
} else {
AboutPage.Display(decompilerTextView);
}
}
示例9: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
this.Opacity = 0;
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
// This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
HandleCommandLineArguments(App.CommandLineArguments);
if (assemblyList.GetAssemblies().Length == 0
&& assemblyList.ListName == AssemblyListManager.DefaultListName)
{
LoadInitialAssemblies();
}
ShowAssemblyList(this.assemblyList);
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
if (App.CommandLineArguments.NavigateTo == null) {
SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
if (node != null) {
SelectNode(node);
// only if not showing the about page, perform the update check:
ShowMessageIfUpdatesAvailableAsync(spySettings);
} else {
AboutPage.Display(decompilerTextView);
}
}
searchBox.DataContext = SearchPane.Instance;
// setting the opacity to 0 and then using this code to set it back to 1 is kind of a hack to get
// around a problem where the window doesn't render properly when using the shell integration library
// but it works, and it looks nice
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.Opacity = 1));
}
示例10: ResetCurrentAssembly
public void ResetCurrentAssembly()
{
assemblyList = new AssemblyList(string.Empty);
}
示例11: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
// This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
HandleCommandLineArguments(App.CommandLineArguments);
ShowAssemblyList(this.assemblyList);
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) {
SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
if (node != null) {
SelectNode(node);
// only if not showing the about page, perform the update check:
ShowMessageIfUpdatesAvailableAsync(spySettings);
} else {
AboutPage.Display(decompilerTextView);
}
}
NavigationCommands.Search.InputGestures.Add(new KeyGesture(Key.E, ModifierKeys.Control));
AvalonEditTextOutput output = new AvalonEditTextOutput();
if (FormatExceptions(App.StartupExceptions.ToArray(), output))
decompilerTextView.ShowText(output);
}
示例12: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
// This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
HandleCommandLineArguments(App.CommandLineArguments);
if (assemblyList.GetAssemblies().Length == 0
&& assemblyList.ListName == AssemblyListManager.DefaultListName)
{
LoadInitialAssemblies();
}
ShowAssemblyList(this.assemblyList);
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
if (App.CommandLineArguments.NavigateTo == null) {
SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
if (node != null) {
SelectNode(node);
// only if not showing the about page, perform the update check:
ShowMessageIfUpdatesAvailableAsync(spySettings);
} else {
AboutPage.Display(decompilerTextView);
}
}
//Fires the OnLoaded notification to the plugins
foreach (var x in applicationLifeCycleInterceptors)
x.Value.OnLoaded();
}
示例13: ShowAssemblyList
void ShowAssemblyList(AssemblyList assemblyList)
{
this.assemblyList = assemblyList;
assemblyListTreeNode = new AssemblyListTreeNode(assemblyList);
assemblyListTreeNode.FilterSettings = sessionSettings.FilterSettings.Clone();
assemblyListTreeNode.Select = SelectNode;
treeView.Root = assemblyListTreeNode;
if (assemblyList.ListName == AssemblyListManager.DefaultListName)
this.Title = "ILSpy";
else
this.Title = "ILSpy - " + assemblyList.ListName;
}
示例14: AddToList
private void AddToList(AssemblyList list, string FullName)
{
AssemblyNameReference reference = AssemblyNameReference.Parse(FullName);
string file = GacInterop.FindAssemblyInNetGacOrWinMetadata(reference);
if (file != null)
list.OpenAssembly(file);
}
示例15: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff.
// This makes the UI come up a bit faster.
this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
HandleCommandLineArguments(App.CommandLineArguments);
if (assemblyList.GetAssemblies().Length == 0
&& assemblyList.ListName == AssemblyListManager.DefaultListName)
{
LoadInitialAssemblies();
}
ShowAssemblyList(this.assemblyList);
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) {
SharpTreeNode node = null;
if (sessionSettings.ActiveTreeViewPath != null) {
node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
if (node == this.assemblyListTreeNode & sessionSettings.ActiveAutoLoadedAssembly != null) {
this.assemblyList.OpenAssembly(sessionSettings.ActiveAutoLoadedAssembly, true);
node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);
}
}
if (node != null) {
SelectNode(node);
// only if not showing the about page, perform the update check:
ShowMessageIfUpdatesAvailableAsync(spySettings);
} else {
AboutPage.Display(decompilerTextView);
}
}
AvalonEditTextOutput output = new AvalonEditTextOutput();
if (FormatExceptions(App.StartupExceptions.ToArray(), output))
decompilerTextView.ShowText(output);
}