コード例 #1
0
 /// <summary>
 /// 将序列化文件中字段信息赋值到类DownloadCheckPoint中的字段
 /// </summary>
 /// <param name="temp"></param>
 public void Assign(DownloadCheckPoint temp)
 {
     this.BucketName    = temp.BucketName;
     this.ObjectKey     = temp.ObjectKey;
     this.DownloadFile  = temp.DownloadFile;
     this.VersionId     = temp.VersionId;
     this.Md5           = temp.Md5;
     this.ObjectStatus  = temp.ObjectStatus;
     this.TmpFileStatus = temp.TmpFileStatus;
     this.DownloadParts = temp.DownloadParts;
 }
コード例 #2
0
        /// <summary>
        /// 加载序列化记录文件
        /// </summary>
        public void Load(string checkPointFile)
        {
            try
            {
                DownloadCheckPoint temp       = null;
                XmlSerializer      serializer = new XmlSerializer(this.GetType());

                using (XmlTextReader fs = new XmlTextReader(checkPointFile))
                {
                    temp = (DownloadCheckPoint)serializer.Deserialize(fs);
                }
                Assign(temp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }