private void CoverSiteThread(WebSiteServer ServObj) { string name = this.SiteObj.SiteBaseInfo.NAME; int count = this.SiteObj.SiteBaseInfo.SERVLIST.Count; foreach (TaskFileInfo filePair in this.SiteObj.FilePairList) { if (!this.hasError) { if (this.CoverServ(ServObj, filePair, name, new FtpAtomOperation(this.dbLog))) { this.dbLog.Trace("[覆盖]单个服务器", name, "[成功]___服务器名:" + ServObj.NAME + "文件路径:" + filePair.AimFile); UploadTrace.AddLog(filePair, this.block, "覆盖文件:" + filePair.FileName + "到:" + ServObj.NAME + "成功."); ++this.successnum; UploadTrace.FileCoverSuccess(filePair, this.block, ""); } else { UploadTrace.FileCoverFail(filePair, this.block, ServObj.NAME, ""); this._coverErrorFile = filePair; this._coverErrorServer = ServObj; UploadTrace.AddLog(filePair, this.block, "覆盖文件:" + filePair.FileName + "到:" + ServObj.NAME + "出错.准备回滚"); this.dbLog.Trace("[覆盖]单个服务器", name, "[失败]___服务器名:" + ServObj.NAME + "文件路径:" + filePair.AimFile); this.hasError = true; break; } } } }
/// <summary> /// 任务控制:覆盖 /// </summary> /// <returns></returns> private bool CoverSite() { if (!this.multiCover) { string name = this.SiteObj.SiteBaseInfo.NAME; int count = this.SiteObj.SiteBaseInfo.SERVLIST.Count; int num = 0; foreach (WebSiteServer ServObj in this.SiteObj.SiteBaseInfo.SERVLIST) { string coverStatus = num.ToString() + (object)"/" + (string)(object)count; foreach (TaskFileInfo filePair in this.SiteObj.FilePairList) { if (this.CoverServ(ServObj, filePair, name, new FtpAtomOperation(this.dbLog))) { this.dbLog.Trace("[覆盖]单个服务器", name, "[成功]___服务器名:" + ServObj.NAME + "文件路径:" + filePair.AimFile); UploadTrace.FileCoverSuccess(filePair, this.block, coverStatus); } else { UploadTrace.FileCoverFail(filePair, this.block, ServObj.NAME, coverStatus); this._coverErrorFile = filePair; this._coverErrorServer = ServObj; UploadTrace.AddLog(filePair, this.block, "覆盖文件:" + filePair.FileName + "到:" + ServObj.NAME + "出错.准备回滚"); this.dbLog.Trace("[覆盖]单个服务器", name, "[失败]___服务器名:" + ServObj.NAME + "文件路径:" + filePair.AimFile); return(false); } } ++num; } return(true); } else { this.successnum = 0; if (UploadTrace.IsTaskCancel(this.block)) { return(false); } try { foreach (WebSiteServer serv in this.SiteObj.SiteBaseInfo.SERVLIST) { TaskWorker.doCover doCover = new TaskWorker.doCover(this.CoverSiteThread); doCover.BeginInvoke(serv, new AsyncCallback(this.doCoverCallBack), (object)doCover); } } catch { return(false); } while (!this.hasError && this.successnum != this.SiteObj.FilePairList.Count * this.SiteObj.SiteBaseInfo.SERVLIST.Count) { Thread.Sleep(100); } return(!this.hasError); } }