Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
 public void GetProgress(out ExtractState state, out int progress)
 {
     lock (_progressLock)
     {
         state    = _extractState;
         progress = _extractProgress;
     }
 }
Beispiel #3
0
        private void RaiseProgressChanged(ExtractState state, int progress)
        {
            lock (_progressLock)
            {
                _extractState    = state;
                _extractProgress = progress;
            }

            Application.Current.Dispatcher.BeginInvoke((Action)(() =>
            {
                _progressChangedCallBack();
            }));
        }