internal void OnNetworkStream(Network.ByteInStream stream) { #if !DEBUG try { #endif while (stream.Stream.CanRead) { byte handlerId = stream.ReadByte(); IPacketHandler handler = packetHandlers[handlerId]; if (handler == null) { log.Error("No packet handler for id #{0} found, can't process byte stream", handlerId); return; } if (!handler.OnPacket(handlerId, this, stream)) { log.Error("Handler '{0}' failed processing byte stream", handler.GetType().GetPrettyName()); return; } } #if !DEBUG } catch (Exception exn) { log.Error(exn); } #endif }