Beispiel #1
0
        public virtual FieldDefinition Resolve()
        {
            ModuleDefinition module = this.Module;

            if (module == null)
            {
                throw new NotSupportedException();
            }
            return(module.Resolve(this));
        }
Beispiel #2
0
        public new virtual TypeDefinition Resolve()
        {
            ModuleDefinition moduleDefinition = Module;

            if (moduleDefinition == null)
            {
                throw new NotSupportedException();
            }
            return(moduleDefinition.Resolve(this));
        }
Beispiel #3
0
        public override void Apply(ModuleDefinition module)
        {
            var method = module.GetMethod("System.Void Aura.Shared.Util.CliUtil::WriteHeader(System.String,System.ConsoleColor)");

            method.Body.SimplifyMacros();

            var bylineWrite = method.Body.Instructions.First(i => i.OpCode == OpCodes.Ldstr && i.Operand.ToString().Contains("by the"));

            do
            {
                bylineWrite = bylineWrite.Next;
            } while (!bylineWrite.Operand.ToString().Contains("System.Console::Write"));

            var il = method.Body.GetILProcessor();

            il.InsertAfter(bylineWrite,
                il.Create(OpCodes.Ldc_I4, (int)ConsoleColor.Yellow),
                il.Create(OpCodes.Call, module.Resolve(typeof(Console), "set_ForegroundColor")),
                il.Create(OpCodes.Ldstr, "                            == RADIATION Edition ==                             "),
                il.Create(OpCodes.Call, module.Resolve(typeof(Console), "Write", typeof(string)))
            );

            method.Body.OptimizeMacros();
        }
Beispiel #4
0
 public TypeDefinition Resolve()
 {
     return(module.Resolve(CreateReference()));
 }