diff --git a/src/EfuseManager/MainWindow.xaml b/src/EfuseManager/MainWindow.xaml
index bca5a00..1464723 100644
--- a/src/EfuseManager/MainWindow.xaml
+++ b/src/EfuseManager/MainWindow.xaml
@@ -16,6 +16,7 @@
+
@@ -63,5 +64,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/EfuseManager/ViewModels/EfuseMapViewModel.cs b/src/EfuseManager/ViewModels/EfuseMapViewModel.cs
index c081b59..19dc1e8 100644
--- a/src/EfuseManager/ViewModels/EfuseMapViewModel.cs
+++ b/src/EfuseManager/ViewModels/EfuseMapViewModel.cs
@@ -14,4 +14,9 @@ public void LoadData(byte[] efuseMap)
{
_originalData = efuseMap;
}
+
+ public byte[] GetData()
+ {
+ return _originalData;
+ }
}
\ No newline at end of file
diff --git a/src/EfuseManager/ViewModels/MainViewModel.cs b/src/EfuseManager/ViewModels/MainViewModel.cs
index 193e348..6965e00 100644
--- a/src/EfuseManager/ViewModels/MainViewModel.cs
+++ b/src/EfuseManager/ViewModels/MainViewModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -14,6 +15,7 @@
using Microsoft.Extensions.Logging.Abstractions;
using MvvmDialogs;
+using MvvmDialogs.FrameworkDialogs.SaveFile;
using Rtl8812auNet;
using Rtl8812auNet.Rtl8812au.Enumerations;
@@ -25,6 +27,7 @@ internal class MainViewModel : ObservableObject, IDisposable
private readonly IDialogService _dialogService;
private readonly WiFiDriver _driver;
private DeviceViewModel? _selectedDevice;
+ private string _status = "";
public MainViewModel(IDialogService dialogService)
{
@@ -59,6 +62,12 @@ public DeviceViewModel? SelectedDevice
public EfuseMapViewModel EfuseMap { get; } = new();
+ public string Status
+ {
+ get => _status;
+ set => SetProperty(ref _status, value);
+ }
+
private void ExecuteWrite()
{
_dialogService.ShowMessageBox(
@@ -73,9 +82,11 @@ private void ExecuteRead()
{
if (SelectedDevice == null)
{
+ Status = "Error: No device selected";
return;
}
+ Status = "Start read";
var device = SelectedDevice.RealDevice;
var rtlDevice = _driver.CreateRtlDevice(device);
rtlDevice.NetDevOpen(new()
@@ -87,16 +98,26 @@ private void ExecuteRead()
});
var efuseMap = rtlDevice.ReadEfuse();
EfuseMap.LoadData(efuseMap);
+ Status = "Ready. OK.";
}
private void ExecuteWriteFile()
{
- _dialogService.ShowMessageBox(
+ var efuseMap = EfuseMap.GetData();
+ var saveFileDialogSettings = new SaveFileDialogSettings()
+ {
+ AddExtension = true,
+ DefaultExt = ".bin"
+ };
+ var isOk = _dialogService.ShowSaveFileDialog(
this,
- "Not implemented",
- "Not implemented",
- MessageBoxButton.OK,
- MessageBoxImage.Warning);
+ saveFileDialogSettings);
+ if (isOk == true)
+ {
+ File.WriteAllBytes(
+ saveFileDialogSettings.FileName,
+ efuseMap);
+ }
}
private void ExecuteReadFile()