GameRevision.GW2Emu.Common.Serialization.Deserializer.IsEmpty C# (CSharp) Method

IsEmpty() public method

public IsEmpty ( ) : bool
return bool
        public bool IsEmpty()
        {
            return base.BaseStream.Position >= base.BaseStream.Length -1;
        }

Usage Example

Beispiel #1
0
        public IEnumerable<IMessage> CreateMessages(byte[] data)
        {
            var deserializer = new Deserializer(data);

            // template method call
            var message = this.CreateEmptyMessage((ushort) deserializer.ReadInt16());

            // TODO: implement stream chopping and stream combination here somhow, or in the Deserializer

            // check if the data is enough, in that case return and save the data in between or something

            message.Deserialize(deserializer);

            // check if we got leftover data
            // or simply return the message we just read
            if (deserializer.IsEmpty()) { return new List<IMessage> { message }; }

            // else invoke this method with the leftover data, and add the messages to the list of messages
            // maybe yield the messages one after another?
            return new List<IMessage>();
        }