示例#1
0
        /// <summary>
        /// 下载完成
        /// </summary>
        void DownloadSucceed(string file_name)
        {
            lock (lock_obj_)
            {
                bool   is_compress = Compress.IsCompressFile(file_name);
                string assetbundle = is_compress ?
                                     Compress.GetDefaultFileName(file_name) : file_name;

                if (ImcompleteDownloads.Contains(assetbundle))
                {
                    ImcompleteDownloads.Remove(assetbundle);
                }
                CompleteDownloads.Add(assetbundle);

                //判断是否需要解压文件
                if (is_compress)
                {
                    // 解压文件
                    string in_file  = Root + "/" + file_name;
                    string out_file = Root + "/" + assetbundle;
                    Compress.DecompressFile(in_file, out_file);
                    // 删除压缩包
                    System.IO.File.Delete(in_file);
                }
            }
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 void _DownloadError(HttpAsyDownload d)
 {
     lock (lock_obj_)
     {
         //从未下载列表中移除
         if (ImcompleteDownloads.Contains(d.LocalName))
         {
             ImcompleteDownloads.Remove(d.LocalName);
         }
         //加入失败列表
         FailedDownloads.Add(d.LocalName);
         DownloadAll();
         UpdateState();
     }
 }