public ServerSession() { connections = new Dictionary<Socket, int>(); connecting = new List<Socket>(); msgTypes = new INetMessageType[256]; msgTypes[0] = new SignalType(0, true); msgTypes[2] = new NameChangeType(2, true); msgTypes[3] = new SignalType(3, true); msgTypes[6] = new ChatType(6, true); }
public NetTypeEventArgs(byte id, INetMessageType handler, object data) { Handler = handler; FormattedData = data; ClientID = id; }
/// <summary> /// Note: /// ID 0-10 will mostly be populated internally /// Exceptions: /// InvalidOperationException /// </summary> /// <param name="msg"></param> /// <param name="type"></param> public void AddMessageType(INetMessageType type) { if (msgTypes[type.MessageType] != null) throw new InvalidOperationException("ID " + type.MessageType + " is being used by " + msgTypes[type.MessageType].ToString()); msgTypes[type.MessageType] = type; }