예제 #1
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;
        }