Example #1
0
        public void Convert()
        {
            if (this.ConvertDestination == "" || !Directory.Exists(Path.GetDirectoryName(this.ConvertDestination)))
            {
                MessageBox.Show(ERR3, "BSL430.NET", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            try
            {
                var(Fw, Format) = FwTools.Convert(this.FwPath,
                                                  this.ConvertFormat,
                                                  this.ConvertFillFF,
                                                  BslSettings.Instance.FwWriteLineLength);

                using (StreamWriter wr = new StreamWriter(this.ConvertDestination, false))
                {
                    wr.Write(Fw);
                }
                MessageBox.Show($"{CONVERT_SUCCESS}\n{this.ConvertDestination}", "BS430.NET", MessageBoxButton.OK, MessageBoxImage.Information);
                coordinator.HideMetroDialogAsync(this, dialogConvert, dialogSettings);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetExceptionMsg(), "BSL430.NET", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #2
0
        public void FirmwareConvertTo(FwTools.FwFormat format, TestData.Fw fw_paths)
        {
            foreach (TestData.Fw fw in fw_paths.GetFlags())
            {
                var(Fw, Format) = FwTools.Convert(TestData.GetFwPath(fw), format);

                Assert.True(Fw.Length > 0);
            }
        }