コード例 #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));
 }
コード例 #2
0
ファイル: CecilExtensions.cs プロジェクト: rawman/Tracy.Fody
 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));
 }
コード例 #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);
        }
コード例 #4
0
ファイル: WeaveHelper.cs プロジェクト: clawit/Cache
        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);
        }
コード例 #5
0
ファイル: WeaveHelper.cs プロジェクト: clawit/Cache
 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));
 }