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


C# IDecompiler类代码示例

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


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

示例1: Decompile

		void Decompile(ModuleDef module, BamlDocument document, IDecompiler lang,
			IDecompilerOutput output, CancellationToken token) {
			var decompiler = new XamlDecompiler();
			var xaml = decompiler.Decompile(module, document, token, BamlDecompilerOptions.Create(lang), null);
			var xamlText = new XamlOutputCreator(xamlOutputOptionsProvider.Default).CreateText(xaml);
			documentWriterService.Write(output, xamlText, ContentTypes.Xaml);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:BamlResourceElementNode.cs

示例2: Rewrite

        public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
        {
            if (args[0].Variability == Msil.EVariability.ExternVariable)
                throw new NotSupportedException("Delegate calls must have constant target!");

            Delegate deleg = (Delegate)args[0].Sample;
            if (deleg == null)
                return false;

            StackElement[] callArgs;
            if (deleg.Method.IsStatic)
            {
                callArgs = new StackElement[args.Length - 1];
                Array.Copy(args, 1, callArgs, 0, args.Length - 1);
            }
            else
            {
                callArgs = new StackElement[args.Length];
                Array.Copy(args, callArgs, args.Length);
                callArgs[0].Sample = deleg.Target;
                callArgs[0].Expr = LiteralReference.CreateConstant(deleg.Target);
                callArgs[0].Variability = Msil.EVariability.Constant;
            }
            stack.ImplementCall(deleg.Method, callArgs);
            return true;
        }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:26,代码来源:ResolveDelegateCalls.cs

示例3: Setup

		public void Setup()
		{
            mr = new MockRepository();
            form = new MainForm();
            sc = new ServiceContainer();
            loader = mr.StrictMock<ILoader>();
            dec = mr.StrictMock<IDecompiler>();
            sc = new ServiceContainer();
            uiSvc = new FakeShellUiService();
            host = mr.StrictMock<DecompilerHost>();
            memSvc = mr.StrictMock<ILowLevelViewService>();
            var image = new LoadedImage(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = image.CreateImageMap();
            var arch = mr.StrictMock<IProcessorArchitecture>();
            arch.Stub(a => a.CreateRegisterBitset()).Return(new BitSet(32));
            arch.Replay();
            var platform = mr.StrictMock<Platform>(null, arch);
            arch.BackToRecord();
            program = new Program(image, imageMap, arch, platform);
            project = new Project { Programs = { program } };

            browserSvc = mr.StrictMock<IProjectBrowserService>();

            sc.AddService<IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService<ILoader>(loader);

            i = new TestInitialPageInteractor(sc, dec);

		}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:35,代码来源:InitialPageInteractorTests.cs

示例4: Setup

		public void Setup()
		{
            mr = new MockRepository();
            form = new MainForm();
            sc = new ServiceContainer();
            loader = mr.StrictMock<ILoader>();
            dec = mr.StrictMock<IDecompiler>();
            sc = new ServiceContainer();
            uiSvc = new FakeShellUiService();
            host = mr.StrictMock<DecompilerHost>();
            memSvc = mr.StrictMock<ILowLevelViewService>();
            var mem = new MemoryArea(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = new SegmentMap(
                mem.BaseAddress,
                new ImageSegment("code", mem, AccessMode.ReadWriteExecute));
            var arch = mr.StrictMock<IProcessorArchitecture>();
            var platform = mr.StrictMock<IPlatform>();
            program = new Program(imageMap, arch, platform);
            project = new Project { Programs = { program } };

            browserSvc = mr.StrictMock<IProjectBrowserService>();

            sc.AddService<IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService<ILoader>(loader);
            sc.AddService<DecompilerHost>(host);

            i = new TestInitialPageInteractor(sc, dec);

		}
开发者ID:relaxar,项目名称:reko,代码行数:35,代码来源:InitialPageInteractorTests.cs

示例5: WriteCore

		protected override void WriteCore(ITextColorWriter output, IDecompiler decompiler, DocumentNodeWriteOptions options) {
			var tdr = TryGetTypeDefOrRef();
			if (tdr == null)
				output.Write(BoxedTextColor.Error, "???");
			else
				new NodePrinter().Write(output, decompiler, tdr, GetShowToken(options));
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:BaseTypeNodeImpl.cs

示例6: IsSupportedLanguage

		bool IsSupportedLanguage(IDecompiler decompiler, CompilationKind kind) {
			if (decompiler == null)
				return false;

			switch (kind) {
			case CompilationKind.Assembly:
				if (!decompiler.CanDecompile(DecompilationType.AssemblyInfo))
					return false;
				break;

			case CompilationKind.Method:
			case CompilationKind.EditClass:
				if (!decompiler.CanDecompile(DecompilationType.TypeMethods))
					return false;
				break;

			case CompilationKind.AddClass:
				break;

			default:
				throw new ArgumentOutOfRangeException(nameof(kind));
			}

			return languageCompilerProviders.Any(a => a.Language == decompiler.GenericGuid);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:25,代码来源:EditCodeVMCreator.cs

示例7: CalculateLanguageGuid

		static Guid CalculateLanguageGuid(IDecompiler decompiler) {
			if (decompiler.GenericGuid == DecompilerConstants.LANGUAGE_VISUALBASIC)
				return new Guid("F184B08F-C81C-45F6-A57F-5ABD9991F28F");

			Debug.Assert(decompiler.GenericGuid == DecompilerConstants.LANGUAGE_CSHARP);
			return new Guid("FAE04EC0-301F-11D3-BF4B-00C04F79EFBC");
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:Project.cs

示例8: Write

		/// <summary>
		/// Writes a file
		/// </summary>
		/// <param name="output">Output</param>
		/// <param name="decompiler">Decompiler</param>
		/// <param name="document">Document</param>
		public void Write(ITextColorWriter output, IDecompiler decompiler, IDsDocument document) {
			var filename = GetFilename(document);
			var peImage = document.PEImage;
			if (peImage != null)
				output.Write(IsExe(peImage) ? BoxedTextColor.AssemblyExe : BoxedTextColor.Assembly, NameUtilities.CleanName(filename));
			else
				output.Write(BoxedTextColor.Text, NameUtilities.CleanName(filename));
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:14,代码来源:NodePrinter.cs

示例9: NodeDecompiler

		public NodeDecompiler(Func<Func<object>, object> execInThread, IDecompilerOutput output, IDecompiler decompiler, DecompilationContext decompilationContext, IDecompileNodeContext decompileNodeContext = null) {
			this.execInThread = execInThread;
			this.output = output;
			this.decompiler = decompiler;
			this.decompilationContext = decompilationContext;
			this.decompileNodeContext = decompileNodeContext;
			this.decompileNodeContext.ContentTypeString = decompiler.ContentTypeString;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:NodeDecompiler.cs

示例10: AppBamlResourceProjectFile

		public AppBamlResourceProjectFile(string filename, TypeDef type, IDecompiler decompiler) {
			Filename = filename;
			this.type = type;
			SubType = "Designer";
			Generator = "MSBuild:Compile";
			BuildAction = DotNetUtils.IsStartUpClass(type) ? BuildAction.ApplicationDefinition : BuildAction.Page;
			this.decompiler = decompiler;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:BamlResourceProjectFile.cs

示例11: DecompileFields

		protected virtual void DecompileFields(IDecompiler decompiler, IDecompilerOutput output) {
			foreach (var vm in HexVMs) {
				decompiler.WriteCommentLine(output, string.Empty);
				decompiler.WriteCommentLine(output, string.Format("{0}:", vm.Name));
				foreach (var field in vm.HexFields)
					decompiler.WriteCommentLine(output, string.Format("{0:X8} - {1:X8} {2} = {3}", field.Span.Start.ToUInt64(), field.Span.End.ToUInt64() - 1, field.FormattedValue, field.Name));
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:HexNode.cs

示例12: NodeTabSaver

		NodeTabSaver(IMessageBoxService messageBoxService, IDocumentTab tab, IDocumentTreeNodeDecompiler documentTreeNodeDecompiler, IDecompiler decompiler, IDocumentViewer documentViewer, DocumentTreeNodeData[] nodes) {
			this.messageBoxService = messageBoxService;
			this.tab = tab;
			this.documentTreeNodeDecompiler = documentTreeNodeDecompiler;
			this.decompiler = decompiler;
			this.documentViewer = documentViewer;
			this.nodes = nodes;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:NodeTabSaver.cs

示例13: EditClassVM

		public EditClassVM(IRawModuleBytesProvider rawModuleBytesProvider, IOpenFromGAC openFromGAC, IOpenAssembly openAssembly, ILanguageCompiler languageCompiler, IDecompiler decompiler, IMemberDef defToEdit, IList<MethodSourceStatement> statementsInMethodToEdit)
			: base(rawModuleBytesProvider, openFromGAC, openAssembly, languageCompiler, decompiler, defToEdit.Module) {
			this.defToEdit = defToEdit;
			nonNestedTypeToEdit = defToEdit as TypeDef ?? defToEdit.DeclaringType;
			while (nonNestedTypeToEdit.DeclaringType != null)
				nonNestedTypeToEdit = nonNestedTypeToEdit.DeclaringType;
			methodSourceStatement = statementsInMethodToEdit.Count == 0 ? (MethodSourceStatement?)null : statementsInMethodToEdit[0];
			StartDecompile();
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:EditClassVM.cs

示例14: WriteShort

		public override void WriteShort(IDecompilerOutput output, IDecompiler decompiler, bool showOffset) {
			base.WriteShort(output, decompiler, showOffset);
			var documentViewerOutput = output as IDocumentViewerOutput;
			if (documentViewerOutput != null) {
				documentViewerOutput.AddButton(dnSpy_Resources.SaveResourceButton, () => Save());
				documentViewerOutput.WriteLine();
				documentViewerOutput.WriteLine();
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:UnknownResourceNodeImpl.cs

示例15: WriteCore

		protected override void WriteCore(ITextColorWriter output, IDecompiler decompiler, DocumentNodeWriteOptions options) {
			if ((options & DocumentNodeWriteOptions.ToolTip) == 0)
				new NodePrinter().Write(output, decompiler, Document);
			else {
				output.Write(BoxedTextColor.Text, TargetFrameworkUtils.GetArchString(Document.PEImage.ImageNTHeaders.FileHeader.Machine));

				output.WriteLine();
				output.WriteFilename(Document.Filename);
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:10,代码来源:PEDocumentNodeImpl.cs


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