Exemplo n.º 1
0
        /// <summary>
        /// Remove already downloaded files from file list if files are read-only
        /// </summary>
        /// <param name="files">Source list relative to cdn</param>
        private void SetFiles(IEnumerable<string> files, bool preserveFileCount)
        {
            this.webException = null;
#if !UNITY_WEBGL
            this.unzipException = null;
#endif
            filesDownloaded = new List<string>();
            filesToDownload = new Queue<string>();
            foreach (string f in files)
            {
                string file = f.Trim();
                if (readOnly && IsPathTagged(file))
                {
                    filesDownloaded.Add(file);
                }
                else if (!file.IsEmpty())
                {
                    filesToDownload.Enqueue(file);
                }
            }
            tags.Save();

            if (!preserveFileCount)
            {
                filesDownloaded.Clear();
            }
            initialDownloadSize = filesDownloaded.Count;
            totalDownloadSize = filesToDownload.Count + filesDownloaded.Count;

#if UNITY_WEBGL
            webGL.DownloadFileCompleted += OnWWWFileCallback;
            webGL.DownloadProgressChanged += OnWWWProgressCallback;
#else
            web = new WebDownloader();
            web.DownloadFileCompleted += OnDownloadFileCallback;
            web.DownloadProgressChanged += OnProgress;
            web.Timeout = timeoutSec * 1000;

            if (unzipMethod != null)
            {
                this.unzipQueue = new UnzipQueue(unzipMethod);
            }
            else
            {
                this.unzipQueue = null;
            }
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Cleanup connections.
        /// </summary>
        public void Cleanup()
        {
            filesToDownload.Clear();
            filesDownloaded.Clear();
#if UNITY_WEBGL
			if (_webGL != null)
            {
                _webGL.Dispose();
            }
#else
            if (unzipQueue != null)
            {
                unzipQueue.Stop();
                unzipQueue = null;
            }
            if (web != null)
            {
                web.Dispose();
                web = null;
            }
#endif
        }