コード例 #1
0
        public SingleID_List GetMessageS_Sigle_ByID(int id)
        {
            SingleID_List r = null;

            for (int i = 0; i < Single_List_By_ID.Count; i++)
            {
                if (Single_List_By_ID[i].ID == id)
                {
                    r = Single_List_By_ID[i];


                    #region //补充心跳
                    for (int iC = 0; iC < YingHeXinList.Count; iC++)
                    {
                        if (YingHeXinList[iC].ID == id)
                        {
                            YingHeXinList[iC].Web_Heart++;//web心跳
                            break;
                        }
                    }
                    #endregion

                    break;
                }
            }
            return(r);
        }
コード例 #2
0
        /// <summary>
        /// 单一模型制作
        /// 参数true是添加数据,false为清除数据
        /// 2020年5月14日11:17:41
        /// </summary>
        /// <param name="InOrOut">true In false out</param>
        /// <param name="id">id</param>
        /// <param name="message">数据</param>
        /// <param name="time"></param>
        private void MakeSingleData(bool InOrOut, int id, string message, string time)
        {
            //先找
            bool canfind = false;
            int  index   = -1;

            for (int i = 0; i < Single_List_By_ID.Count; i++)
            {
                if (Single_List_By_ID[i].ID == id)
                {
                    canfind = true;
                    index   = i;
                    break;
                }
            }

            //再看是进还是出
            if (InOrOut)
            {
                //入
                if (canfind)
                {
                    //原来就有
                    Single_List_By_ID[index].ReceivedDataList.Add(message);
                    Single_List_By_ID[index].Times.Add(time);

                    //多余1000行去除
                    if (Single_List_By_ID[index].ReceivedDataList.Count > 1000)
                    {
                        Single_List_By_ID[index].ReceivedDataList.RemoveAt(0);
                    }
                }
                else
                {
                    //原来没有,需要创建
                    SingleID_List temp = new SingleID_List();
                    temp.ID = id;
                    temp.ReceivedDataList.Add(message);
                    temp.Times.Add(time);
                    Single_List_By_ID.Add(temp);
                }
            }
            else
            {
                //出
                if (canfind)
                {
                    Single_List_By_ID.RemoveAt(index);
                }
                else
                {
                    //原先就没有,无需操作。
                }
            }
        }