예제 #1
0
        private bool BackupServ(WebSiteServer ServObj, byte[] FileBytes, string SiteName, TaskFileInfo FileObj, string BackupBlock, FtpAtomOperation ftpCmdV3)
        {
            string AimUriStr1 = this.PreBakAimFolder(ServObj, FileObj, BackupBlock);

            if (ftpCmdV3.CreateFtpListDirectory(ServObj.BaseUri, AimUriStr1, ServObj.USER, ServObj.PASS))
            {
                this.dbLog.Trace("[创建备份目录]", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr1);
                string AimUriStr2 = this.PreBakAimFile(ServObj, FileObj, BackupBlock);
                if (ftpCmdV3.UploadFtpFile(ServObj.BaseUri, AimUriStr2, ServObj.USER, ServObj.PASS, FileBytes))
                {
                    this.dbLog.Trace("[上传备份文件]单个服务器", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",备份路径:" + AimUriStr2);
                    return(true);
                }
                else
                {
                    this.dbLog.Trace("[上传备份文件]单个服务器", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",备份路径:" + AimUriStr2);
                    return(false);
                }
            }
            else
            {
                this.dbLog.Trace("[创建备份目录]", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr1);
                return(false);
            }
        }
예제 #2
0
        private bool CoverServ(WebSiteServer ServObj, TaskFileInfo FileObj, string SiteName, FtpAtomOperation ftpCmdV3)
        {
            string SrcUriStr = this.PreCoverSrcFile(ServObj, FileObj);
            string AimUriStr = this.PreCoverAimFile(ServObj, FileObj);

            if (ftpCmdV3.CreateFtpListDirectory(ServObj.BaseUri, "/" + ServObj.DIRPATH + FileObj.RelAimFolder, ServObj.USER, ServObj.PASS))
            {
                this.dbLog.Trace("[级联检查/创建]覆盖目标目录", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",路径:" + FileObj.RelAimFolder);
                if (ftpCmdV3.RenameFtpFile(ServObj.BaseUri, SrcUriStr, AimUriStr, ServObj.USER, ServObj.PASS))
                {
                    this.dbLog.Trace("[文件移动]单个服务器", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",文件源位置:" + SrcUriStr + ",文件目标位置:" + AimUriStr);
                    return(true);
                }
                else
                {
                    this.dbLog.Trace("[文件移动]单个服务器", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",文件源位置:" + SrcUriStr + ",文件目标位置:" + AimUriStr);
                    return(false);
                }
            }
            else
            {
                this.dbLog.Trace("[级联检查/创建]覆盖目标目录", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",路径:" + FileObj.RelAimFolder);
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 上传文件到单个服务器
        /// </summary>
        /// <param name="ServObj"></param>
        /// <param name="FileBytes"></param>
        /// <param name="SiteName"></param>
        /// <param name="FileObj"></param>
        /// <param name="ftpcmdv3"></param>
        /// <returns></returns>
        private bool UploadServ(WebSiteServer ServObj, byte[] FileBytes, string SiteName, TaskFileInfo FileObj, FtpAtomOperation ftpcmdv3)
        {
            string AimUriStr1 = this.PreUpAimFolder(ServObj, FileObj);
            string AimUriStr2 = this.PreUpAimFile(ServObj, FileObj);

            if (!ftpcmdv3.CreateFtpListDirectory(ServObj.BaseUri, AimUriStr1, ServObj.USER, ServObj.PASS))
            {
                this.dbLog.Trace("[级联创建]单个服务器", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr1);
                return(false);
            }
            else
            {
                try
                {
                    this.dbLog.Trace("[级联创建]单个服务器", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr1);
                    if (!ftpcmdv3.UploadFtpFile(ServObj.BaseUri, AimUriStr2, ServObj.USER, ServObj.PASS, FileBytes))
                    {
                        this.dbLog.Trace("[上传文件]单个服务器", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr2);
                        return(false);
                    }
                    else
                    {
                        this.dbLog.Trace("[上传文件]单个服务器", SiteName, "[成功]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr2);
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    this.dbLog.Trace("[上传文件]单个服务器", SiteName, "[失败]___服务器名:" + ServObj.NAME + ",路径:" + AimUriStr2 + ",错误信息:" + ex.Message);
                    return(false);
                }
            }
        }