Esempio n. 1
0
        public Task <DecompileResponse> Handle(DecompileMemberRequest request, CancellationToken cancellationToken)
        {
            if (request.AssemblyPath == null)
            {
                return(Task.FromResult(
                           new DecompileResponse(
                               IsError: true,
                               ErrorMessage: $"Error: Invalid assembly path.")));
            }

            var members         = decompilerBackend.GetMembers(request.AssemblyPath, MetadataTokens.TypeDefinitionHandle(request.Type));
            var requestedMember = MetadataTokens.EntityHandle(request.Member);

            foreach (var member in members)
            {
                var memberToken = MetadataTokens.EntityHandle(member.Token);
                if (memberToken == requestedMember)
                {
                    return(Task.FromResult(
                               new DecompileResponse(decompilerBackend.GetCode(request.AssemblyPath, memberToken))));
                }
            }

            return(Task.FromResult(
                       new DecompileResponse(
                           IsError: true,
                           ErrorMessage: $"Error: could not find member matching (type: {request.Type:8x}, member: {request.Member:8x}).")));
        }
 public Task <DecompileResponse> Handle(DecompileAssemblyRequest request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(
                new DecompileResponse(decompilerBackend.GetCode(request.AssemblyPath, EntityHandle.AssemblyDefinition))));
 }
 public Task <DecompileResponse> Handle(DecompileTypeRequest request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(
                new DecompileResponse(decompilerBackend.GetCode(request.AssemblyPath, MetadataTokens.EntityHandle(request.Handle)))));
 }