void ReceiveMessageConnection(byte[] data, IPEndPoint source) { try { MemoryStream memoryStream = new MemoryStream(data); BinaryReader reader = new SafeBinaryReader(memoryStream); MessageType type = (MessageType)reader.ReadByte(); Message msg = new Message { Source = source, Reader = reader, Stream = memoryStream, Type = type, }; if (type == MessageType.ClientHello || type == MessageType.Disconnected) { ProcessMessage(msg); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public override void LoadValue(SafeBinaryReader reader) { try { _fields[_fieldIndex] = reader.ReadStringSafe(); } catch (EndOfStreamException) { throw new StringCorruptedException("There is end of stream while reading string"); } }
public override void LoadValue(SafeBinaryReader reader) { long ticks = reader.ReadInt64(); try { _fields[_fieldIndex] = new DateTime(ticks); } catch (ArgumentOutOfRangeException exception) { _fields[_fieldIndex] = DateTime.MinValue; Tracer._TraceException(exception); throw new DateTimeCorruptedException("Invalid DateTime ticks value: " + ticks); } }
public override void LoadValue(SafeBinaryReader reader) { int length = reader.ReadInt32(); if (length == 0) { _fields[_fieldIndex] = string.Empty; } else { try { _fields[_fieldIndex] = reader.ReadStringSafeWithoutLength(length); } catch (EndOfStreamException) { throw new StringCorruptedException(); } } if (reader.ReadUInt32() != END_MARKER) { throw new NoEndMarkerException("String property has no end marker"); } }
public abstract void LoadValue(SafeBinaryReader reader);
public override void LoadValue(SafeBinaryReader reader) { _fields[_fieldIndex] = IntInternalizer.Intern(reader.ReadInt32()); }
public override void LoadValue(SafeBinaryReader reader) { string blobID = reader.ReadString(); _fields[_fieldIndex] = new BLOB(_table, blobID); }