public ModuleConverter(ILogger logger)
 {
     if (logger == null)
     {
         logger = new DefLogger();
     }
     this.logger = logger;
 }
示例#2
0
        public static byte[] Convert(System.IO.Stream dllstream, ILogger logger = null)
        {
            var module = new ILModule();

            module.LoadModule(dllstream, null);
            if (logger == null)
            {
                logger = new DefLogger();
            }
            var converter = new ModuleConverter(logger);
            //有异常的话在 convert 函数中会直接throw 出来
            var antmodule = converter.Convert(module);

            return(antmodule.Build());
        }
示例#3
0
        public ModuleConverter(ILogger logger)
        {
            if (logger == null)
            {
                logger = new DefLogger();
            }
            this.logger = logger;
#if NET47
            try
            {
                var assm = System.Reflection.Assembly.GetAssembly(typeof(System.Action));
                var name = System.IO.Path.GetFileName(assm.Location);
                if (name.ToLower() == "mscorlib.dll")
                {
                    var path = System.IO.Path.GetFullPath(".");
                    System.IO.File.Copy(assm.Location, System.IO.Path.Combine(path, name));
                }
            }
            catch
            {
            }
            //assm.Location
#endif
        }