Ejemplo n.º 1
0
 private Instruction AppendDebugWrite(Instruction instruction, ILProcessor processor, string message)
 {
     return(instruction
            .AppendLdstr(processor, message)
            .Append(processor.Create(OpCodes.Call,
                                     ModuleDefinition.ImportMethod(References.DebugWriteLineMethod)), processor));
 }
Ejemplo n.º 2
0
 public static Instruction AppendDebugWrite(this Instruction instruction, ILProcessor processor, string message,
                                            ModuleDefinition module)
 {
     return
         (instruction.AppendLdstr(processor, message)
          .Append(processor.Create(OpCodes.Call, module.ImportMethod(typeof(Debug), "WriteLine", new[] { typeof(string) })),
                  processor));
 }
Ejemplo n.º 3
0
        private Instruction InjectCacheKeyCreatedCode(MethodDefinition methodDefinition, Instruction current,
                                                      ILProcessor processor, int cacheKeyIndex)
        {
            if (LogDebugOutput)
            {
                // Call Debug.WriteLine with CacheKey
                current =
                    current.AppendLdstr(processor, "CacheKey created: {0}")
                    .AppendLdloc(processor, cacheKeyIndex)
                    .Append(
                        processor.Create(OpCodes.Call,
                                         methodDefinition.Module.ImportMethod <string>("Format", new[] { typeof(string), typeof(object) })), processor)
                    .Append(
                        processor.Create(OpCodes.Call,
                                         methodDefinition.Module.ImportMethod(typeof(Debug), "WriteLine", new[] { typeof(string) })), processor);
            }

            return(current);
        }
Ejemplo n.º 4
0
        private static Instruction InjectCacheKeyCreatedCode(BaseModuleWeaver weaver, MethodDefinition methodDefinition, Instruction current, ILProcessor processor, int cacheKeyIndex)
        {
            // Call Debug.WriteLine with CacheKey
            current = current
                      .AppendLdstr(processor, "CacheKey created: {0}")
                      .AppendLdcI4(processor, 1)
                      .Append(processor.Create(OpCodes.Newarr, weaver.ModuleDefinition.TypeSystem.Object), processor)
                      .AppendDup(processor)
                      .AppendLdcI4(processor, 0)
                      .AppendLdloc(processor, cacheKeyIndex)
                      .Append(processor.Create(OpCodes.Stelem_Ref), processor)
                      .Append(processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod(ReferenceFinder.StringFormatMethod)),
                              processor)
                      .Append(processor.Create(OpCodes.Call, methodDefinition.Module.ImportMethod(ReferenceFinder.DebugWriteLineMethod)),
                              processor);


            return(current);
        }
Ejemplo n.º 5
0
 private static Instruction AppendDebugWrite(BaseModuleWeaver weaver, Instruction instruction, ILProcessor processor, string message)
 {
     return(instruction
            .AppendLdstr(processor, message)
            .Append(processor.Create(OpCodes.Call, weaver.ModuleDefinition.ImportMethod(ReferenceFinder.DebugWriteLineMethod)), processor));
 }