Beispiel #1
0
 private void BeginUnzip(byte[] bytes, int size, string dest, string requestID, AssetList assetList)
 {
     if (!this.mMutexAcquired)
     {
         this.mMutex.WaitOne();
         this.mMutexAcquired = true;
     }
     AssetDownloader.UnzipJob unzipJob = new AssetDownloader.UnzipJob();
     unzipJob.Bytes = bytes;
     unzipJob.Size  = size;
     unzipJob.Dest  = dest;
     unzipJob.nodes = new List <AssetDownloader.UnzipJob.Node>();
     AssetList.Item itemById = assetList.FindItemByID(requestID);
     unzipJob.nodes.Add(new AssetDownloader.UnzipJob.Node()
     {
         ID   = requestID,
         hash = itemById.Hash,
         Item = itemById
     });
     this.mUnzipJobs.Add(unzipJob);
     if (size <= 0)
     {
         unzipJob.State = AssetDownloader.UnzipJobState.Error;
     }
     this.mMutex.ReleaseMutex();
     this.mMutexAcquired = false;
     this.mUnzipSignal.Set();
 }
Beispiel #2
0
 private void BeginUnzip(byte[] bytes, int size, string dest, List <string> requestIDs, AssetList assetList)
 {
     if (!this.mMutexAcquired)
     {
         this.mMutex.WaitOne();
         this.mMutexAcquired = true;
     }
     AssetDownloader.UnzipJob unzipJob = new AssetDownloader.UnzipJob();
     unzipJob.Bytes = bytes;
     unzipJob.Size  = size;
     unzipJob.Dest  = dest;
     unzipJob.nodes = new List <AssetDownloader.UnzipJob.Node>();
     using (List <string> .Enumerator enumerator = requestIDs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             string         current  = enumerator.Current;
             AssetList.Item itemById = assetList.FindItemByID(current);
             unzipJob.nodes.Add(new AssetDownloader.UnzipJob.Node()
             {
                 ID   = current,
                 hash = itemById.Hash
             });
         }
     }
     this.mUnzipJobs.Add(unzipJob);
     if (size <= 0)
     {
         unzipJob.State = AssetDownloader.UnzipJobState.Error;
     }
     this.mMutex.ReleaseMutex();
     this.mMutexAcquired = false;
     this.mUnzipSignal.Set();
 }
Beispiel #3
0
 private void RemoveCompletedDownloadRequests(string cacheDir, AssetList assets)
 {
     for (int index = 0; index < AssetDownloader.mRequestIDs.Count; ++index)
     {
         AssetList.Item itemById = assets.FindItemByID(AssetDownloader.mRequestIDs[index]);
         if (itemById != null && itemById.Exist)
         {
             AssetDownloader.mRequestIDs.RemoveAt(index--);
         }
     }
 }