示例#1
0
        private void CheckUpdate(object parameter)
        {
            EnumCheckFileResult result = EnumCheckFileResult.Ok;

            string sourcePath  = this.InstallPath.Trim();
            string packagePath = this.SetUpPackagePath.Trim();

            this.CheckResult = string.Empty;
            result           = CheckFileUpdate(sourcePath, packagePath);
            if (result == EnumCheckFileResult.Ok)
            {
                MessageBoxHelper.MessageBoxShowSuccess("文件替换成功!请继续核实脚本是否执行成功。");
            }
            else if (result == EnumCheckFileResult.Faild)
            {
                Notice.Show("JieLink软件升级失败", "通知", 3, MessageBoxIcon.Warning);
                UpdateFaildNotify?.Invoke("CheckFiles");
            }
            else if (result == EnumCheckFileResult.Error)
            {
                MessageBoxHelper.MessageBoxShowError("检查升级出错!");
            }
        }
        private void CheckUpdate(object parameter)
        {
            string msg            = string.Empty;
            EnumCheckFileResult r = EnumCheckFileResult.Ok;

            if (string.IsNullOrEmpty(this.SourceFilePath) || string.IsNullOrEmpty(this.PackageFilePath))
            {
                MessageBoxX.Show("软件安装目录和安装包路径不能为空", "失败");
                return;
            }
            string sourcePath  = this.SourceFilePath.Trim();
            string packagePath = this.PackageFilePath.Trim();

            this.Result = string.Empty;
            //foreach (var dir in dirs)
            //{
            //    msg = $"开始检查目录{dir}……\n";
            //    this.Result += msg;
            //    sourcePath = Path.Combine(this.SourceFilePath.Trim(), dir);
            //    r = CheckFileUpdate(sourcePath, packagePath);
            //    msg = $"完成检查目录{dir}……\n";
            //    this.Result += msg;
            //    if (r == EnumCheckFileResult.FILE_ERROR1 || r == EnumCheckFileResult.OTHER_ERROR)
            //    {
            //        break;
            //    }
            //}
            r = CheckFileUpdate(sourcePath, packagePath);
            if (r == EnumCheckFileResult.Error)
            {
                MessageBoxX.Show("JieLink软件升级失败!\n请按照下方步骤升级。", "失败", null, MessageBoxButton.OK);
            }
            else if (r == EnumCheckFileResult.Ok)
            {
                MessageBoxX.Show("JieLink软件升级成功!", "成功", null, MessageBoxButton.OK);
            }
        }