Exemple #1
0
        private void startSendListData(List <byte[]> sourBts, int index, int endIndex, string cardID)
        {
            if (endIndex < index || sourBts == null)
            {
                return;
            }

            long timeOut = long.MaxValue;

            byte[] zeroBt = new byte[2] {
                0, 0
            };
            List <CardUpDataBean> cardBeans = new List <CardUpDataBean>();

            for (int i = index; i <= endIndex; i++)
            {
                if (sourBts[i].Length < 16)
                {
                    continue;
                }
                string sourCardID = sourBts[i][2].ToString("X2") + sourBts[i][3].ToString("X2");
                if (!sourCardID.Equals(cardID) && !checkBox1.Checked)
                {
                    continue;
                }
                CardUpDataBean cardBean = new CardUpDataBean(sourBts[i]);
                if (cardBean.FirstReceiveTime > endTime)
                {
                    continue;
                }
                if (cardBean.FirstReceiveTime - timeOut > FileModel.getFlModel().ChFlBean.NoReveTime)
                {
                    totalCount = 0;
                    lostCount  = 0;
                }
                if (index_card > -1)
                {
                    if (index_card + 1 != cardBean.Index && index_card != 255 && cardBean.Index > index_card)
                    {
                        lostCount += cardBean.Index - index_card;
                    }
                    else if (index_card == 255 && cardBean.Index > 0)
                    {
                        lostCount += cardBean.Index;
                    }
                }
                index_card = cardBean.Index;
                if (!XWUtils.byteBTBettow(cardBean.Port1IDHistory, zeroBt))
                {
                    totalCount += 1;
                }
                cardBean.TotalCount = totalCount;
                cardBean.LostCount  = lostCount;
                cardBeans.Add(cardBean);
            }

            locaViewFrom.setHisData(cardBeans, CardUpType.HISTORY_DATA);
        }
Exemple #2
0
        private int serchErFen(CardUpDataBean c, List <CardUpDataBean> addInt)
        {
            if (c == null || addInt == null)
            {
                return(0);
            }
            int low    = 0;
            int height = addInt.Count;

            while (low < height)
            {
                int mid = (low + height) / 2;
                if (addInt[mid].Port1IDStr.Equals(c.Port1IDStr))
                {
                    return(mid);
                }
                else if (getIDLength(c.Port1ID) > getIDLength(addInt[mid].Port1ID))
                {
                    if (low != mid)
                    {
                        low = mid;
                    }
                    else
                    {
                        low++;
                    }
                }
                else
                {
                    if (height != mid)
                    {
                        height = mid;
                    }
                    else
                    {
                        height--;
                    }
                }
            }
            return(-1);
        }