public void DownFileWithProcess(DownloadFileData data) { _fileData = data; _piceManager = new PiceManager(_fileData, _piceSize); CreateThreads(_maxThread); //finishHandle.WaitOne(); }
public PiceManager(DownloadFileData data, long piceSize) { _piceSize = piceSize; _data = data; _fileStream = new FileStream(_data.localPath, FileMode.Create, FileAccess.Write); _fileStream.SetLength(_data.entry.size); CreatePices(); }
void OnGUI() { if (GUILayout.Button("Sync All")) { Sync(); } GUILayout.Space(15); _mainScrollPos = GUILayout.BeginScrollView(_mainScrollPos); for (int i = 0; i < _gamesData.Count; i++) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.MaxWidth(this.position.width)); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.Label(_gamesData[i].Name); GUILayout.Space(15); _gamesData[i].ExecutableName = EditorGUILayout.TextField("Executable Name: ", _gamesData[i].ExecutableName); // Persist executableName if (GUI.changed) { EditorPrefs.SetString(_gamesData[i].Name, _gamesData[i].ExecutableName); } GUILayout.EndHorizontal(); // Disable gui if its'n synced GUI.enabled = _isSynced; GUILayout.Space(15); foreach (string localizationName in _gamesData[i].Files.Keys) { GUILayout.BeginHorizontal(GUI.skin.box); GUILayout.Label("Language: " + localizationName); DownloadFileData fileData = _gamesData[i].Files[localizationName]; if (GUILayout.Button("Download file")) { // This will be always in the BundlesAssets/Global/Localization if (i == 0) { DownloadLocalizationFile(string.Format(PATH_TO_GLOBAL_LOCALIZATION, PYBundleType.Localization, localizationName), fileData.FileName, fileData.QueryFileTag, localizationName); } // This will be always in the BundlesAssets/Expansions/{0}/Localization else { DownloadLocalizationFile(string.Format(PATH_TO_EXPANSION_LOCALIZATION, _gamesData[i].Name, PYBundleType.Localization, localizationName), fileData.FileName, fileData.QueryFileTag, localizationName); } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.Space(10); } GUILayout.EndScrollView(); }