Пример #1
0
 /// <summary>
 /// 添加主机信息
 /// </summary>
 /// <param name="info">信息对象</param>
 /// <returns></returns>
 public bool Add(HostInfo info)
 {
     //判断是否已经存在
     if (Exists(info))
     {
         return(false);
     }
     _list.Add(info);
     //保存
     SaveList();
     return(true);
 }
Пример #2
0
        /// <summary>
        /// 移除主机信息
        /// </summary>
        /// <param name="Character">信息名称字符标识</param>
        /// <returns></returns>
        public bool Remove(string Character)
        {
            //判断是否存在
            if (Exists(Character) == false)
            {
                return(false);
            }
            HostInfo info = _list.Where(q => q.Character == Character).FirstOrDefault();

            _list.Remove(info);
            //保存信息
            SaveList();
            return(true);
        }
Пример #3
0
 /// <summary>
 /// 执行当前备份
 /// </summary>
 /// <param name="hostInfo">指定主机信息</param>
 public void Exec_Back(HostInfo hostInfo)
 {
     if (IsCanBack())
     {
         //先获取配置,再备份
         BackDBTool _dbTool = new BackDBTool(hostInfo,
                                             this.DBName, this.TargetName, this.TargetPath);
         //开始备份
         if (_dbTool.Exec_Back() == false)
         {
             throw new Exception("备份文件失败,对应数据库名称:"
                                 + _dbTool.DBName + ",备份语句:"
                                 + _dbTool.GetSql_Back());
         }
     }
 }
Пример #4
0
 /// <summary>
 /// 移除主机信息
 /// </summary>
 /// <param name="info">信息名称字符标识</param>
 /// <returns></returns>
 public bool Remove(HostInfo info)
 {
     return(Remove(info.Character));
 }
Пример #5
0
 /// <summary>
 /// 判断信息是否已经存在
 /// </summary>
 /// <param name="info">信息对象</param>
 /// <returns></returns>
 public bool Exists(HostInfo info)
 {
     return(Exists(info.Character));
 }
Пример #6
0
 public BackBase(HostInfo HostInfo)
 {
     _log          = BackLog.GetLog();
     this.HostInfo = HostInfo;
 }
Пример #7
0
 /// <summary>
 /// 不指定路径默认人到d:盘
 /// </summary>
 public BackDBTool(HostInfo HostInfo, string DBName) : this(HostInfo, DBName, DBName, "d:")
 {
 }
Пример #8
0
 /// <summary>
 /// 不指定备份文件名,则与数据库名相同
 /// </summary>
 /// <param name="DBName">数据库名称</param>
 /// <param name="TargetPath">备份文件名称</param>
 public BackDBTool(HostInfo HostInfo, string DBName, string TargetPath) : this(HostInfo, DBName, DBName, TargetPath)
 {
 }
Пример #9
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="DBName">数据库名称</param>
 /// <param name="TargetName">备份文件名称</param>
 /// <param name="TargetPath">备份目录</param>
 public BackDBTool(HostInfo HostInfo, string DBName, string TargetName, string TargetPath) : base(HostInfo)
 {
     this.DBName     = DBName;
     this.TargetName = TargetName;
     this.TargetPath = TargetPath;
 }