Exemple #1
0
        public override void Execute()
        {
            var          streamSet    = Require <InitialReadStream>();
            BinaryReader binaryReader = streamSet[0];
            FileStream   fileStream   = streamSet[1];

            if (fileStream.Length < sizeof(Int32))
            {
                McsfRestoreLogger.WriteLog(string.Format("[GetMessageInFileHead]: file stream length is less ", sizeof(Int32)));
                return;
            }

            var messageLength = binaryReader.ReadInt32();

            if (messageLength > fileStream.Length - sizeof(int))
            {
                McsfRestoreLogger.WriteLog(string.Format("[GetMessageInFileHead]: message length is less ", fileStream.Length - sizeof(int)));
                return;
            }

            var messageBytes = binaryReader.ReadBytes(messageLength);
            var message      = Encoding.UTF8.GetString(messageBytes);

            Export = message;
        }
Exemple #2
0
        private void GetRestoreInfo()
        {
            McsfRestoreLogger.WriteLog("[GetRestoreInfo]: begin.");
            var path = Path.GetFullPath(@"../config/");

            McsfRestoreLogger.WriteLog("[GetRestoreInfo]: path is " + path);
            if (string.IsNullOrWhiteSpace(path))
            {
                McsfRestoreLogger.WriteLog("[GetRestoreInfo]: path is null.");
                return;
            }
            if (!Directory.Exists(path))
            {
                McsfRestoreLogger.WriteLog(string.Format("[GetRestoreInfo]: path {0} is not exist.", path));
                return;
            }
            var               configPath = path + "ServiceRestore.xml";
            XmlDocument       xDoc       = new XmlDocument();
            XmlReaderSettings settings   = new XmlReaderSettings();

            settings.IgnoreComments = true;
            XmlReader reader = XmlReader.Create(configPath, settings);

            xDoc.Load(reader);
            XmlElement root    = (XmlElement)xDoc.SelectSingleNode("Root");
            var        xmlList = root["Packages"];

            foreach (XmlElement packageItem in xmlList)
            {
                var xmlValue = packageItem.InnerText;
                this.PackList.Add(xmlValue);
            }
            McsfRestoreLogger.WriteLog("[GetRestoreInfo]: end.");
        }
        public static void DeleteFolder(string deletefolder)
        {
            McsfRestoreLogger.WriteLog("[DeleteFolderAndSubFiles]:deletefolder is  " + deletefolder);
            if (Directory.Exists(deletefolder))
            {
                try
                {
                    DirectoryInfo dir = new DirectoryInfo(deletefolder);
                    foreach (FileSystemInfo i in dir.GetFileSystemInfos())
                    {
                        if (i is FileInfo)
                        {
                            if (i.Attributes.ToString().IndexOf("ReadOnly") != -1)
                            {
                                i.Attributes = FileAttributes.Normal; //去掉文件属性
                            }
                            File.Delete(i.FullName);                  //直接删除其中的文件
                        }
                        else
                        {
                            DeleteFolder(i.FullName);
                        }
                    }

                    DirectoryInfo DirInfo = new DirectoryInfo(deletefolder);
                    DirInfo.Attributes = FileAttributes.Normal; //去掉文件夹属性
                    DirInfo.Delete(true);                       //删除文件夹
                }
                catch (Exception ex)
                {
                    McsfRestoreLogger.WriteLog("DeleteFolderAndSubFiles ex" + ex.Message);
                }
            }
        }
