Beispiel #1
0
 public Updater(AssetService owner)
 {
     m_Owner              = owner;
     m_OnDownloadFailure  = OnDownloadFailure;
     m_OnDownloadSuccess  = OnDownloadSuccess;
     m_OnDownloadProgress = OnDownloadProgress;
 }
 public UpdateChecker(AssetModule owner)
 {
     m_Owner = owner;
     ResetStatus();
     m_OnDownloadFailure = OnDownloadFailure;
     m_OnDownloadSuccess = OnDownloadSuccess;
 }
Beispiel #3
0
    // handles a failure of cancel post-download or pre-download
    private void HandleCancel(string uri = null, string fileResultPath = null)
    {
        _endTime     = DateTime.Now.Millisecond;
        _elapsedTime = EndTime - StartTime;
        _downloading = false;

        if (uri != null)
        {
            UncompletedURLS.Add(uri);
        }
        if (AbandonOnFailure)
        {
            if (fileResultPath != null)
            {
                File.Delete(fileResultPath);
            }
            for (int i = CompletedURLPaths.Count - 1; i >= 0; i--)
            {
                File.Delete(CompletedURLPaths[i]);
            }
            for (int i = PendingURLS.Count - 1; i >= 0; i--)
            {
                UncompletedURLS.Add(PendingURLS[i]);
            }
            PendingURLS.Clear();
            _progress = 0f;
            OnDownloadFailure?.Invoke(DidFinish, uri, fileResultPath);
            return;
        }
        _progress += (1 / _initialCount);     // because this value would not be incremented otherwise
        OnDownloadFailure?.Invoke(DidFinish, uri, fileResultPath);
    }