Example #1
0
        public void StoragePermission(string s)
        {
            downloadOperation = BackgroundDownloads.GetDownloadOperation("https://qianxi.fahaxiki.cn/AB/OnlineAB/AF-ABForServer/APPInfo.txt");
            BackgroundDownloadOptions backgroundDownloadOptions = new BackgroundDownloadOptions("https://qianxi.fahaxiki.cn/AB/OnlineAB/AF-ABForServer/APPInfo.txt", PathTool.PersistentDataPath + "APPInfo.txt");

            if (downloadOperation == null ||
                (downloadOperation != null && downloadOperation.Status == DownloadStatus.Successful))
            {
                downloadOperation = BackgroundDownloads.StartDownload(backgroundDownloadOptions);
            }
            else if (downloadOperation != null && downloadOperation.Status != DownloadStatus.Successful)
            {
                //断点续存
                downloadOperation = BackgroundDownloads.StartOrContinueDownload(backgroundDownloadOptions);
            }
            Debug.Log("downloadOperation是否为空:" + (downloadOperation == null));
        }
Example #2
0
        public void StartWebRequest()
        {
            WebRequestCount = 1;
            if (string.IsNullOrEmpty(httpInfo.m_srcUrl))
            {
                downResult = DownStatus.Fail;
                downError  = "下载地址为空";
                DownloadFinish();
                return;
            }
            if (string.IsNullOrEmpty(httpInfo.m_savePath))
            {
                downResult = DownStatus.Fail;
                downError  = "保存地址为空";
                DownloadFinish();
                return;
            }
            m_saveFilePath = httpInfo.m_savePath;
            if (WebRequestCount == 1)
            {
                LastPro = GetProcess();
            }

            FileHelper.DeleteFile(m_saveFilePath);
            downloadOperation = BackgroundDownloads.GetDownloadOperation(httpInfo.m_srcUrl);
            BackgroundDownloadOptions backgroundDownloadOptions = new BackgroundDownloadOptions(httpInfo.m_srcUrl, m_saveFilePath);

            if (downloadOperation == null ||
                (downloadOperation != null && downloadOperation.Status != DownloadStatus.Paused))
            {
                downloadOperation = BackgroundDownloads.StartDownload(backgroundDownloadOptions);
            }
            else if (downloadOperation != null && downloadOperation.Status == DownloadStatus.Paused)
            {
                //断点续存
                downloadOperation = BackgroundDownloads.StartOrContinueDownload(backgroundDownloadOptions);
            }
            m_isStartDownload = true;
        }