当前位置: 首页>>代码示例>>C#>>正文


C# DecompilationOptions类代码示例

本文整理汇总了C#中DecompilationOptions的典型用法代码示例。如果您正苦于以下问题:C# DecompilationOptions类的具体用法?C# DecompilationOptions怎么用?C# DecompilationOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DecompilationOptions类属于命名空间,在下文中一共展示了DecompilationOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Decompile

 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     EnsureLazyChildren();
     base.Decompile(language, output, options);
     if (stringTableEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     return new ResourceStringTable(stringTableEntries,
                         new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
                                                 MainWindow.Instance.mainPane.ActualHeight));
                 }
             );
         }
         output.WriteLine();
         output.WriteLine();
     }
     if (otherEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     return new ResourceObjectTable(otherEntries,
                         new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
                                                 MainWindow.Instance.mainPane.ActualHeight));
                 }
             );
         }
         output.WriteLine();
     }
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:32,代码来源:ResourcesFileTreeNode.cs

示例2: DecompileMethod

		public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
		{
			WriteCommentLine(output, TypeToString(method.DeclaringType, includeNamespace: true));
			AstBuilder codeDomBuilder = CreateAstBuilder(options, currentType: method.DeclaringType, isSingleMember: true);
			codeDomBuilder.AddMethod(method);
			RunTransformsAndGenerateCode(codeDomBuilder, output, options, method.Module);
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:VBLanguage.cs

示例3: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureChildrenFiltered));
			foreach (ILSpyTreeNode child in this.Children) {
				child.Decompile(language, output, options);
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:BaseTypesTreeNode.cs

示例4: Decompile

 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     EnsureChildrenFiltered();
     base.Decompile(language, output, options);
     if (stringTableEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     var textView = options.DecompilerTextView;
                     if (textView != null)
                         return new ResourceStringTable(stringTableEntries, textView) { Cursor = Cursors.Arrow };
                     return new TextBlock { Text = "no active tab!" };
                 }
             );
         }
         output.WriteLine();
         output.WriteLine();
     }
     if (otherEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     var textView = options.DecompilerTextView;
                     if (textView != null)
                         return new ResourceObjectTable(otherEntries, textView) { Cursor = Cursors.Arrow };
                     return new TextBlock { Text = "no active tab!" };
                 }
             );
         }
         output.WriteLine();
     }
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:34,代码来源:ResourcesFileTreeNode.cs

示例5: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			if (r.IsWindowsRuntime) {
				language.WriteCommentLine(output, r.Name + " [WinRT]");
			} else {
				language.WriteCommentLine(output, r.FullName);
			}
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:8,代码来源:AssemblyReferenceTreeNode.cs

示例6: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) {
			App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureChildrenFiltered));
			// Show metadata order of references
			foreach (var r in module.GetAssemblyRefs())
				new AssemblyReferenceTreeNode(r, parentAssembly, dnSpyFileListTreeNode).Decompile(language, output, options);
			foreach (var r in module.GetModuleRefs())
				language.WriteCommentLine(output, IdentifierEscaper.Escape(r.Name));
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:ReferenceFolderTreeNode.cs

示例7: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			if ((r.Attributes & (AssemblyAttributes)0x0200) != 0) {
				language.WriteCommentLine(output, r.Name + " [WinRT]");
			} else {
				language.WriteCommentLine(output, r.FullName);
			}
		}
开发者ID:jiguixin,项目名称:ILSpy,代码行数:8,代码来源:AssemblyReferenceTreeNode.cs

示例8: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
				HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				var files = WriteCodeFilesInProject(assembly.AssemblyDefinition, options, directories).ToList();
				files.AddRange(WriteResourceFilesInProject(assembly, options, directories));
				WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.AssemblyDefinition.MainModule;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				switch (mainModule.Architecture) {
					case TargetArchitecture.I386:
						if ((mainModule.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
							WriteCommentLine(output, "Architecture: x86");
						else
							WriteCommentLine(output, "Architecture: AnyCPU");
						break;
					case TargetArchitecture.AMD64:
						WriteCommentLine(output, "Architecture: x64");
						break;
					case TargetArchitecture.IA64:
						WriteCommentLine(output, "Architecture: Itanium-64");
						break;
				}
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
						WriteCommentLine(output, "Runtime: .NET 4.0");
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);
					codeDomBuilder.AddAssembly(assembly.AssemblyDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options);
				}
			}
			OnDecompilationFinished(null);
		}
开发者ID:itsff,项目名称:ILSpy,代码行数:58,代码来源:VBLanguage.cs

示例9: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
			// Show metadata order of references
			foreach (var r in module.AssemblyReferences)
				new AssemblyReferenceTreeNode(r, parentAssembly).Decompile(language, output, options);
			foreach (var r in module.ModuleReferences)
				language.WriteCommentLine(output, r.Name);
		}
开发者ID:FaceHunter,项目名称:ILSpy,代码行数:9,代码来源:ReferenceFolderTreeNode.cs

