/// <summary> /// 所有数据接收完成的回调,将临时文件保存为制定的文件名 /// </summary> protected override void CompleteContent() { Debug.Log("下载完成!"); string CompleteFilePath = SavePath + "/" + FileName; //完整路径 string TempFilePath = fs.Name; //临时文件路径 OnDispose(); if (File.Exists(TempFilePath)) { if (File.Exists(CompleteFilePath)) { File.Delete(CompleteFilePath); } File.Move(TempFilePath, CompleteFilePath); //Debug.Log("重命名文件!"); } else { Debug.Log("生成文件失败=>下载的文件不存在!"); } if (EventComplete != null) { EventComplete.Invoke(CompleteFilePath); } }
public ConsoleEvent(string content, bool newlineWhenFinished = true, float delayWhenFinished = 0f, float?cps = DefaultCharactersPerSecond, string tColor = null, Color?bColor = null, EventComplete onEventComplete = null) { NewlineWhenFinished = newlineWhenFinished; DelayWhenFinished = delayWhenFinished; CharactersPerSecond = cps ?? DefaultCharactersPerSecond; textContent = content; textColor = tColor; backgroundColor = bColor; callback = onEventComplete; progress = 0f; }
internal static async Task <Task> SendReply(PostEventContext post, string json) { var result = Task.CompletedTask; if (post.IsWebSocketRequest) { if (post.SocketRemainsOpen()) { var completion = await post.GetSocketCompletion(); return(completion.Task); } await SendSocketReply(post, json); } else { await SendAjaxReply(post.Http, json); } EventComplete?.Invoke(post.Http, _EventArgs); return(result); }
private void FillInProcessName(int pid) { Process p = null; try { p = Process.GetProcessById(pid); } catch { } string name = p == null ? "Unknown" : p.ProcessName; this.ProcessInfo = new ProcessInfo(pid, name); eventComplete = eventComplete | EventComplete.ProcessName; FireCompleteEvent(); }
public void FillInHostName(IPAddress ipa) { string hostName = string.Empty; try { IPHostEntry entry = Dns.GetHostEntry(ipa); hostName = entry.HostName; } catch { } HostName = hostName; eventComplete = eventComplete | EventComplete.HostName; FireCompleteEvent(); }
public void FillInGeoLocation(IPAddress ipa) { try { this.Location = GeoLocationApi.GetLocation(ipa); } catch { } eventComplete = eventComplete | EventComplete.GeoLocation; FireCompleteEvent(); }
public void FillInArinInfo(IPAddress ipa) { try { this.Owner = ArinApi.GetOrginization(ipa); } catch { } eventComplete = eventComplete | EventComplete.ArinInfo; FireCompleteEvent(); }
public void LoadAsset(string relPath, EventComplete completeDoFun, EventStatus status) { string absPath = ""; LoadingWWW loading; // first check updatepath to get foreach(var p in mUpdatePaths) { absPath = p + "/" + relPath; if(mCacheAssets.ContainsKey(absPath) && completeDoFun != null) { completeDoFun(mCacheAssets[absPath]); return; } if(System.IO.File.Exists(absPath)) { loading.www = new WWW("file://" + absPath); loading.status = status; loading.complete = completeDoFun; loading.relPath = relPath; loading.absPath = absPath; if(loading.status != null) loading.status(new LoadingProgressArg(loading.www.progress, relPath)); mLoadingList.Add(loading); } } // then check streaming path absPath = Application.streamingAssetsPath + "/" + relPath; AssetBundle bundle = null; if (mCacheAssets.TryGetValue(absPath, out bundle) && completeDoFun != null) { completeDoFun(bundle); return; } if(Application.platform == RuntimePlatform.Android) loading.www = new WWW(absPath); else loading.www = new WWW("file://" + absPath); loading.status = status; loading.complete = completeDoFun; loading.relPath = relPath; loading.absPath = absPath; if(loading.status != null) loading.status(new LoadingProgressArg(loading.www.progress, relPath)); mLoadingList.Add(loading); }
private void GameEventCompleteInternal(object sender, GameEventCompleteEventArgs e) { EventComplete?.Invoke(this, e); }
private void FireEventComplete() => EventComplete?.Invoke();