Exemple #4
0
        private void RestoreClickExcute()
        {
            this.CurrentRestoreInfo = null;
            this.completeSize       = 0;
            this.IsRestore          = false;
            new Thread(() =>
            {
                McsfRestoreLogger.WriteLog("[RestoreClickExcute]: begin.");
                SyncTaskUtility RestoreAsyncTask = new SyncTaskUtility();
                if (string.IsNullOrWhiteSpace(this.BkpFilePath))
                {
                    this.IsRestore = true;
                    McsfRestoreLogger.WriteLog("[RestoreClickExcute]: bapfile path is null.");
                    return;
                }
                if (!File.Exists(this.BkpFilePath))
                {
                    this.IsRestore = true;
                    McsfRestoreLogger.WriteLog(string.Format("[RestoreClickExcute]: bkpfile path {0} is not exists .", this.BkpFilePath));
                    return;
                }
                if (this.PackList == null || this.PackList.Count == 0)
                {
                    this.IsRestore = true;
                    McsfRestoreLogger.WriteLog(string.Format("[RestoreClickExcute]: PackList is null."));
                    return;
                }


                ResultType ret = RestoreAsyncTask.Execute <RestoreMainWorkflow>(this.BkpFilePath, this.PackList, this.restoreAction);
                McsfRestoreLogger.WriteLog("[RestoreClickExcute]: excute result is " + ret);
                McsfRestoreLogger.WriteLog("[RestoreClickExcute]: end.");
                this.IsRestore = true;
            }).Start();
        }
        /// <summary>
        /// Add 1!2@3#4$5%6^7&.a1b2c3 file in all empty sub folders in the specified directory
        /// </summary>
        /// <param name="path">The path of the specified directory</param>
        public bool AddSpecialFile2EmptyFolder(string path)
        {
            try
            {
                bool     isEmpty = true;
                string[] files   = Directory.GetFiles(path);
                if (files.Length >= 1)
                {
                    isEmpty = false;
                }

                string[] dirs = Directory.GetDirectories(path);
                if (dirs.Length >= 1)
                {
                    for (int i = 0; i < dirs.Length; i++)
                    {
                        bool result = AddSpecialFile2EmptyFolder(dirs[i]);
                        isEmpty = isEmpty && result;
                    }
                }
                if (isEmpty)
                {
                    File.Create(Path.Combine(path, "1!2@3#4$5%6^7&.a1b2c3")).Close();
                }
                return(isEmpty);
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[AddSpecialFile2EmptyFolder]: exception is " + ex.Message);
                throw ex;
            }
        }
Exemple #6
0
        public override void Execute()
        {
            var message = Arguments[0];

            McsfRestoreLogger.WriteLog("GetOldSWVersionsDictionary message=" + message);
            Dictionary <string, string> versionDic = new Dictionary <string, string>();

            if (Require <IsMessageBranch69>(message))
            {
                versionDic = Require <Branch69GetMessageInfo>(message);
                if (versionDic.ContainsKey("SystemID"))
                {
                    versionDic.Remove("SystemID");
                }
                if (versionDic.ContainsKey("BkpVersion"))
                {
                    versionDic.Remove("BkpVersion");
                }
                if (versionDic.ContainsKey("SystemMacAddress"))
                {
                    versionDic.Remove("SystemMacAddress");
                }
            }
            else
            {
                XmlDocument xDoc_Bkp = Require <GetBkpXmlDocument>(message);
                string      version  = Require <GetBranch69FormerBkpVersionInfo>(message, xDoc_Bkp);
                versionDic.Add("MCSF", version);
            }
            Export = versionDic;
        }
Exemple #7
0
 private void RepairCallBackExcute(bool ret)
 {
     McsfRestoreLogger.WriteLog("[RepairCallBackExcute]: begin.");
     McsfRestoreLogger.WriteLog("[RepairCallBackExcute]: ret is " + ret);
     this.SelectResultItem.IsSuccess = true;
     this.IsFirstNextEnable          = true;
 }
        public override void Execute()
        {
            McsfRestoreLogger.WriteLog("[DeleteFolderAndSubFiles]:start ");
            string deletefolder = Arguments[0];

            DeleteFolder(deletefolder);
        }
        public override void Execute()
        {
            var batPath = Arguments[0];

            McsfRestoreLogger.WriteLog("[ExcuteBat]:batPath is " + batPath);
            bool    result  = true;
            Process process = null;

            try
            {
                process = new Process();
                FileInfo fileInfo = new FileInfo(batPath);
                process.StartInfo.WorkingDirectory       = fileInfo.Directory.FullName;
                process.StartInfo.FileName               = batPath;
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.CreateNoWindow         = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.Start();
                StreamReader standardOutput = process.StandardOutput;
                string       str            = standardOutput.ReadToEnd();
                standardOutput.Close();
                process.WaitForExit();
            }
            catch
            {
                result = false;
            }
            finally
            {
                process.Close();
            }
            Export = result;
        }
        public override void Execute()
        {
            string rootFolderPath = Require <GetRootFolderPath>();
            var    tempFolderPath = string.Format(@"{0}restore{1}\", rootFolderPath, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));

            McsfRestoreLogger.WriteLog("[GetTempFolderPath]: tempFolderPath is " + tempFolderPath);
            Export = tempFolderPath;
        }
Exemple #11
0
        private void InitializeCheck()
        {
            McsfRestoreLogger.WriteLog("[InitializeCheck]: begin.");
            InitialTimer();

            GroupList = GetGroupList();
            if (GroupList == null || GroupList.Count == 0)
            {
                McsfRestoreLogger.WriteLog("[InitializeCheck]: GroupList is null.");
                return;
            }

            new Thread(() =>
            {
                foreach (var item in GroupList)
                {
                    string response         = "";
                    DllRefection reflection = new DllRefection();
                    this.CurrentModuleName  = item.Module;
                    var nameSpace           = item.Check.Substring(0, item.Check.Length - 4);
                    //var result = reflection.DLLReflection2(item.Check, nameSpace, "McsfRestoreCheck", "CheckHandler", new object[] { checkAction }, out response);
                    var result = 0;
                    if ((int)result != 0)
                    {
                        this.IsFirstNextEnable = false;
                    }
                    //Nothing = -1,Accessed = 0,UnAccessed = 1,NotExisted = 2,Running = 3,Stopped = 4
                    var status = (EnumMySQLStatus)result;
                    McsfRestoreLogger.WriteLog(string.Format("[InitializeCheck]: item.Check  DLLReflection2 ret is {0} and status is {1}", result, status));
                    var checkResultItem = new CheckResultItem()
                    {
                        Description = "test",
                        IsSuccess   = (int)result == 0,
                        Result      = (int)result,
                        ModuleName  = item.Module,
                        IsWindow    = item.IsWindow,
                        ClassName   = item.ClassName
                    };

                    System.Windows.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                    {
                        this.CheckResultList.Add(checkResultItem);
                        this.CheckNumber += 1;
                        if (CheckNumber == GroupList.Count)
                        {
                            this.dispatcherTimerDecrease.Stop();
                            this.dispatcherTimerIncrease.Stop();
                            this.CurrentModuleName = "";
                            this.CheckAnimation    = "Complete.";
                        }
                    }));
                }
            }).Start();
        }
        public override void Execute()
        {
            string folderPath = Arguments[0];//D:\UIH\BackupRestore\Restore\时间戳

            var parentFolderPath = new DirectoryInfo(folderPath).Parent.FullName;
            var folderName       = new DirectoryInfo(folderPath).Name;

            var compressedFilePath = string.Format(@"{0}\{1}Compressed.bkp", parentFolderPath, folderName);

            McsfRestoreLogger.WriteLog("[GetCompressedFilePathFromFolderPath]: compressedFilePath is " + compressedFilePath);
            Export = compressedFilePath;
        }
 public override void Execute()
 {
     try
     {
         string folderPath = Arguments[0];
         new DirectoryInfo(folderPath).Create();
     }
     catch (Exception ex)
     {
         McsfRestoreLogger.WriteLog("[CreateFolder]:exception is " + ex.Message, LogMessageType.Error);
     }
 }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         McsfRestoreLogger.WriteLog("[BoolToReverseConverter]: value is null.");
         return(true);
     }
     else
     {
         var ret = !(bool)value;
         McsfRestoreLogger.WriteLog("[BoolToReverseConverter]: ret is " + ret);
         return(ret);
     }
 }
Exemple #15
0
        public override void Execute()
        {
            var streamSet = Require <InitialReadStream>();

            new List <dynamic>(streamSet).ForEach(item =>
            {
                if (item == null)
                {
                    McsfRestoreLogger.WriteLog("[CloseReadStream]: item is null.");
                    return;
                }
                item.Close();
            });
        }