示例10: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {

                //Checks if must create a solution
                if (options.CreateSolution)
                {
                    //Solution directory
                    var solutionDir = options.SaveAsProjectDirectory;

                    //List of the project names and their guid
                    List<Tuple<string, string>> projects = new List<Tuple<string, string>>();

                    //For each module
                    foreach (var module in assembly.AssemblyDefinition.Modules)
                    {
                        //Creates the project and the various files
                        var projectDir = Path.Combine(solutionDir, TextView.DecompilerTextView.CleanUpName(Path.GetFileNameWithoutExtension(module.Name)));
                        Directory.CreateDirectory(projectDir);
                        options.SaveAsProjectDirectory = projectDir;
                        HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
                        var files = WriteCodeFilesInProject(module, options, directories).ToList();
                        files.AddRange(WriteResourceFilesInProject(module, options, directories));
                        using (var writer = new StreamWriter(Path.Combine(projectDir, Path.GetFileName(projectDir) + this.ProjectFileExtension), false, System.Text.Encoding.UTF8))
                            projects.Add(Tuple.Create(
                                Path.GetFileName(projectDir),
                                "{" + WriteProjectFile(writer, files, module, options).ToString().ToUpperInvariant() + "}"
                            ));
                    }

                    //Writes the solution
                    WriteSolutionFile(new TextOutputWriter(output), Enumerable.Reverse(projects));
                }
                else
                {
                    HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
                    var files = assembly.AssemblyDefinition.Modules.SelectMany(m => WriteCodeFilesInProject(m, options, directories)).ToList();
                    files.AddRange(assembly.AssemblyDefinition.Modules.SelectMany(m => WriteResourceFilesInProject(m, options, directories)));
                    WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule, options);
                }

			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
                WriteCommentLine(output, "Main module:");
                WriteModuleAttributes(assembly.AssemblyDefinition.MainModule, output, options);
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);
					codeDomBuilder.AddAssembly(assembly.AssemblyDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.AssemblyDefinition.MainModule);
				}
			}
			OnDecompilationFinished(null);
		}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:57,代码来源:VBLanguage.cs

示例11: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			language.WriteCommentLine(output, string.Format("{0} ({1}, {2})", r.Name, r.ResourceType, r.Attributes));
			
			ISmartTextOutput smartOutput = output as ISmartTextOutput;
			if (smartOutput != null && r is EmbeddedResource) {
				smartOutput.AddButton(Images.Save, "Save", delegate { Save(null); });
				output.WriteLine();
			}
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:10,代码来源:ResourceTreeNode.cs

示例12: Decompile

 public void Decompile(Language language, ITextOutput output, DecompilationOptions options, Action ensureLazyChildren)
 {
     var loadChildrenTask = this.loadChildrenTask;
     if (loadChildrenTask == null) {
         App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, ensureLazyChildren);
         loadChildrenTask = this.loadChildrenTask;
     }
     if (loadChildrenTask != null) {
         foreach (ILSpyTreeNode child in loadChildrenTask.Result.Cast<ILSpyTreeNode>()) {
             child.Decompile(language, output, options);
         }
     }
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:13,代码来源:ThreadingSupport.cs

示例13: Decompile

 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     var loadChildrenTask = this.loadChildrenTask;
     if (loadChildrenTask == null) {
         App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
         loadChildrenTask = this.loadChildrenTask;
     }
     if (loadChildrenTask != null) {
         foreach (var child in loadChildrenTask.Result) {
             child.Decompile(language, output, options);
         }
     }
 }
开发者ID:FriedWishes,项目名称:ILSpy,代码行数:13,代码来源:ThreadedTreeNode.cs

示例14: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
                var decompiler = new VBProjectDecompiler();
                decompiler.Decompile(this, assembly, output, options);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.ModuleDefinition;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				WriteCommentLine(output, "Architecture: " + CSharpLanguage.GetPlatformDisplayName(mainModule));
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
                        if (assembly.IsNet45())
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.5");
                        }
                        else
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.0");
                        }
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.ModuleDefinition);
					codeDomBuilder.AddAssembly(assembly.ModuleDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.ModuleDefinition);
				}
			}
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:49,代码来源:VBLanguage.cs

示例15: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options, DecompileAssemblyFlags flags = DecompileAssemblyFlags.AssemblyAndModule)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
				HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				var files = WriteCodeFilesInProject(assembly.ModuleDefinition, options, directories).ToList();
				files.AddRange(WriteResourceFilesInProject(assembly, options, directories));
				WriteProjectFile(new TextOutputWriter(output), files, assembly, options);
			} else {
				bool decompileAsm = (flags & DecompileAssemblyFlags.Assembly) != 0;
				bool decompileMod = (flags & DecompileAssemblyFlags.Module) != 0;
				base.DecompileAssembly(assembly, output, options, flags);
				output.WriteLine();
				ModuleDef mainModule = assembly.ModuleDefinition;
				if (decompileMod && mainModule.Types.Count > 0) {
					output.Write("' Global type: ", TextTokenType.Comment);
					output.WriteReference(IdentifierEscaper.Escape(mainModule.GlobalType.FullName), mainModule.GlobalType, TextTokenType.Comment);
					output.WriteLine();
				}
				if (decompileMod || decompileAsm)
					PrintEntryPoint(assembly, output);
				if (decompileMod) {
					WriteCommentLine(output, "Architecture: " + CSharpLanguage.GetPlatformDisplayName(mainModule));
					if (!mainModule.IsILOnly) {
						WriteCommentLine(output, "This assembly contains unmanaged code.");
					}
					string runtimeName = ICSharpCode.ILSpy.CSharpLanguage.GetRuntimeDisplayName(mainModule);
					if (runtimeName != null) {
						WriteCommentLine(output, "Runtime: " + runtimeName);
					}
				}
				if (decompileMod || decompileAsm)
					output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.ModuleDefinition);
					codeDomBuilder.AddAssembly(assembly.ModuleDefinition, !options.FullDecompilation, decompileAsm, decompileMod);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.ModuleDefinition);
				}
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:41,代码来源:VBLanguage.cs


注:本文中的DecompilationOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。