/// <summary>
        ///   启动主程序并终止所有进程
        /// </summary>
        public static void StartMainApplication()
        {
            string currentPath = AppDomain.CurrentDomain.BaseDirectory;
            string iisBinPath  = AppDomain.CurrentDomain.RelativeSearchPath;
            string loadPath    = string.IsNullOrEmpty(iisBinPath) ? currentPath : iisBinPath;

            loadPath = Path.Combine(loadPath, "AutoUpdate");

            //ConfigurationManager.OpenExeConfiguration
            string runApplication = "Client.AutoUpdate.exe";

            try
            {
                //启动程序
                Process pr = new Process();
                pr.StartInfo.FileName = Path.Combine(loadPath, runApplication);
                pr.Start();          //运行

                Environment.Exit(0); // 终止此进程并为基础操作系统提供指定的退出代码。
            }
            catch (Exception ex)
            {
                ToolLogs.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "启动主程序并终止所有进程", ex);

                MessageBox.Show(@"启动更新程序失败,请检查配置文件是否正确。", @"错误");
                return;
            }
        }
        /// <summary>
        /// 复制文件
        /// </summary>
        /// <param name="fromDir"></param>
        /// <param name="toDir"></param>
        public static void CopyDir(string fromDir, string toDir)
        {
            if (!Directory.Exists(fromDir))
            {
                return;
            }

            if (!Directory.Exists(toDir))
            {
                Directory.CreateDirectory(toDir);
            }

            string[] files = Directory.GetFiles(fromDir);
            foreach (string formFileName in files)
            {
                string fileName   = Path.GetFileName(formFileName);
                string toFileName = Path.Combine(toDir, fileName);
                try
                {
                    File.Copy(formFileName, toFileName, true);
                    File.Delete(formFileName);
                }
                catch (Exception ex)
                {
                    ToolLogs.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "复制文件1", ex);
                }
            }
            string[] fromDirs = Directory.GetDirectories(fromDir);
            foreach (string fromDirName in fromDirs)
            {
                string dirName   = Path.GetFileName(fromDirName);
                string toDirName = Path.Combine(toDir, dirName);
                CopyDir(fromDirName, toDirName);

                try
                {
                    Directory.Delete(fromDirName);
                }
                catch (Exception ex)
                {
                    ToolLogs.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "复制文件2", ex);
                }
            }
        }