private bool DownloadFile_internal(string filename, string savePath, string saveName, fileDownload_Callback callback) { if (_downloadFile_bw.IsBusy != true) { _isDownloadFileDone = false; _downloadFile_callback = callback; _downloadFile_bw.RunWorkerAsync(new downloadFile_argData(_token, filename, savePath, saveName)); return(true); } else { return(false); } }
public override bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath,fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback){ GetFileListFromPath (loadFolderPath, delegate(string resJson) { if (!File.Exists (saveFolderPath)) { Directory.CreateDirectory(saveFolderPath); } JSONNode parseResult = JSON.Parse (resJson); for (int index = 0; index < parseResult ["entries"].Count; index++) { if (parseResult ["entries"] [index] [".tag"].Value == "file") { DownloadFile (parseResult ["entries"] [index] ["name"].Value, saveFolderPath, parseResult ["entries"] [index] ["name"].Value, delegate() { proceed_callback(parseResult ["entries"].Count, index); }); } } callback (); }); return true; }
public override bool DownloadFile (string filename, string savePath,string saveName, fileDownload_Callback callback){ File.Copy( (_recentPath + "/" + filename ), (savePath + "/" + saveName )); callback (); return true; }
public abstract bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback , fileDownload_Cancel_Callback cancel_callback);
public abstract bool DownloadFile (string filename, string savePath,string saveName, fileDownload_Callback callback);
public override bool DownloadFile(string filename, string savePath, string saveName, fileDownload_Callback callback) { File.Copy((_recentPath + "/" + filename), (savePath + "/" + saveName)); callback(); return(true); }
public override bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback) { GetFileListFromPath(loadFolderPath, delegate(string resJson) { if (!File.Exists(saveFolderPath)) { Directory.CreateDirectory(saveFolderPath); } JSONNode parseResult = JSON.Parse(resJson); for (int index = 0; index < parseResult ["entries"].Count; index++) { if (parseResult ["entries"] [index] [".tag"].Value == "file") { DownloadFile(parseResult ["entries"] [index] ["name"].Value, saveFolderPath, parseResult ["entries"] [index] ["name"].Value, delegate() { proceed_callback(parseResult ["entries"].Count, index); }); } } callback(); }); return(true); }
public abstract bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback);
public abstract bool DownloadFile(string filename, string savePath, string saveName, fileDownload_Callback callback);
private bool DonwloadAllFilesInFolder_internal(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback) { if (_downloadFile_bw.IsBusy == true || _updateList_bw.IsBusy == true) { return(false); } _isDownloadMultipleFilesDone = false; _recentSaveFolderPath = saveFolderPath; _downloadMultipleFile_callback = callback; _downaload_cancel_callback = cancel_callback; if (_recentPath != loadFolderPath) { GetFileListFromPath_internal(loadFolderPath, delegate(string resJson) { _updateList_result = resJson; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback, cancel_callback); }); return(true); } if (!Directory.Exists(saveFolderPath)) { Directory.CreateDirectory(saveFolderPath); } if (proceed_callback != null) { /* * downloadable Files filtering * */ if (_processIdx == 0) { JSONNode parseResult = JSON.Parse(_updateList_result); for (int i = 0; i < parseResult ["entries"].Count; i++) { string fileName = parseResult ["entries"] [i] ["name"].Value; //extention name check string[] elements = fileName.Split('.'); if ((elements [elements.Length - 1] == "png" || elements [elements.Length - 1] == "jpg" || elements [elements.Length - 1] == "PNG" || elements [elements.Length - 1] == "JPG") && parseResult ["entries"] [i] [".tag"].Value == "file") { dropboxFile tempFile = new dropboxFile(); tempFile._id = parseResult ["entries"] [i] ["id"].Value; tempFile._name = parseResult ["entries"] [i] ["name"].Value; _filteredFiles.Add(tempFile); } } } //****Cancel 0---Syncro_mutex------------- _cancelMutex.WaitOne(); if (_isCanceled) { /*Recet*/ //background Worker Kill if (!_downloadFile_bw.IsBusy) { _downloadFile_bw.CancelAsync(); Initalize(); } _isDownloadMultipleFilesDone = true; _filteredFiles.Clear(); _processIdx = 0; return(false); } //****Cancel 0-------------------- _cancelMutex.ReleaseMutex(); //Filtered file count proceed_callback(_filteredFiles.Count, _processIdx); } else { return(false); } #if UNITY_EDITOR Debug.Log(_updateList_result); #endif if (_processIdx < _filteredFiles.Count) { DownloadFile_internal(_filteredFiles[_processIdx]._id, saveFolderPath, _filteredFiles[_processIdx]._name, delegate() { _processIdx++; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback, cancel_callback); }); /* * //Ignore the folder * if (parseResult ["entries"] [_processIdx] [".tag"].Value == "file") { * * //JpG, Png Blocking Needed * DownloadFile_internal (parseResult ["entries"] [_processIdx] ["id"].Value, saveFolderPath, parseResult ["entries"] [_processIdx] ["name"].Value, delegate() { * _processIdx++; * DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback); * }); * } else { * _processIdx++; * DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback); * } */ } else { /*Done*/ _isDownloadMultipleFilesDone = true; _filteredFiles.Clear(); _processIdx = 0; } return(true); }
public override bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback) { if (_status == JobStatus.Started) { return(false); } else { _status = JobStatus.Started; } bool res = DonwloadAllFilesInFolder_internal(loadFolderPath, saveFolderPath, callback, proceed_callback, cancel_callback); if (res) { return(true); } else { return(false); } }
public override bool DownloadFile(string filename, string savePath, string saveName, fileDownload_Callback callback) { if (_status == JobStatus.Started) { return(false); } else { _status = JobStatus.Started; } bool res = DownloadFile_internal(filename, savePath, saveName, callback); if (res) { return(true); } else { return(false); } }
private bool DonwloadAllFilesInFolder_internal(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback,fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback){ if (_downloadFile_bw.IsBusy == true || _updateList_bw.IsBusy == true) { return false; } _isDownloadMultipleFilesDone = false; _recentSaveFolderPath = saveFolderPath; _downloadMultipleFile_callback = callback; _downaload_cancel_callback = cancel_callback; if (_recentPath != loadFolderPath) { GetFileListFromPath_internal (loadFolderPath, delegate(string resJson) { _updateList_result = resJson; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback, cancel_callback); }); return true; } if (!Directory.Exists (saveFolderPath)) { Directory.CreateDirectory(saveFolderPath); } if (proceed_callback != null ) { /* * downloadable Files filtering * */ if (_processIdx == 0) { JSONNode parseResult = JSON.Parse(_updateList_result); for (int i = 0; i < parseResult ["entries"].Count; i++) { string fileName = parseResult ["entries"] [i] ["name"].Value; //extention name check string[] elements = fileName.Split ('.'); if ( (elements [elements.Length - 1] == "png" || elements [elements.Length - 1] == "jpg" || elements [elements.Length - 1] == "PNG" || elements [elements.Length - 1] == "JPG") && parseResult ["entries"] [i] [".tag"].Value == "file") { dropboxFile tempFile = new dropboxFile (); tempFile._id = parseResult ["entries"] [i] ["id"].Value; tempFile._name = parseResult ["entries"] [i] ["name"].Value; _filteredFiles.Add (tempFile); } } } //****Cancel 0---Syncro_mutex------------- _cancelMutex.WaitOne (); if (_isCanceled) { /*Recet*/ //background Worker Kill if (!_downloadFile_bw.IsBusy) { _downloadFile_bw.CancelAsync (); Initalize (); } _isDownloadMultipleFilesDone = true; _filteredFiles.Clear (); _processIdx = 0; return false; } //****Cancel 0-------------------- _cancelMutex.ReleaseMutex(); //Filtered file count proceed_callback (_filteredFiles.Count, _processIdx); } else { return false; } #if UNITY_EDITOR Debug.Log (_updateList_result); #endif if (_processIdx < _filteredFiles.Count) { DownloadFile_internal (_filteredFiles[_processIdx]._id, saveFolderPath, _filteredFiles[_processIdx]._name, delegate() { _processIdx++; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback, cancel_callback); }); /* //Ignore the folder if (parseResult ["entries"] [_processIdx] [".tag"].Value == "file") { //JpG, Png Blocking Needed DownloadFile_internal (parseResult ["entries"] [_processIdx] ["id"].Value, saveFolderPath, parseResult ["entries"] [_processIdx] ["name"].Value, delegate() { _processIdx++; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback); }); } else { _processIdx++; DonwloadAllFilesInFolder_internal(_recentPath, _recentSaveFolderPath, _downloadMultipleFile_callback, proceed_callback); } */ } else { /*Done*/ _isDownloadMultipleFilesDone = true; _filteredFiles.Clear (); _processIdx = 0; } return true; }
private bool DownloadFile_internal(string filename, string savePath, string saveName, fileDownload_Callback callback){ if (_downloadFile_bw.IsBusy != true) { _isDownloadFileDone = false; _downloadFile_callback = callback; _downloadFile_bw.RunWorkerAsync (new downloadFile_argData(_token,filename,savePath, saveName )); return true; } else { return false; } }
public override bool DonwloadAllFilesInFolder(string loadFolderPath, string saveFolderPath, fileDownload_Callback callback, fileDownload_Process_Callback proceed_callback, fileDownload_Cancel_Callback cancel_callback){ if (_status == JobStatus.Started) return false; else _status = JobStatus.Started; bool res = DonwloadAllFilesInFolder_internal (loadFolderPath, saveFolderPath, callback, proceed_callback, cancel_callback); if (res) return true; else return false; }
public override bool DownloadFile (string filename, string savePath, string saveName, fileDownload_Callback callback){ if (_status == JobStatus.Started) return false; else _status = JobStatus.Started; bool res = DownloadFile_internal (filename, savePath, saveName, callback); if (res) return true; else return false; }