示例#1
0
        public static void BackUpData(string ruleName, DateTime?fromDay, DateTime?toDay, BackUpStatus theRuningStatusInSession)
        {
            StartFlag(theRuningStatusInSession);

            try
            {
                //读入静态配置表
                StartLittleProcess(theRuningStatusInSession, StaticConfigTable.ReadToTableToString());
                StaticConfigTable.ReadToTable();

                //准备所需文件夹
                StartLittleProcess(theRuningStatusInSession, DiskOperations.PrepareForBackUpToString());
                DiskOperations.PrepareForBackUp();

                //检查Rar压缩器
                StartLittleProcess(theRuningStatusInSession, CommandRunner.CheckRarReadyToString());
                CommandRunner.CheckRarReady();

                //配置日志对象
                StartLittleProcess(theRuningStatusInSession, TransferDataLogManager.TryConfigLogObjToString());
                TransferDataLogManager.TryConfigLogObj();

                //根据规则起另外线程开始工作
                StartLittleProcess(theRuningStatusInSession, RulesPool.FindRuleByNameToString());
                //需要克隆的原因在于RulesPool是静态的,上次运行的对象会影响下次的运行
                TransferRule  tr  = RulesPool.FindRuleByName(ruleName);
                BackUpProcess bup = StartBackUp;
                bup.BeginInvoke(tr.Clone() as TransferRule, fromDay, toDay, theRuningStatusInSession, null, null);
            }
            catch (ApplicationException ae)
            {
                FailedFlag(theRuningStatusInSession, ae.Message);
            }
        }
示例#2
0
        public static void RestoreData(string theRarFile, RestoreStatus theRuningStatusInSession)
        {
            StartFlag(theRuningStatusInSession);

            try
            {
                //读入静态配置表
                StartLittleProcess(theRuningStatusInSession, StaticConfigTable.ReadToTableToString());
                StaticConfigTable.ReadToTable();

                //准备所需文件夹
                StartLittleProcess(theRuningStatusInSession, DiskOperations.PrepareForRestoreToString());
                DiskOperations.PrepareForRestore();

                //检查Rar压缩器
                StartLittleProcess(theRuningStatusInSession, CommandRunner.CheckRarReadyToString());
                CommandRunner.CheckRarReady();

                //配置日志对象
                StartLittleProcess(theRuningStatusInSession, TransferDataLogManager.TryConfigLogObjToString());
                TransferDataLogManager.TryConfigLogObj();

                //解析Rar数据
                StartLittleProcess(theRuningStatusInSession, TransferConfig.AnalyseRarDataToString());
                DateTime?    fromDay;
                DateTime?    toDay;
                TransferRule theTransferRule = TransferConfig.AnalyseRarData(theRarFile, out fromDay, out toDay, DiskOperations.DataTemp_ForRestoreDirectory, false, false);

                //根据规则起另外线程开始工作
                RestoreProcess rp = StartRestore;
                rp.BeginInvoke(theTransferRule, fromDay, toDay, theRuningStatusInSession, null, null);
            }
            catch (ApplicationException ae)
            {
                FailedFlag(theRuningStatusInSession, ae.Message);
            }
        }