BattleNet.GameServer.GetChatPacketSize C# (CSharp) Method

GetChatPacketSize() private method

private GetChatPacketSize ( List input, Int32 &output ) : bool
input List
output System.Int32
return bool
        bool GetChatPacketSize(List<byte> input, out Int32 output)
        {
            output = 0;
            if(input.Count < 12)
                return false;

            const Int32 initial_offset = 10;

            Int32 name_offset = input.IndexOf(0,initial_offset);

            if(name_offset == -1)
                return false;

            name_offset -= initial_offset;

            Int32 message_offset = input.IndexOf(0,initial_offset + name_offset + 1);

            if(message_offset == -1)
                return false;

            message_offset = message_offset - initial_offset - name_offset -1;

            output = initial_offset + name_offset + 1 + message_offset + 1;

            return true;
        }