Пример #1
0
        public static bool CheckMethodSignature(MethodInfo method, ParsedMethodName signature)
        {
            var serverArgTypes = method.GetParameters()
                    .Select(x => x.ParameterType)
                    .ToArray();
            var serverRetType = method.ReturnType;

            return serverRetType == signature.ReturnType && Enumerable.SequenceEqual(signature.ArgumentTypes, serverArgTypes);
        }
Пример #2
0
 public CodeDecompiler(ParsedMethodName mp)
 {
     if (mp == null)
     {
         throw new ArgumentNullException("Failed to instantiate CodeDecompiler due to NULL parameter.", "MethodNameParser mp");
     }
     this._mp = mp;
     this.sourceCodeBasePath = System.IO.Path.GetFullPath($"{HttpRuntime.AppDomainAppPath.ToString()}..\\DemoWebCamp\\SourceCode");
     this.decompiler         = new CSharpDecompiler($@"{this.sourceCodeBasePath}\bin\{this._mp.DllName}", new ICSharpCode.Decompiler.DecompilerSettings());
     this.amb = new CSharpAmbience();
 }
        public string Get(string fullyQualifiedFunctionName)
        {
            if (string.IsNullOrWhiteSpace(fullyQualifiedFunctionName))
            {
                throw new ArgumentNullException("fullyQualifiedFunctionName", "No function name supplied. Failed to decompile without a function name.");
            }

            ParsedMethodName mp = MethodNameParser.Parse(fullyQualifiedFunctionName);
            CodeDecompiler   cd = new CodeDecompiler(mp);

            return(cd.DecompileMethod());
        }