示例#1
0
        public void FirmwareCombine(FwTools.FwFormat format, TestData.Fw fw_path1, TestData.Fw fw_path2)
        {
            foreach (TestData.Fw fw in fw_path1.GetFlags())
            {
                var(Fw, Format1, Format2) = FwTools.Combine(TestData.GetFwPath(fw), TestData.GetFwPath(fw_path2), format);

                Assert.True(Fw != "");
            }
        }
示例#2
0
        public void Combine()
        {
            string err = "";

            if (this.CombineWith == "" || !File.Exists(this.CombineWith))
            {
                err += $"{ERR2}\n";
            }

            if (this.CombineDestination == "" || !Directory.Exists(Path.GetDirectoryName(this.CombineDestination)))
            {
                err += $"{ERR3}\n";
            }

            if (err != "")
            {
                MessageBox.Show(err.TrimEnd('\n'), "BS430.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            try
            {
                var(Fw, Format1, Format2) = FwTools.Combine(this.FwPath,
                                                            this.CombineWith,
                                                            this.CombineFormat,
                                                            this.CombineFillFF,
                                                            BslSettings.Instance.FwWriteLineLength);
                using (StreamWriter wr = new StreamWriter(this.CombineDestination, false))
                {
                    wr.Write(Fw);
                }
                MessageBox.Show($"{COMBINE_SUCCESS}\n{this.CombineDestination}", "BS430.NET", MessageBoxButton.OK, MessageBoxImage.Information);
                coordinator.HideMetroDialogAsync(this, dialogCombine, dialogSettings);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetExceptionMsg(), "BSL430.NET", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }