示例#1
0
    private bool CheckTreeNodeValid(TdirTreeNode node)
    {
        IPAddress address;

        if (node.staticInfo.cltAttr1 == 0)
        {
            return(false);
        }
        object param = new object();
        int    num   = 0;

        if (IPAddress.TryParse(GameFramework.AppVersion, out address))
        {
            num = BitConverter.ToInt32(address.GetAddressBytes(), 0);
        }
        else
        {
            return(true);
        }
        if (this.GetTreeNodeAttr(node, TdirNodeAttrType.versionDown, ref param) && (((int)param) > num))
        {
            return(false);
        }
        if (this.GetTreeNodeAttr(node, TdirNodeAttrType.versionUp, ref param) && (((int)param) < num))
        {
            return(false);
        }
        return(true);
    }
示例#2
0
 private bool CreateSvrGroup(TdirTreeNode node, ref TdirSvrGroup group)
 {
     if (!this.CheckTreeNodeValid(node))
     {
         return(false);
     }
     group.nodeID   = node.nodeID;
     group.name     = node.name;
     group.appAttr  = node.staticInfo.appAttr;
     group.tdirUrls = new List <TdirUrl>();
     return(true);
 }
示例#3
0
    private bool CheckTreeNodeValid(TdirTreeNode node)
    {
        if (node.staticInfo.cltAttr1 == 0)
        {
            return(false);
        }
        object    obj = new object();
        IPAddress iPAddress;

        if (IPAddress.TryParse(GameFramework.AppVersion, ref iPAddress))
        {
            int num = BitConverter.ToInt32(iPAddress.GetAddressBytes(), 0);
            return((!this.GetTreeNodeAttr(node, TdirNodeAttrType.versionDown, ref obj) || (int)obj <= num) && (!this.GetTreeNodeAttr(node, TdirNodeAttrType.versionUp, ref obj) || (int)obj >= num));
        }
        return(true);
    }
示例#4
0
    private void CheckIOSVersion()
    {
        IPAddress address;

        if (IPAddress.TryParse(GameFramework.AppVersion, out address))
        {
            int    num   = BitConverter.ToInt32(address.GetAddressBytes(), 0);
            object param = 0;
            for (int i = 0; i < this.mTreeNodes.Count; i++)
            {
                TdirTreeNode node = this.mTreeNodes[i];
                if (this.ParseNodeAppAttr(node.staticInfo.appAttr, TdirNodeAttrType.versionOnlyExcept, ref param) && (((int)param) == num))
                {
                    mIsIOSCheckVersion = true;
                    break;
                }
            }
        }
    }
示例#5
0
    private void ParseNodeInfo()
    {
        if (this.mTreeNodes != null)
        {
            object param = new object();
            for (int i = 0; i < this.mTreeNodes.Count; i++)
            {
                TdirTreeNode node = this.mTreeNodes[i];
                if (this.GetIPPosByNodeID(node.nodeID, 0) != this.mCurrentNodeIDFirst)
                {
                    continue;
                }
                TdirUrl tdirUrl = new TdirUrl();
                if (!this.CreateSvrUrl(this.mTreeNodes[i], ref tdirUrl))
                {
                    continue;
                }
                if (tdirUrl.roleCount != 0)
                {
                    this.mOwnRoleList.tdirUrls.Add(tdirUrl);
                }
                if (tdirUrl.flag != SvrFlag.Recommend)
                {
                    TdirTreeNode node2 = this.mTreeNodes[i];
                    if (!this.ParseNodeAppAttr(node2.staticInfo.appAttr, TdirNodeAttrType.recommond, ref param) || (((int)param) == 0))
                    {
                        goto Label_00D9;
                    }
                }
                this.mRecommondUrlList.tdirUrls.Add(tdirUrl);
Label_00D9:
                if ((tdirUrl.roleCount > 0) && (this.mLastLoginUrl.lastLoginTime < tdirUrl.lastLoginTime))
                {
                    this.mLastLoginUrl = tdirUrl;
                }
                TdirTreeNode node3 = this.mTreeNodes[i];
                if (node3.parentID != 0)
                {
                    TdirTreeNode node4 = this.mTreeNodes[i];
                    if (node4.nodeType == 0)
                    {
                        TdirSvrGroup group = new TdirSvrGroup();
                        if (this.CreateSvrGroup(this.mTreeNodes[i], ref group))
                        {
                            this.mSvrListGroup.Add(group);
                        }
                    }
                    else
                    {
                        bool flag = false;
                        for (int j = 0; j < this.mSvrListGroup.Count; j++)
                        {
                            TdirTreeNode node5  = this.mTreeNodes[i];
                            TdirSvrGroup group3 = this.mSvrListGroup[j];
                            if (node5.parentID == group3.nodeID)
                            {
                                TdirSvrGroup group4 = this.mSvrListGroup[j];
                                group4.tdirUrls.Add(tdirUrl);
                                flag = true;
                            }
                        }
                        if (!flag)
                        {
                            for (int k = 0; k < this.mTreeNodes.Count; k++)
                            {
                                TdirTreeNode node6 = this.mTreeNodes[i];
                                TdirTreeNode node7 = this.mTreeNodes[k];
                                if (node6.parentID == node7.nodeID)
                                {
                                    TdirSvrGroup group2 = new TdirSvrGroup();
                                    if (this.CreateSvrGroup(this.mTreeNodes[k], ref group2))
                                    {
                                        group2.tdirUrls.Add(tdirUrl);
                                        this.mSvrListGroup.Add(group2);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
示例#6
0
 public bool GetTreeNodeAttr(TdirTreeNode node, TdirNodeAttrType attrType, ref object param)
 {
     return(this.ParseNodeAppAttr(node.staticInfo.appAttr, attrType, ref param));
 }
示例#7
0
    private bool CreateSvrUrl(TdirTreeNode node, ref TdirUrl tdirUrl)
    {
        string connectUrl = node.dynamicInfo.connectUrl;

        if (string.IsNullOrEmpty(connectUrl))
        {
            return(false);
        }
        if (!this.CheckTreeNodeValid(node))
        {
            return(false);
        }
        tdirUrl.nodeID = node.nodeID;
        tdirUrl.name   = node.name;
        tdirUrl.statu  = (TdirSvrStatu)node.status;
        if ((tdirUrl.statu == TdirSvrStatu.FINE) || (tdirUrl.statu == TdirSvrStatu.HEAVY))
        {
            tdirUrl.flag = (SvrFlag)node.svrFlag;
        }
        else
        {
            tdirUrl.flag = SvrFlag.NoFlag;
        }
        tdirUrl.mask  = node.staticInfo.bitmapMask;
        tdirUrl.addrs = new List <IPAddrInfo>();
        tdirUrl.attr  = node.staticInfo.appAttr;
        if (node.userRoleInfo != null)
        {
            tdirUrl.roleCount = (uint)node.userRoleInfo.Count;
            uint lastLoginTime = 0;
            for (int j = 0; j < node.userRoleInfo.Count; j++)
            {
                TdirUserRoleInfo info3 = node.userRoleInfo[j];
                if (info3.lastLoginTime > lastLoginTime)
                {
                    TdirUserRoleInfo info4 = node.userRoleInfo[j];
                    lastLoginTime = info4.lastLoginTime;
                }
            }
            tdirUrl.lastLoginTime = lastLoginTime;
        }
        else
        {
            tdirUrl.roleCount     = 0;
            tdirUrl.lastLoginTime = 0;
        }
        char[]   separator = new char[] { ';' };
        string[] strArray  = connectUrl.Split(separator);
        if (strArray == null)
        {
            return(false);
        }
        for (int i = 0; i < strArray.Length; i++)
        {
            char[]   chArray2  = new char[] { ':' };
            string[] strArray2 = strArray[i].Split(chArray2);
            for (int k = 1; k < strArray2.Length; k++)
            {
                if (strArray2[k].IndexOf('-') >= 0)
                {
                    int      num5;
                    int      num6;
                    char[]   chArray3  = new char[] { '-' };
                    string[] strArray3 = strArray2[k].Split(chArray3);
                    if (((strArray3.Length == 2) && int.TryParse(strArray3[0], out num5)) && (int.TryParse(strArray3[1], out num6) && (num5 <= num6)))
                    {
                        int num7 = (num6 - num5) + 1;
                        for (int m = 0; m < num7; m++)
                        {
                            int        num9 = num5 + m;
                            IPAddrInfo item = new IPAddrInfo {
                                ip   = strArray2[0],
                                port = num9.ToString()
                            };
                            tdirUrl.addrs.Add(item);
                        }
                    }
                }
                else
                {
                    IPAddrInfo info2 = new IPAddrInfo {
                        ip   = strArray2[0],
                        port = strArray2[k]
                    };
                    tdirUrl.addrs.Add(info2);
                }
            }
        }
        object param = null;

        if (this.ParseNodeAppAttr(tdirUrl.attr, TdirNodeAttrType.LogicWorldID, ref param))
        {
            tdirUrl.logicWorldID = (int)param;
        }
        else
        {
            tdirUrl.logicWorldID = 0;
        }
        return(true);
    }