Exemplo n.º 1
0
 public void Open(ResourceManagerArgs args)
 {
     _bytesPerSecond     = args.bytesPerSecond;
     _bytesPerSecondIdle = args.bytesPerSecondIdle;
     _worker             = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                              System.Threading.ThreadPriority.BelowNormal);
     _idleWorker = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                      System.Threading.ThreadPriority.Lowest);
     _localPathRoot        = args.localPathRoot;
     _assetPathTransformer = args.assetPathTransformer;
     _password             = args.password;
     _streamingAssets      = new StreamingAssetsLoader();
     _streamingAssets.LoadEmbeddedManifest(streamingAssets =>
     {
         if (args.useBaseManifest)
         {
             Helpers.ReadSAManifest(_password, (manifest, fileEntry) =>
             {
                 SetManifest(manifest, fileEntry);
             });
         }
         else
         {
             Helpers.GetManifest(_localPathRoot, _worker, args.manifestChecksum, args.manifestSize, args.manifestRSize,
                                 _password, args.manifestChunkSize, (manifest, fileEntry) =>
             {
                 SetManifest(manifest, fileEntry);
             });
         }
     });
 }
Exemplo n.º 2
0
        public static void Close()
        {
            var size = _allWorkers.Count;

            if (size > 0)
            {
                var workers = new DownloadWorker[size];
                _allWorkers.CopyTo(workers, 0);
                for (var i = 0; i < size; i++)
                {
                    workers[i].Abort();
                }

                _allWorkers.Clear();
            }

            if (_assetProvider != null)
            {
                _assetProvider.Close();
            }

            if (_analyzer != null)
            {
                _analyzer.End();
            }

            JobScheduler.Clear();
        }
Exemplo n.º 3
0
 public BundleAssetProvider(ResourceManagerArgs args)
 {
     _bytesPerSecond     = args.bytesPerSecond;
     _bytesPerSecondIdle = args.bytesPerSecondIdle;
     _worker             = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                              System.Threading.ThreadPriority.BelowNormal);
     _idleWorker = new DownloadWorker(onDownloadJobDone, args.bufferSize, args.urls,
                                      System.Threading.ThreadPriority.Lowest);
     _localPathRoot        = args.localPathRoot;
     _assetPathTransformer = args.assetPathTransformer;
 }
Exemplo n.º 4
0
 public static void RemoveWorker(DownloadWorker worker)
 {
     _allWorkers.Remove(worker);
 }
Exemplo n.º 5
0
 public static void AddWorker(DownloadWorker worker)
 {
     _allWorkers.Add(worker);
 }
Exemplo n.º 6
0
 public void OnWorkerError(DownloadWorker worker, Exception exception)
 {
     Debug.LogErrorFormat("[Worker] {0}\n{1}", exception.Message, exception.StackTrace);
 }