Exemple #16
0
        public override void Execute()
        {
            string filePath = Arguments[0];

            try
            {
                string message = Require <GetMessageWorkflow>(filePath);
                Export = message;
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[GetMessageFromFile]: ex is " + ex.StackTrace);
                return;
            }
        }
        /// <summary>
        /// Compress file.
        /// </summary>
        /// <param name="FileToZip"></param>
        /// <param name="ZipedFile"></param>
        public bool ZipFile(string FileToZip, string ZipedFile)
        {
            //If file is not exist.
            if (!System.IO.File.Exists(FileToZip))
            {
                McsfRestoreLogger.WriteLog("[ZipFile]: file is not exist: " + FileToZip);
                return(false);
            }

            try
            {
                System.IO.FileStream StreamToZip = new System.IO.FileStream(FileToZip, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                System.IO.FileStream ZipFile   = System.IO.File.Create(ZipedFile);
                ZipOutputStream      ZipStream = new ZipOutputStream(ZipFile);
                ZipEntry             ZipEntry  = new ZipEntry(Path.GetFileName(FileToZip));
                ZipEntry.IsUnicodeText = true;
                ZipStream.PutNextEntry(ZipEntry);
                ZipStream.SetLevel(6);
                byte[]       buffer = new byte[bufferSize];
                System.Int32 size   = StreamToZip.Read(buffer, 0, buffer.Length);

                ZipStream.Write(buffer, 0, size);
                while (size < StreamToZip.Length)
                {
                    int sizeRead = StreamToZip.Read(buffer, 0, buffer.Length);
                    ZipStream.Write(buffer, 0, sizeRead);
                    size += sizeRead;
                }

                ZipStream.Finish();
                ZipStream.Close();
                StreamToZip.Close();
                StreamToZip.Dispose();

                return(true);
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[ZipFile]: exception: " + ex.Message);
                return(false);
            }
        }
Exemple #18
0
        private void BrowseClickExecute()
        {
            McsfRestoreLogger.WriteLog("[BrowseClickExecute]: begin.");
            var dialog = new OpenFileDialog()
            {
                Filter = "Text documents (.bkp)|*.bkp|All files (*.*)|*.*"
            };
            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.BkpFilePath = dialog.FileName;
                McsfRestoreLogger.WriteLog("[BrowseClickExecute]: select file is  " + dialog.FileName);
            }
            else
            {
                McsfRestoreLogger.WriteLog("[BrowseClickExecute]: dialog result is cancel.");
            }
        }
Exemple #19
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         McsfRestoreLogger.WriteLog("[BoolToVisibilityConverter]: value is null.");
         return(Visibility.Collapsed);
     }
     else
     {
         if ((bool)value)
         {
             return(Visibility.Visible);
         }
         else
         {
             return(Visibility.Collapsed);
         }
     }
 }
Exemple #20
0
 public List <GroupConfigItem> GetGroupList()
 {
     McsfRestoreLogger.WriteLog("[GetCheckList]: begin.");
     try
     {
         List <GroupConfigItem> ret = new List <GroupConfigItem>();
         var currentDir             = Directory.GetCurrentDirectory();//获取应用程序的当前工作目录
         var xmlPath = Path.GetFullPath(@"../config/ServiceCheck.xml");
         McsfRestoreLogger.WriteLog("[GetCheckList]: xmlPath is " + xmlPath);
         XmlDocument       doc      = new XmlDocument();
         XmlReaderSettings settings = new XmlReaderSettings();
         settings.IgnoreComments = true;
         XmlReader reader = XmlReader.Create(xmlPath, settings);
         doc.Load(reader);
         XmlNode    root      = doc.SelectSingleNode("Root");
         XmlElement rootXml   = (XmlElement)root;
         var        groups    = rootXml["Groups"];
         var        groupList = groups["Group"];
         foreach (XmlElement group in groups)
         {
             var checkConfigItem = new GroupConfigItem();
             checkConfigItem.Package = group.GetAttribute("Package");
             checkConfigItem.Module  = group.GetAttribute("Module");
             if (group["Check"] == null || group["Repair"] == null)
             {
                 McsfRestoreLogger.WriteLog(string.Format("[GetCheckList]: group {0} has no check or restore item.", checkConfigItem.Module));
                 continue;
             }
             checkConfigItem.Check     = group["Check"].InnerText;
             checkConfigItem.Repair    = group["Repair"].InnerText;
             checkConfigItem.IsWindow  = group["Repair"].GetAttribute("IsWindow").ToLower() == "true";
             checkConfigItem.ClassName = group["Repair"].GetAttribute("ClassName");
             ret.Add(checkConfigItem);
         }
         McsfRestoreLogger.WriteLog("[GetCheckList]: end.");
         return(ret);
     }
     catch (Exception ex)
     {
         McsfRestoreLogger.WriteLog("[GetCheckList]: exception " + ex.Message);
         return(null);
     }
 }
