public static string GetPacketIdName(ushort id, ServerType serverType)
        {
            switch (serverType)
            {
            case ServerType.Auth:
                if (Enum.IsDefined(typeof(AuthPacketId), id))
                {
                    AuthPacketId authPacketId = (AuthPacketId)id;
                    return(authPacketId.ToString());
                }

                break;

            case ServerType.Msg:
                if (Enum.IsDefined(typeof(MsgPacketId), id))
                {
                    MsgPacketId msgPacketId = (MsgPacketId)id;
                    return(msgPacketId.ToString());
                }

                break;

            case ServerType.Area:
                if (Enum.IsDefined(typeof(AreaPacketId), id))
                {
                    AreaPacketId areaPacketId = (AreaPacketId)id;
                    return(areaPacketId.ToString());
                }

                break;
            }

            if (Enum.IsDefined(typeof(CustomPacketId), id))
            {
                CustomPacketId customPacketId = (CustomPacketId)id;
                return(customPacketId.ToString());
            }

            return(null);
        }
示例#2
0
        public string GetIdName()
        {
            if (Enum.IsDefined(typeof(AuthPacketId), Id))
            {
                AuthPacketId authPacketId = (AuthPacketId)Id;
                return(authPacketId.ToString());
            }

            if (Enum.IsDefined(typeof(MsgPacketId), Id))
            {
                MsgPacketId msgPacketId = (MsgPacketId)Id;
                return(msgPacketId.ToString());
            }

            if (Enum.IsDefined(typeof(AreaPacketId), Id))
            {
                AreaPacketId areaPacketId = (AreaPacketId)Id;
                return(areaPacketId.ToString());
            }

            return(null);
        }