ArtemisComm.GameMessagePacket.GameMessagePacket C# (CSharp) Method

GameMessagePacket() public method

public GameMessagePacket ( Stream stream, int index ) : ArtemisComm.GameMessageSubPackets
stream Stream
index int
return ArtemisComm.GameMessageSubPackets
        public GameMessagePacket(Stream stream, int index)
        {
            try
            {
                if (stream != null)
                {
                    if (stream.CanSeek)
                    {
                        stream.Position = index;
                    }
                    if (stream.Length > 3)
                    {
                        SubPacketType = (GameMessageSubPacketType)stream.ToInt32();
                       
                    }
                    if (stream.Length >= 4)
                    {
                        SubPacketData = stream.GetMemoryStream(index + 4);

                     
                        _subPacket = GetSubPacket(stream, index + 4);
                    }
                    else
                    {
                        _subPacket = null;
                        SubPacketData = null;
                    }
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex);
            }
        }
        //IPackage GetSubPacket(byte[] byteArray)