AsmResolver.Net.Msil.MethodBody.WriteExceptionHandlers C# (CSharp) Method

WriteExceptionHandlers() private method

private WriteExceptionHandlers ( WritingContext context ) : void
context WritingContext
return void
        private void WriteExceptionHandlers(WritingContext context)
        {
            var useFatFormat = ExceptionHandlers.Any(x => x.IsFatFormatRequired);
            var writer = context.Writer;

            writer.Align(4);

            writer.WriteByte((byte)(0x01 | (useFatFormat ? 0x40 : 0)));
            if (useFatFormat)
            {
                var byteLength = ExceptionHandlers.Count * 24;
                writer.WriteByte((byte)(byteLength & 0xFF));
                writer.WriteByte((byte)((byteLength & 0xFF00) >> 0x08));
                writer.WriteByte((byte)((byteLength & 0xFF0000) >> 0x10));
            }
            else
            {
                writer.WriteByte((byte)(ExceptionHandlers.Count * 12));
                writer.WriteUInt16(0);
            }

            foreach (var handler in ExceptionHandlers)
            {
                handler.IsFat = useFatFormat;
                handler.Write(context);
            }
        }