Example #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);
            }
        }
Example #2
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);
                }
            }
        }