예제 #1
0
파일: Form1.cs 프로젝트: jjfsq1985/StudyLab
        public void EditLstObj(VersionObject newObj)
        {
            bool bFind = false;
            for (int i = 0; i < m_lstLocalVersion.Count; i++)
            {
                if(newObj.eType == m_lstLocalVersion[i].eType)
                {
                    bFind = true;
                    if(newObj.strVersion == m_lstLocalVersion[i].strVersion)
                    {
                        break;
                    }
                    else
                    {
                        m_lstLocalVersion[i].strVersion = newObj.strVersion;
                        m_lstLocalVersion[i].bUpdated = false;
                        m_lstLocalVersion[i].nFileOffset = 0;
                        m_lstLocalVersion[i].nFileSize = 0;

                        break;
                    }
                }
            }
            if(!bFind)
            {
                m_lstLocalVersion.Add(newObj);
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: jjfsq1985/StudyLab
        public void ParseUdpData(byte[] TcpData)
        {
            List<VersionObject> allUpdate = new List<VersionObject>();

            int i = 0;
            while (i < TcpData.Length)
            {
                byte eType = TcpData[i];
                byte VerLen = TcpData[i + 1];
                string strVer = Encoding.ASCII.GetString(TcpData, i + 2, VerLen);

                VersionObject obj = new VersionObject();
                obj.eType = (UpdateFileType)eType;
                obj.strVersion = strVer;
                allUpdate.Add(obj);
                i += VerLen + 2;
            }
            if (allUpdate.Count <= 0)
                return;
            for (i = 0; i < allUpdate.Count; i++)
            {
                EditLstObj(allUpdate[i]);
            }
            if (!m_bUpdating)
            {
                for (i = 0; i < m_lstLocalVersion.Count; i++)
                {
                    if (!m_lstLocalVersion[i].bUpdated)
                    {
                        m_bWantConnect = true;
                        break;
                    }
                }
            }
        }