Exemple #1
0
 /// <summary>
 /// Registers handler for op.
 /// </summary>
 /// <param name="op"></param>
 /// <param name="handler"></param>
 public void Register(int op, PacketHandlerFunc handler)
 {
     lock (this._handlers)
     {
         this._handlers[op] = handler;
     }
 }
        public void Add(int op, PacketHandlerFunc handler)
        {
            if (_handlers.ContainsKey(op))
                Log.Warning("PacketHandlerManager: Overwriting handler for '{0:X4}' with '{1}'.", op, handler.Method.DeclaringType + "." + handler.Method.Name);

            _handlers[op] = handler;
        }
Exemple #3
0
        /// <summary>
        /// Adds and/or overwrites handler.
        /// </summary>
        /// <param name="op"></param>
        /// <param name="handler"></param>
        public void Add(int op, PacketHandlerFunc handler)
        {
            if (_handlers.ContainsKey(op))
            {
                Log.Warning("PacketHandlerManager: Overwriting handler for '{0:X4}' with '{1}'.", op, handler.Method.DeclaringType + "." + handler.Method.Name);
            }

            _handlers[op] = handler;
        }
 /// <summary>
 /// 添加一个处理数据的模块
 /// </summary>
 /// <param name="op"></param>
 /// <param name="handler"></param>
 public void Add(byte op, PacketHandlerFunc handler)
 {
     _handlers[op] = handler;
 }