예제 #1
0
            public void Invoke(AsyncCompletedEventArgs e, List <Action <FileInfo> > callbacks)
            {
                web.Dispose();
                FileInfo file = null;

                if (e.Cancelled || e.Error != null)
                {
                    log.Error(e.Error, "{0} download fails", url);
                    try
                    {
                        if (File.Exists(tmpPath))
                        {
                            File.Delete(tmpPath);
                        }
                    } catch (Exception ex)
                    {
                        log.Error(ex);
                    }
                }
                else
                {
                    try
                    {
                        if (File.Exists(localPath))
                        {
                            File.Delete(localPath);
                        }
                        File.Move(tmpPath, localPath);
                        file = new FileInfo(localPath);
                    } catch (Exception ex)
                    {
                        log.Error(ex);
                    }
                }
                foreach (Action <FileInfo> c in callbacks)
                {
                    c.Delay(file);
                }
            }
예제 #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
        }