Exemple #21
0
 private void RepairExucte()
 {
     McsfRestoreLogger.WriteLog("[RepairExucte]: begin.");
     if (!this.SelectResultItem.IsWindow)
     {
         McsfRestoreLogger.WriteLog("[RepairExucte]: open  repair mysql window.");
         var tempCRList = CheckResultList;
         var tempGList  = GroupList;
         McsfRestoreLogger.WriteLog(string.Format("[RepairExucte]: tempCRList count is {0} and tempGList count is ", tempCRList.Count, tempGList.Count));
         var repairSubWnd = new RepairMysql(repairAction, tempCRList, tempGList);
         repairSubWnd.ShowDialog();
     }
     else
     {
         McsfRestoreLogger.WriteLog("[RepairExucte]: class name is " + this.SelectResultItem.ClassName);
         var testWnd = new RepairWindowTest(this.SelectResultItem.ClassName);
         testWnd.ShowDialog();
     }
     McsfRestoreLogger.WriteLog("[RepairExucte]: end.");
 }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         McsfRestoreLogger.WriteLog("[BoolToSuccessConverter]: value is null.");
         return(false);
     }
     else
     {
         if ((bool)value)
         {
             return("Success");
         }
         else
         {
             McsfRestoreLogger.WriteLog("[BoolToSuccessConverter]: value is ." + value);
             return("Failed");
         }
     }
 }
Exemple #23
0
        public override void Execute()
        {
            string filePath = Arguments[0];

            try
            {
                Require <InitialReadStream>(filePath);
                string message = Require <GetMessageInFileHead>();

                Export = message;
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog(string.Format("[GetMessageWorkflow]: exception is {0},{1}", ex.Message, ex.ToString()));
                throw ex;
            }
            finally
            {
                Require <CloseReadStream>();
            }
        }
