public IEnumerator ExtractResourceCoroutine() { var _7zPath = Path.Combine(Application.persistentDataPath, _compressUpdaterFile); if (File.Exists(_7zPath)) { File.Delete(_7zPath); } BetterStreamingAssets.Initialize(); _writeStream = new FileStream(_7zPath, FileMode.CreateNew); _readStream = BetterStreamingAssets.OpenRead(_compressUpdaterFile); _fileAsyncState = new AsyncFileOp.FileAsyncState(_readStream, _writeStream, true); AsyncFileOp.CopyAsync(_fileAsyncState); while (true) { if (_fileAsyncState.isDone) { var path1 = Path.Combine(Application.persistentDataPath, _compressUpdaterFile); _extractState = ExtractState.ING; plugin_7z.Extract7z(path1, Application.persistentDataPath, this.gameObject.name); break; } yield return(null); } }
public void GetProgress(out ExtractState state, out int progress) { lock (_progressLock) { state = _extractState; progress = _extractProgress; } }
private void RaiseProgressChanged(ExtractState state, int progress) { lock (_progressLock) { _extractState = state; _extractProgress = progress; } Application.Current.Dispatcher.BeginInvoke((Action)(() => { _progressChangedCallBack(); })); }