Example #1
0
 public void BeginUnzip()
 {
     ABCheck.Instance.EnterInvoke(() =>
     {
         unzipCount++;
         curUnzipTask = null;
         unzipprocess = -1;
         UnzipCountProcess(unzipCount);
         foreach (var task in unzipTaskList.Values)
         {
             if (task.UnzipProcess < 1)
             {
                 curUnzipTask = task;
                 curUnzipTask.Start();
                 break;
             }
         }
         // 解压完成
         if (null == curUnzipTask)
         {
             if (null != unzipResult)
             {
                 unzipResult(true, null);
             }
         }
     });
 }
Example #2
0
 public void InitUnzip()
 {
     // 置空当前处理对象
     unzipTaskList.Clear();
     unzipCountProcess = null;
     unzipProcess      = null;
     unzipResult       = null;
     curUnzipTask      = null;
     unzipCount        = 0;
     zipCount          = 0;
 }
Example #3
0
        public DownloadTask(string _remoteUrl, string _localFolder, string _fileName, string _fileSuffix, long _fileSize, bool _isZipFile = true, long?_unZipSize = null, bool _isDeleteZip = true)
        {
            remoteUrl     = _remoteUrl;
            localFolder   = _localFolder;
            downloadSize  = 0;
            fileSize      = _fileSize;
            fileTempPath  = string.Format("{0}/{1}{2}", _localFolder, _fileName, ".temp");
            fileLocalPath = string.Format("{0}/{1}{2}", _localFolder, _fileName, _fileSuffix);

            if (_isZipFile)
            {
                unzipTask = new UnzipTask(localFolder, fileLocalPath, _fileName, _fileSize, _unZipSize, _isDeleteZip);
            }
        }
Example #4
0
        public bool CreateUnzipTask(string _localFolder, string _zipFilePath, string _zipFileName, long?_zipFileSize = null, long?_unZipFileSize = null, bool _isDeleteZip = true)
        {
            if (unzipTaskList.ContainsKey(_zipFilePath))
            {
                return(false);
            }

            UnzipTask task = new UnzipTask(_localFolder, _zipFilePath, _zipFileName, _zipFileSize, _unZipFileSize, _isDeleteZip);

            task.SetAction(UnzipError, UnzipProcess, BeginUnzip);
            unzipTaskList.Add(_zipFilePath, task);
            zipCount = unzipTaskList.Count;
            zipZone  = (int)(1 / (float)zipCount * 10000) * 0.0001f;

            return(true);
        }