Exemple #24
0
        public override void Execute()
        {
            var message = Arguments[0];

            try
            {
                Dictionary <string, string> messageDic = new JavaScriptSerializer().Deserialize <Dictionary <string, string> >(message);
                Export = messageDic.ContainsKey("SystemID");
                McsfRestoreLogger.WriteLog("[IsMessageBranch69]:" + messageDic.ContainsKey("SystemID"));
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[IsMessageBranch69]: ex is " + ex.Message);
                if (ex.Message.Contains("Invalid JSON primitive") || ex.Message.Contains("无效的 JSON 基元"))
                {
                    McsfRestoreLogger.WriteLog("[IsMessageBranch69]: message is not branch 69.");
                    Export = false;
                    return;
                }
            }
        }
 /// <summary>
 /// Delete 1!2@3#4$5%6^7&.a1b2c3 file in all sub folders in the specified directory
 /// </summary>
 /// <param name="path">The path of the specified directory</param>
 public bool DeleteSpecialFile(string path)
 {
     try
     {
         DirectoryInfo dirDirectory     = new DirectoryInfo(path);
         FileInfo[]    specialFileArray = dirDirectory.GetFiles("*.a1b2c3", SearchOption.AllDirectories);
         foreach (FileInfo file in specialFileArray)
         {
             if ("1!2@3#4$5%6^7&.a1b2c3" == file.Name)
             {
                 file.Delete();
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         McsfRestoreLogger.WriteLog("[DeleteSpecialFile]: exception: " + ex.Message);
         throw ex;
     }
 }
Exemple #26
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (values == null || values.Length < 2)
     {
         McsfRestoreLogger.WriteLog("[MultiVisibilityConverter]: values is null or lenght is less 2.");
         return(Visibility.Collapsed);
     }
     if (values.Length == 2)
     {
         if ((bool)values[0] || (bool)values[1])
         {
             McsfRestoreLogger.WriteLog(string.Format("[MultiVisibilityConverter]: values 0 is {0} and 1 is {1}", values[0], values[1]));
             return(Visibility.Collapsed);
         }
         else
         {
             return(Visibility.Visible);
         }
     }
     McsfRestoreLogger.WriteLog("[MultiVisibilityConverter]: values length is " + values.Length);
     return(Visibility.Collapsed);
 }
        private string GetCurrentTimeFormat()//for zip use
        {
            string currnetNow  = DateTime.Now.ToShortDateString();
            string str_China   = DateTime.Now.ToString("yyyy/MM/dd", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            string str_America = DateTime.Now.ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            string str_Europe  = DateTime.Now.ToString("dd/MM/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            McsfRestoreLogger.WriteLog("[GetCurrentTimeFormat]: start " + currnetNow);
            if (currnetNow.Equals(str_China))
            {
                return(flag_China);
            }
            if (currnetNow.Equals(str_America))
            {
                return(flag_America);
            }
            if (currnetNow.Equals(str_Europe))
            {
                return(flag_Europe);
            }
            return("");
        }
Exemple #28
0
        public override void Execute()
        {
            string sourceFilePath = Arguments[0];
            string targetFilePath = Arguments[1];

            try
            {
                Require <CreateEmptyFile>(targetFilePath);
                Require <InitialStream>(sourceFilePath, targetFilePath);
                Require <ReadFileHeadByte>();
                Require <CopyContentBlockByte>();
                Require <CopyContentRemainderByte>();
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog(string.Format("[DeleteMessageWorkflow]: throw exception:{0},{1}", ex.Message, ex.ToString()));
                throw ex;
            }
            finally
            {
                Require <CloseStream>();
            }
        }
        public override void Execute()
        {
            var message = Arguments[0];

            McsfRestoreLogger.WriteLog("[GetBranch69FormerFiles]: GetBranch69FormerFiles  Begin .");
            if (null == message)
            {
                Export = null;
                return;
            }

            try
            {
                List <string> FilesList    = new List <string>();
                var           xDoc_Restore = new XmlDocument();
                xDoc_Restore.LoadXml(message);
                XmlNodeList packageNodeList = xDoc_Restore.SelectNodes("Root/Packages/Package");
                foreach (XmlNode packageNode in packageNodeList)
                {
                    XmlNode groupsNode = packageNode.SelectSingleNode("Groups");
                    if (null != groupsNode)
                    {
                        XmlNodeList groupNodeList = groupsNode.SelectNodes("Group");
                        if (groupNodeList != null)
                        {
                            foreach (XmlNode groupNode in groupNodeList)
                            {
                                var         fileCounter   = 0;
                                XmlNodeList FilesNodeList = groupNode.SelectNodes("Files");
                                if (null != FilesNodeList)
                                {
                                    foreach (XmlNode filesNode in FilesNodeList)
                                    {
                                        XmlNodeList fileNodeList = filesNode.SelectNodes("File");
                                        if (null != fileNodeList)
                                        {
                                            foreach (XmlNode file in fileNodeList)
                                            {
                                                if (null != file && null != file.Attributes["Name"])
                                                {
                                                    string module         = (null == file.Attributes["Module"]) ? string.Empty : file.Attributes["Module"].Value;
                                                    string filePath       = file.Attributes["Name"].Value;
                                                    var    fileFolderPath = string.Format(@"{0}\{1}\{2}\{2}{3}\", RestoreToolConstant.DECOMPRESS_FOLDER, packageNode.Attributes["Name"].Value, groupNode.Attributes["Name"].Value, fileCounter++);
                                                    var    backupPath     = IsFolder(filePath)
                                                           ? string.Format(@"{0}{1}\", fileFolderPath, new DirectoryInfo(filePath).Name)
                                                           : string.Format("{0}{1}", fileFolderPath, new FileInfo(filePath).Name);

                                                    if (module.Equals(string.Empty))
                                                    {
                                                        FilesList.Add(backupPath);
                                                    }
                                                    else
                                                    {
                                                        FilesList.Add(module + "|" + backupPath);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                Export = FilesList;
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[GetBranch69FormerFiles]: ex is " + ex);
                Export = new List <string>();
            }
        }
        public override void Execute()
        {
            McsfRestoreLogger.WriteLog("[RestoreFiles]: RestoreFiles begin.");
            List <string> packageList = Arguments[0];
            string        message     = Arguments[1];

            restoreAciton = Arguments[2];
            //List<string> Users = Require<GetUsers>();
            List <string> Users = null;
            Dictionary <string, string> oldSwVersions = Require <GetOldSWVersionsDictionary>(message);
            bool          isBkpBranch69 = Require <IsMessageBranch69>(message) ? true : false;
            DllRefection  reflection    = new DllRefection();
            List <string> Files         = new List <string>();
            object        result;
            string        response = string.Empty;
            //get gourp info
            List <Dictionary <string, object> > groupListResult = Require <GetGroupInfo>();

            McsfRestoreLogger.WriteLog("[RestoreFiles]: groupListResult count is " + groupListResult.Count);
            try
            {
                for (var i = 0; i < groupListResult.Count; i++)
                {
                    var    group       = groupListResult[i];
                    string packageName = group.ContainsKey("packageName") ? (string)group["packageName"] : string.Empty;

                    if (string.IsNullOrWhiteSpace(packageName) || !packageList.Contains(packageName))
                    {
                        McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: packageName is {0}, packageName is null or packageList do not contains.", packageName));
                        continue;
                    }
                    //车载配置合并逻辑和rollback功能省略
                    string moduleName = (group.ContainsKey("moduleName")) ? (string)group["moduleName"] : string.Empty;
                    McsfRestoreLogger.WriteLog("[RestoreFiles]: Begin restore :" + moduleName);
                    if (isBkpBranch69)//如果bkp是69及之后的,Files从当前环境的servicerestore.xml中读取
                    {
                        Files = (!group.ContainsKey("Files")) ? new List <string>() : (List <string>)group["Files"];
                    }

                    //反射依次调用PreRestoreHandler
                    if (group.ContainsKey("PreRestoreHandler"))
                    {
                        var PreRestoreHandler = (string)group["PreRestoreHandler"];
                        SendMessage(string.Format("{0} preRestoreHandler begin", PreRestoreHandler));
                        McsfRestoreLogger.WriteLog("[RestoreFiles]: Begin PreRestoreHandler: " + PreRestoreHandler);
                        List <string> PreRestoreHandlerFiles = new List <string>();
                        if (!isBkpBranch69) //如果bkp是69之前的,Files从bkp的头读取.
                        {
                            ///固定路径
                            PreRestoreHandlerFiles = Require <GetBranch69FormerFiles>(message);
                        }
                        else
                        {
                            PreRestoreHandlerFiles = (!group.ContainsKey("Files")) ? new List <string>() : (List <string>)group["Files"];
                        }
                        try
                        {
                            SendMessage(string.Format("{0} preRestoreHandler ...", PreRestoreHandler));
                            result = reflection.DLLReflection(PreRestoreHandler, "UIH.Mcsf.Restore", "McsfRestore", "PreRestoreHandler", new object[] { oldSwVersions, RestoreToolConstant.SYSTEM_Restore_FOLDER, Users, PreRestoreHandlerFiles }, out response);
                            SendMessage(string.Format("{0} preRestoreHandler complete", PreRestoreHandler));
                        }
                        catch (Exception ex)
                        {
                            McsfRestoreLogger.WriteLog("[RestoreFiles]:exception is " + ex);
                            result = 1;
                        }
                        if (((result is int) && 0 != (int)result && 2 != (int)result) || ((result is bool) && !(bool)result))
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]:PreRestoreHandler {0},{1} failed, response is {2}:", moduleName, PreRestoreHandler, response));
                            //省去回滚操作
                            Export = false;
                            SendMessage(string.Format("{0} preRestoreHandler failed", PreRestoreHandler));
                        }
                        else if ((result is int) && 2 == (int)result)
                        {
                            //displayWarningInfoFlag = false;
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PreRestoreHandler {0},{1} successfully, Negligible error occurred.", moduleName, PreRestoreHandler));
                            SendMessage(string.Format("{0} preRestoreHandler success", PreRestoreHandler));
                        }
                        else if ((result is int) && 0 == (int)result)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PreRestoreHandler {0},{1} successfully.", moduleName, PreRestoreHandler));
                            SendMessage(string.Format("{0} preRestoreHandler success", PreRestoreHandler));
                        }
                        else
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PreRestoreHandler {0} {1} , result is {2} and response is {3}", moduleName, PreRestoreHandler, result, response));
                            Export = false;
                            SendMessage(string.Format("{0} preRestoreHandler failed", PreRestoreHandler));
                        }
                    }


                    List <string> handlerFiles = (!group.ContainsKey("Files")) ? new List <string>() : (List <string>)group["Files"];

                    //反射依次调用RestoreHandler
                    if (group.ContainsKey("RestoreHandler"))
                    {
                        var restoreHandler = (string)group["RestoreHandler"];
                        McsfRestoreLogger.WriteLog("[RestoreFiles]: Begin RestoreHandler: " + restoreHandler);
                        SendMessage(string.Format("{0} restoreHandler begin", restoreHandler));
                        try
                        {
                            SendMessage(string.Format("{0} restoreHandler ...", restoreHandler));
                            result = reflection.DLLReflection(restoreHandler, "UIH.Mcsf.Restore", "McsfRestore", "RestoreHandler", new object[] { oldSwVersions, RestoreToolConstant.SYSTEM_Restore_FOLDER, Users, handlerFiles }, out response);
                            SendMessage(string.Format("{0} restoreHandler complete", restoreHandler));
                        }
                        catch (Exception ex)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: RestoreHandler {0} failed. exception is {1}", restoreHandler, ex));
                            result = 1;
                        }

                        if (((result is int) && 0 != (int)result && 2 != (int)result) || ((result is bool) && !(bool)result))
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: RestoreHandler {0},{1} failed, response is {2}:", moduleName, restoreHandler, response));
                            Export = false;
                            SendMessage(string.Format("{0} restoreHandler failed", restoreHandler));
                        }
                        else if ((result is int) && 2 == (int)result)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: RestoreHandler {0},{1} successfully,Negligible error occurred.", moduleName, restoreHandler));
                            SendMessage(string.Format("{0} restoreHandler failed", restoreHandler));
                        }
                        else if ((result is int) && 0 == (int)result)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: RestoreHandler {0} successfully.", moduleName));
                            SendMessage(string.Format("{0} restoreHandler success", restoreHandler));
                        }
                        else
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PreRestoreHandler {0} {1} , result is {2} and response is {3}", moduleName, restoreHandler, result, response));
                            Export = false;
                            SendMessage(string.Format("{0} restoreHandler failed", restoreHandler));
                        }
                    }


                    //反射依次调用PostRestoreHandler
                    if (group.ContainsKey("PostRestoreHandler"))
                    {
                        var postRestoreHandler = (string)group["PostRestoreHandler"];
                        McsfRestoreLogger.WriteLog("[RestoreFiles]: Begin PostRestoreHandler: " + postRestoreHandler);
                        SendMessage(string.Format("{0} postRestoreHandler begin", postRestoreHandler));
                        try
                        {
                            SendMessage(string.Format("{0} postRestoreHandler ...", postRestoreHandler));
                            result = reflection.DLLReflection(postRestoreHandler, "UIH.Mcsf.Restore", "McsfRestore", "PostRestoreHandler", new object[] { oldSwVersions, RestoreToolConstant.SYSTEM_Restore_FOLDER, Users, handlerFiles }, out response);
                            SendMessage(string.Format("{0} postRestoreHandler complete", postRestoreHandler));
                        }
                        catch (Exception ex)
                        {
                            McsfRestoreLogger.WriteLog("[RestoreFiles]: postRestoreHandler exception is " + ex, LogMessageType.Error);
                            result = 1;
                        }

                        if (((result is int) && 0 != (int)result && 2 != (int)result) || ((result is bool) && !(bool)result))
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PostRestoreHandler {0},{1} failed, response is {2}:", moduleName, postRestoreHandler, response));
                            Export = false;
                            SendMessage(string.Format("{0} postRestoreHandler failed", postRestoreHandler));
                        }
                        else if ((result is int) && 2 == (int)result)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PostRestoreHandler {0},{1} successfully, Negligible error occurred.", moduleName, postRestoreHandler));
                            SendMessage(string.Format("{0} postRestoreHandler success", postRestoreHandler));
                        }
                        else if ((result is int) && 0 == (int)result)
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PostRestoreHandler {0},{1} successfully.", moduleName, postRestoreHandler));
                            SendMessage(string.Format("{0} postRestoreHandler success", postRestoreHandler));
                        }
                        else
                        {
                            McsfRestoreLogger.WriteLog(string.Format("[RestoreFiles]: PostRestoreHandler {0} {1} , result is {2} and response is {3}", moduleName, postRestoreHandler, result, response));
                            Export = false;
                            SendMessage(string.Format("{0} postRestoreHandler failed", postRestoreHandler));
                        }
                    }
                }
                if (Directory.Exists(RestoreToolConstant.SYSTEM_Restore_FOLDER))
                {
                    SendMessage("Delete files begin");
                    Require <DeleteFolderAndSubFiles>(RestoreToolConstant.Restore_FOLDER);
                    McsfRestoreLogger.WriteLog("[RestoreFiles]: DeleteFolderAndSubFiles end.");
                    SendMessage("Delete files end");
                }
                McsfRestoreLogger.WriteLog("[RestoreFiles]: RestoreFiles end.");
            }
            catch (Exception ex)
            {
                McsfRestoreLogger.WriteLog("[RestoreFiles]:ex is " + ex.Message);
            }

            Export = true;
        }