Пример #1
0
        /// <summary>
        ///   开始进行主要文件下载,下载至缓存目录
        /// </summary>
        IEnumerator StartDownloadMainConfig()
        {
            if (ErrorCode != emErrorCode.None)
            {
                yield break;
            }

            //下载主配置文件
            for (int i = 0; i < Common.MAIN_CONFIG_NAME_ARRAY.Length; ++i)
            {
                file_download_ = new FileDownload(current_url_
                                                  , Common.CACHE_PATH
                                                  , Common.MAIN_CONFIG_NAME_ARRAY[i]);
                file_download_.Start();
                while (!file_download_.IsDone)
                {
                    yield return(null);
                }
                if (file_download_.IsFailed)
                {
                    Error(emErrorCode.DownloadMainConfigFileFailed
                          , Common.MAIN_CONFIG_NAME_ARRAY[i] + " download failed!");
                    yield break;
                }
                file_download_ = null;
                UpdateCompleteValue(i, Common.MAIN_CONFIG_NAME_ARRAY.Length);
            }

            yield return(null);
        }
Пример #2
0
    /// <summary>
    ///   开始进行主要文件下载,下载至缓存目录
    /// </summary>
    IEnumerator StartDownloadMainConfig()
    {
        Debug.Log("AssetUpdater:StartDownloadMainConfig");
        if (ErrorCode != EmErrorCode.None)
        {
            yield break;
        }
        //下载主配置文件
        _file_download = new FileDownload(_current_ab_url
                                          , DownLoadCommon.CACHE_PATH
                                          , DownLoadCommon.MAIN_MANIFEST_FILE_NAME);
        _file_download.Start();
        while (!_file_download.IsDone)
        {
            yield return(null);
        }
        if (_file_download.IsFailed)
        {
            Error(EmErrorCode.DownloadMainConfigFileFailed
                  , DownLoadCommon.MAIN_MANIFEST_FILE_NAME + " download failed!");
            yield break;
        }
        _file_download = null;
        UpdateCompleteValue(1f, 1f);

        yield return(null);
    }
Пример #3
0
 IEnumerator StartDownLuaZip()
 {
     Debug.Log("AssetUpdater:StartDownLuaZip");
     if (ErrorCode != EmErrorCode.None)
     {
         yield break;
     }
     //下载主配置文件
     _file_download = new FileDownload(_current_url
                                       , DownLoadCommon.CACHE_PATH
                                       , "/LuaScript.zip");
     _file_download.Start();
     while (!_file_download.IsDone)
     {
         UpdateCompleteValue(_file_download.CompletedSize, _file_download.TotalSize);
         yield return(null);
     }
     if (_file_download.IsFailed)
     {
         Error(EmErrorCode.DownloadFailed
               , " download luazip failed!");
         yield break;
     }
     _file_download = null;
     UpdateCompleteValue(1f, 1f);
 }
Пример #4
0
        /// <summary>
        ///   开始进行主要文件下载,下载至缓存目录
        /// </summary>
        IEnumerator UpdatingDownloadAllConfig()
        {
            if (ErrorCode != emErrorCode.None)
            {
                yield break;
            }

            //下载主配置文件
            for (int i = 0; i < Common.CONFIG_NAME_ARRAY.Length; ++i)
            {
                file_download_ = new FileDownload(current_url_
                                                  , Common.UPDATER_CACHE_PATH
                                                  , Common.CONFIG_NAME_ARRAY[i]);
                file_download_.Start();
                while (!file_download_.IsDone)
                {
                    yield return(null);
                }
                if (file_download_.IsFailed)
                {
                    if (Common.CONFIG_REQUIRE_CONDITION_ARRAY[i])
                    {
                        Error(emErrorCode.DownloadMainConfigFileFailed
                              , Common.CONFIG_NAME_ARRAY[i] + " download failed!");
                        yield break;
                    }

                    if (file_download_.ErrorCode == HttpAsyDownload.emErrorCode.DiskFull)
                    {
                        Error(emErrorCode.DiskFull);
                        yield break;
                    }
                }
                file_download_ = null;
                UpdateCompleteValue(i, Common.CONFIG_NAME_ARRAY.Length);
            }

            yield return(null);
        }
Пример #5
0
 async void item_DoubleClick(object sender, EventArgs e)
 {
     var item = (CloudFiles)((FileTile)sender).Tag;
     if(item.DoubleClick())
     {
         SaveFileDialog filedialog = new SaveFileDialog();
         var result = filedialog.ShowDialog();
         if(result != System.Windows.Forms.DialogResult.OK)
         {
             return;
         }
         System.IO.Stream stream = await item.GetSteam();
         down = new FileDownload(filedialog.FileName, stream, (long)item.GetFileSize());
         down.StreamCompleteCallback += down_StreamCompleteCallback;
         down.StreamControlCallBack += down_StreamControlCallBack;
         down.StreamProgressCallback += down_StreamProgressCallback;
         down.Start();
     }
     else
     {
         NavigateToItem(item);
     }
 }