예제 #1
0
        public void AddRecord(string name, string md5, int fileSize, long buildTime)
        {
            OpenRecordFileStream(true);

            if (m_RecordFileStream == null)
            {
                return;
            }

            try
            {
                string writeData      = string.Format("{0}:{1}:{2}:{3}\n", name, md5, fileSize, buildTime);
                byte[] writeDataArray = UTF8Encoding.UTF8.GetBytes(writeData);
                m_RecordFileStream.Write(writeDataArray, 0, writeDataArray.Length);

                m_RecordFileStream.Flush();

                RecordCell cell = new RecordCell();
                cell.SetData(name, md5, fileSize, buildTime);
                m_UpdateRecordList.Add(cell);
            }
            catch (Exception e)
            {
                Log.e(e);
            }
        }
예제 #2
0
        public void Load()
        {
            OpenRecordFileStream(false);

            if (m_RecordFileStream == null)
            {
                return;
            }

            try
            {
                m_UpdateRecordList.Clear();

                if (m_RecordFileStream.Length <= 0)
                {
                    return;
                }

                byte[] byteData = new byte[m_RecordFileStream.Length];

                m_RecordFileStream.Read(byteData, 0, byteData.Length);

                string context = UTF8Encoding.UTF8.GetString(byteData);
                if (string.IsNullOrEmpty(context))
                {
                    return;
                }

                string[] msgs = context.Split('\n');

                for (int i = 0; i < msgs.Length; ++i)
                {
                    if (string.IsNullOrEmpty(msgs[i]))
                    {
                        continue;
                    }

                    string[] param = msgs[i].Split(':');

                    if (param == null || param.Length < 4)
                    {
                        continue;
                    }

                    RecordCell cell = new RecordCell();
                    cell.SetData(param);
                    m_UpdateRecordList.Add(cell);
                }
            }
            catch (Exception e)
            {
                Log.e(e);
            }
        }
예제 #3
0
        private void SetSerizlizeData(string data)
        {
            string[] values = data.Split('|');

            for (int i = 0; i < values.Length; ++i)
            {
                if (string.IsNullOrEmpty(values[i]))
                {
                    continue;
                }

                RecordCell cell = new RecordCell();
                cell.SetData(values[i]);

                m_DataMap.Add(cell.key, cell);
            }
        }