Пример #1
0
        internal void MarkBlockAfter(ExceptionBlock block)
        {
            if (block.blockType == ExceptionBlockType.EndExceptionBlock)
            {
                if (debug)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end handler");
                }
                il.EndExceptionBlock();
            }
        }
Пример #2
0
        internal static void MarkBlockAfter(ILGenerator il, ExceptionBlock block)
        {
            if (block.blockType == ExceptionBlockType.EndExceptionBlock)
            {
                if (Harmony.DEBUG)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(il, OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end handler");
                }
                il.EndExceptionBlock();
            }
        }
Пример #3
0
        internal void MarkBlockBefore(ExceptionBlock block, out Label?label)
        {
            label = null;
            switch (block.blockType)
            {
            case ExceptionBlockType.BeginExceptionBlock:
                if (debug)
                {
                    FileLog.LogBuffered(".try");
                    FileLog.LogBuffered("{");
                    FileLog.ChangeIndent(1);
                }
                label = il.BeginExceptionBlock();
                return;

            case ExceptionBlockType.BeginCatchBlock:
                if (debug)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end try");

                    FileLog.LogBuffered($".catch {block.catchType}");
                    FileLog.LogBuffered("{");
                    FileLog.ChangeIndent(1);
                }
                il.BeginCatchBlock(block.catchType);
                return;

            case ExceptionBlockType.BeginExceptFilterBlock:
                if (debug)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end try");

                    FileLog.LogBuffered(".filter");
                    FileLog.LogBuffered("{");
                    FileLog.ChangeIndent(1);
                }
                il.BeginExceptFilterBlock();
                return;

            case ExceptionBlockType.BeginFaultBlock:
                if (debug)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end try");

                    FileLog.LogBuffered(".fault");
                    FileLog.LogBuffered("{");
                    FileLog.ChangeIndent(1);
                }
                il.BeginFaultBlock();
                return;

            case ExceptionBlockType.BeginFinallyBlock:
                if (debug)
                {
                    // fake log a LEAVE code since BeginCatchBlock() does add it
                    LogIL(OpCodes.Leave, new LeaveTry());

                    FileLog.ChangeIndent(-1);
                    FileLog.LogBuffered("} // end try");

                    FileLog.LogBuffered(".finally");
                    FileLog.LogBuffered("{");
                    FileLog.ChangeIndent(1);
                }
                il.BeginFinallyBlock();
                return;
            }
        }