public override void OnParseMessage(object receiver, BasicReader reader, MessageParsingOutput output) { reader.SetPosition(0); while (reader.UnreadedLength > 0) { var msgId = reader.GetUShort(); var msgSize = reader.GetLong(); if (reader.UnreadedLength < msgSize) { break; } try { var message = CreateMessage(msgId); if (message == null) { throw new UnknownMessageException(msgId); } message.Deserialize(reader); output.AddOutput(message); } catch (Exception ex) { throw new DefaultProtocolFailedParsingMessageException(ex.Message); } reader.RemoveReadedBytes(); } }
public void Deserialize(BasicReader reader) { Id = reader.GetInt(); Title = reader.GetString(); Details = reader.GetString(); Time = new DateTime(reader.GetLong()); Color = ColorTranslator.FromWin32(reader.GetInt()); RepeatDaily = reader.GetBool(); }