本文整理汇总了C#中ICSharpCode.ILSpy.LoadedAssembly类的典型用法代码示例。如果您正苦于以下问题:C# LoadedAssembly类的具体用法?C# LoadedAssembly怎么用?C# LoadedAssembly使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadedAssembly类属于ICSharpCode.ILSpy命名空间,在下文中一共展示了LoadedAssembly类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetFilterResult
public override TreeViewNodeFilterResult GetFilterResult(LoadedAssembly asm, AssemblyFilterType type) {
if (type == AssemblyFilterType.NonNetFile)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
if (type == AssemblyFilterType.Assembly) {
if (assembly == null || asm.AssemblyDefinition != assembly)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
return new TreeViewNodeFilterResult(FilterResult.Match, false);
}
if (type == AssemblyFilterType.NetModule) {
if (asm.AssemblyDefinition != assembly)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
if (assembly == null || assembly.ManifestModule != module) {
if (asm.ModuleDefinition != module)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
return new TreeViewNodeFilterResult(FilterResult.Match, false);
}
else
return new TreeViewNodeFilterResult(FilterResult.Match, asm.ModuleDefinition != assembly.ManifestModule);
}
Debug.Fail("Invalid AssemblyFilterType value");
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:25,代码来源:EntryPointTreeViewNodeFilter.cs
示例2: GetFilterResult
public override TreeViewNodeFilterResult GetFilterResult(LoadedAssembly asm, AssemblyFilterType type) {
if (asm.AssemblyDefinition != allowedAsm)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
if (allowedAsm == null && asm.ModuleDefinition != allowedMod)
return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
return base.GetFilterResult(asm, type);
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:SameAssemblyTreeViewNodeFilter.cs
示例3: Execute
static void Execute(ILSpyTreeNode[] nodes)
{
if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
return;
var dialog = new System.Windows.Forms.OpenFileDialog() {
Filter = ".NET NetModules (*.netmodule)|*.netmodule|All files (*.*)|*.*",
RestoreDirectory = true,
};
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
if (string.IsNullOrEmpty(dialog.FileName))
return;
var asm = new LoadedAssembly(MainWindow.Instance.CurrentAssemblyList, dialog.FileName);
if (asm.ModuleDefinition == null || asm.AssemblyDefinition != null) {
MainWindow.Instance.ShowMessageBox(string.Format("{0} is not a NetModule", asm.FileName), System.Windows.MessageBoxButton.OK);
asm.TheLoadedFile.Dispose();
return;
}
var cmd = new AddExistingNetModuleToAssemblyCommand((AssemblyTreeNode)nodes[0], asm);
UndoCommandManager.Instance.Add(cmd);
MainWindow.Instance.JumpToReference(cmd.modNode);
}
开发者ID:4058665,项目名称:dnSpy,代码行数:25,代码来源:ModuleCommands.cs
示例4: WriteResourceToFile
public string WriteResourceToFile(LoadedAssembly assembly, string fileName, Stream stream, DecompilationOptions options)
{
var document = BamlResourceEntryNode.LoadIntoDocument(assembly.GetAssemblyResolver(), assembly.AssemblyDefinition, stream);
fileName = Path.ChangeExtension(fileName, ".xaml");
document.Save(Path.Combine(options.SaveAsProjectDirectory, fileName));
return fileName;
}
开发者ID:FaceHunter,项目名称:ILSpy,代码行数:7,代码来源:BamlResourceNodeFactory.cs
示例5: DecompileAssembly
public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
output.WriteLine("// " + assembly.FileName);
output.WriteLine();
new ReflectionDisassembler(output, detectControlStructure, options.CancellationToken).WriteAssemblyHeader(assembly.AssemblyDefinition);
}
开发者ID:keremkusmezer,项目名称:ILSpy,代码行数:7,代码来源:ILLanguage.cs
示例6: DecompileAssembly
public virtual void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, assembly.FileName);
if (assembly.AssemblyDefinition != null) {
if (assembly.AssemblyDefinition.IsContentTypeWindowsRuntime) {
WriteCommentLine(output, assembly.AssemblyDefinition.Name + " [WinRT]");
} else {
WriteCommentLine(output, assembly.AssemblyDefinition.FullName);
}
} else {
WriteCommentLine(output, assembly.ModuleDefinition.Name);
}
}
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:13,代码来源:Language.cs
示例7: GetFilterResult
public override TreeViewNodeFilterResult GetFilterResult(LoadedAssembly asm, AssemblyFilterType type) {
VisibleMembersFlags thisFlag, visibleFlags;
switch (type) {
case AssemblyFilterType.Assembly:
thisFlag = VisibleMembersFlags.AssemblyDef;
visibleFlags = thisFlag | VisibleMembersFlags.ModuleDef |
VisibleMembersFlags.Namespace | VisibleMembersFlags.AnyTypeDef |
VisibleMembersFlags.FieldDef | VisibleMembersFlags.MethodDef |
VisibleMembersFlags.InstanceConstructor | VisibleMembersFlags.PropertyDef |
VisibleMembersFlags.EventDef | VisibleMembersFlags.AssemblyRef |
VisibleMembersFlags.BaseTypes | VisibleMembersFlags.DerivedTypes |
VisibleMembersFlags.ModuleRef | VisibleMembersFlags.ResourceList |
VisibleMembersFlags.MethodBody | VisibleMembersFlags.ParamDefs |
VisibleMembersFlags.ParamDef | VisibleMembersFlags.Locals |
VisibleMembersFlags.Local | VisibleMembersFlags.Resource |
VisibleMembersFlags.ResourceElement | VisibleMembersFlags.PE |
VisibleMembersFlags.Hex;
break;
case AssemblyFilterType.NetModule:
thisFlag = VisibleMembersFlags.ModuleDef;
visibleFlags = thisFlag |
VisibleMembersFlags.Namespace | VisibleMembersFlags.AnyTypeDef |
VisibleMembersFlags.FieldDef | VisibleMembersFlags.MethodDef |
VisibleMembersFlags.InstanceConstructor | VisibleMembersFlags.PropertyDef |
VisibleMembersFlags.EventDef | VisibleMembersFlags.AssemblyRef |
VisibleMembersFlags.BaseTypes | VisibleMembersFlags.DerivedTypes |
VisibleMembersFlags.ModuleRef | VisibleMembersFlags.ResourceList |
VisibleMembersFlags.MethodBody | VisibleMembersFlags.ParamDefs |
VisibleMembersFlags.ParamDef | VisibleMembersFlags.Locals |
VisibleMembersFlags.Local | VisibleMembersFlags.Resource |
VisibleMembersFlags.ResourceElement | VisibleMembersFlags.PE |
VisibleMembersFlags.Hex;
break;
case AssemblyFilterType.NonNetFile:
default:
thisFlag = VisibleMembersFlags.NonNetFile;
visibleFlags = thisFlag | VisibleMembersFlags.PE | VisibleMembersFlags.Hex;
break;
}
bool isMatch = (flags & thisFlag) != 0;
if ((flags & visibleFlags) == 0)
return new TreeViewNodeFilterResult(FilterResult.Hidden, isMatch);
if (isMatch)
return new TreeViewNodeFilterResult(FilterResult.Match, isMatch); // Make sure it's not hidden
return new TreeViewNodeFilterResult(null, isMatch);
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:50,代码来源:FlagsTreeViewNodeFilter.cs
示例8: DecompileAssembly
public AssemblyCompiler AssemblyCompiler { get { return compiler.AssemblyCompiler; } }
public MapFileLookup MapFile { get { return compiler.MapFile; } }
public static bool GenerateSetNextInstructionCode
{
get { return compiler.GenerateSetNextInstructionCode; }
set { compiler.GenerateSetNextInstructionCode = value; }
}
public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
compiler.CompileIfRequired(assembly.AssemblyDefinition);
开发者ID:Xtremrules,项目名称:dot42,代码行数:14,代码来源:CompiledLanguage.cs
示例9: DecompileAssembly
public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
output.WriteLine("// " + assembly.FileName);
output.WriteLine();
ReflectionDisassembler rd = new ReflectionDisassembler(output, detectControlStructure, options.CancellationToken);
//if (options.FullDecompilation)
// rd.WriteAssemblyReferences(assembly.ModuleDefinition);
if (assembly.AssemblyDefinition != null)
rd.WriteAssemblyHeader(assembly.AssemblyDefinition);
output.WriteLine();
rd.WriteModuleHeader(assembly.ModuleDefinition);
if (options.FullDecompilation) {
output.WriteLine();
output.WriteLine();
rd.WriteModuleContents(assembly.ModuleDefinition);
}
}
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:18,代码来源:ILLanguage.cs
示例10: OpenAssembly
/// <summary>
/// Opens an assembly from disk.
/// Returns the existing assembly node if it is already loaded.
/// </summary>
public LoadedAssembly OpenAssembly(string file)
{
App.Current.Dispatcher.VerifyAccess();
file = Path.GetFullPath(file);
foreach (LoadedAssembly asm in this.assemblies) {
if (file.Equals(asm.FileName, StringComparison.OrdinalIgnoreCase))
return asm;
}
var newAsm = new LoadedAssembly(this, file);
lock (assemblies) {
this.assemblies.Add(newAsm);
}
return newAsm;
}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:21,代码来源:AssemblyList.cs
示例11: DecompileAssembly
public virtual void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, assembly.FileName);
WriteCommentLine(output, assembly.AssemblyDefinition.FullName);
}
开发者ID:KevinCathcart,项目名称:ILSpy,代码行数:5,代码来源:Language.cs
示例12: WriteResourceFilesInProject
IEnumerable<Tuple<string, string>> WriteResourceFilesInProject(LoadedAssembly assembly, DecompilationOptions options, HashSet<string> directories)
{
//AppDomain bamlDecompilerAppDomain = null;
//try {
foreach (EmbeddedResource r in assembly.AssemblyDefinition.MainModule.Resources.OfType<EmbeddedResource>()) {
string fileName;
Stream s = r.GetResourceStream();
s.Position = 0;
if (r.Name.EndsWith(".g.resources", StringComparison.OrdinalIgnoreCase)) {
IEnumerable<DictionaryEntry> rs = null;
try {
rs = new ResourceSet(s).Cast<DictionaryEntry>();
}
catch (ArgumentException) {
}
if (rs != null && rs.All(e => e.Value is Stream)) {
foreach (var pair in rs) {
fileName = Path.Combine(((string)pair.Key).Split('/').Select(p => TextView.DecompilerTextView.CleanUpName(p)).ToArray());
string dirName = Path.GetDirectoryName(fileName);
if (!string.IsNullOrEmpty(dirName) && directories.Add(dirName)) {
Directory.CreateDirectory(Path.Combine(options.SaveAsProjectDirectory, dirName));
}
Stream entryStream = (Stream)pair.Value;
entryStream.Position = 0;
if (fileName.EndsWith(".baml", StringComparison.OrdinalIgnoreCase)) {
MemoryStream ms = new MemoryStream();
entryStream.CopyTo(ms);
// TODO implement extension point
// var decompiler = Baml.BamlResourceEntryNode.CreateBamlDecompilerInAppDomain(ref bamlDecompilerAppDomain, assembly.FileName);
// string xaml = null;
// try {
// xaml = decompiler.DecompileBaml(ms, assembly.FileName, new ConnectMethodDecompiler(assembly), new AssemblyResolver(assembly));
// }
// catch (XamlXmlWriterException) { } // ignore XAML writer exceptions
// if (xaml != null) {
// File.WriteAllText(Path.Combine(options.SaveAsProjectDirectory, Path.ChangeExtension(fileName, ".xaml")), xaml);
// yield return Tuple.Create("Page", Path.ChangeExtension(fileName, ".xaml"));
// continue;
// }
}
using (FileStream fs = new FileStream(Path.Combine(options.SaveAsProjectDirectory, fileName), FileMode.Create, FileAccess.Write)) {
entryStream.CopyTo(fs);
}
yield return Tuple.Create("Resource", fileName);
}
continue;
}
}
fileName = GetFileNameForResource(r.Name, directories);
using (FileStream fs = new FileStream(Path.Combine(options.SaveAsProjectDirectory, fileName), FileMode.Create, FileAccess.Write)) {
s.CopyTo(fs);
}
yield return Tuple.Create("EmbeddedResource", fileName);
}
//}
//finally {
// if (bamlDecompilerAppDomain != null)
// AppDomain.Unload(bamlDecompilerAppDomain);
//}
}
开发者ID:Netring,项目名称:ILSpy,代码行数:60,代码来源:CSharpLanguage.cs
示例13: CreateDebugProcessVM
DebugProcessVM CreateDebugProcessVM(LoadedAssembly asm = null)
{
// Re-use the previous one if it's the same file
if (lastDebugProcessVM != null && asm != null) {
if (StringComparer.OrdinalIgnoreCase.Equals(lastDebugProcessVM.Filename, asm.FileName))
return lastDebugProcessVM.Clone();
}
var vm = new DebugProcessVM();
if (asm != null)
vm.Filename = asm.FileName;
vm.BreakProcessType = DebuggerSettings.Instance.BreakProcessType;
return vm;
}
开发者ID:andyhebear,项目名称:dnSpy,代码行数:14,代码来源:DebugManager.cs
示例14: 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();
}
}
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:42,代码来源:Program.cs
示例15: HandleModelUpdated
public override bool HandleModelUpdated(LoadedAssembly asm)
{
this.Children.RemoveAll(
delegate(SharpTreeNode n) {
AnalyzerTreeNode an = n as AnalyzerTreeNode;
return an == null || !an.HandleModelUpdated(asm);
});
return true;
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:9,代码来源:AnalyzerTreeView.cs
示例16: AddToList
void AddToList(LoadedAssembly newAsm, int index)
{
if (index >= 0 && index < assemblies.Count)
assemblies.Insert(index, newAsm);
else
assemblies.Add(newAsm);
}
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:AssemblyList.cs
示例17: DelayLoadAssembly
LoadedAssembly DelayLoadAssembly(LoadedAssembly newAsm, int index, bool canDispose)
{
System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(newAsm.FileName));
bool startThread;
lock (delayLoadedAsms) {
Tuple<LoadedAssembly, int> info;
if (delayLoadedAsms.TryGetValue(newAsm.FileName, out info)) {
if (canDispose)
newAsm.TheLoadedFile.Dispose();
return info.Item1;
}
delayLoadedAsms.Add(newAsm.FileName, Tuple.Create(newAsm, index));
startThread = delayLoadedAsms.Count == 1;
}
if (startThread)
App.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => DelayLoadAssemblyMainThread()));
return newAsm;
}
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:18,代码来源:AssemblyList.cs
示例18: RunningSearch
public RunningSearch(LoadedAssembly[] assemblies, string searchTerm, int searchMode, Language language)
{
this.dispatcher = Dispatcher.CurrentDispatcher;
this.assemblies = assemblies;
this.searchTerm = searchTerm.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
this.language = language;
this.searchMode = searchMode;
this.Results.Add(new SearchResult { Name = "Searching..." });
}
开发者ID:rongchunzhang,项目名称:ILSpy,代码行数:10,代码来源:SearchPane.cs
示例19: Unload
public void Unload(LoadedAssembly assembly)
{
if (App.Current != null)
App.Current.Dispatcher.VerifyAccess();
lock (assemblies) {
assemblies.Remove(assembly);
assembly.Dispose();
}
RequestGC();
}
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:10,代码来源:AssemblyList.cs
示例20: NotifyModifiedAssembly
public static void NotifyModifiedAssembly(LoadedAssembly asm)
{
MainWindow.Instance.ModuleModified(asm);
}
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:4,代码来源:Utils.cs
注:本文中的ICSharpCode.ILSpy.LoadedAssembly类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论