|
@@ -1,4 +1,5 @@
|
|
|
-using AwInitilizer.Model;
|
|
|
+using AwInitilizer.Assist;
|
|
|
+using AwInitilizer.Model;
|
|
|
using AwInitilizer.Procedure;
|
|
|
using MesAdaptor;
|
|
|
using Microsoft.Win32;
|
|
@@ -19,6 +20,7 @@ using System.Windows.Controls;
|
|
|
using System.Windows.Data;
|
|
|
using System.Windows.Documents;
|
|
|
using System.Windows.Input;
|
|
|
+using System.Windows.Interop;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Navigation;
|
|
@@ -125,9 +127,10 @@ namespace AwInitilizer
|
|
|
|
|
|
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
+ CheckDisplayManulEnterSN(e.Key);
|
|
|
ResetLogoutTimer();
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
private void SystemIDScanReseived(SystemID systemID)
|
|
|
{
|
|
|
ViewModel.IsInputCheckpassed = false;
|
|
@@ -193,6 +196,7 @@ namespace AwInitilizer
|
|
|
{
|
|
|
ViewModel.IsUdatIng = true;
|
|
|
UpdateStatus = UpdateStatus.Updating;
|
|
|
+ EvHttpClientLogger.Instance.StartNewLog(serialNumber);
|
|
|
_ = UpdateTask();
|
|
|
}
|
|
|
}
|
|
@@ -642,6 +646,7 @@ namespace AwInitilizer
|
|
|
ViewModel.ICCID = setting.ICCID;
|
|
|
ViewModel.IMSI = setting.IMSI;
|
|
|
ViewModel.SkipEmergencyButton = setting.SkipEmergencyButton;
|
|
|
+ ViewModel.SkipButtonTest = setting.SkipButtonTest;
|
|
|
ViewModel.FirmwareUpdateModels = setting.FirmwareUpdateList
|
|
|
.Where(x => !string.IsNullOrEmpty(x.Module) && !string.IsNullOrEmpty(x.FirmwareFileName)
|
|
|
).ToList();
|
|
@@ -774,59 +779,7 @@ namespace AwInitilizer
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- using (var fs = File.OpenRead(filePath))
|
|
|
- {
|
|
|
- byte[] systemIDBytes = new byte[16];
|
|
|
- if (fs.Read(systemIDBytes, 0, 16) == 16)
|
|
|
- {
|
|
|
- if (systemIDBytes.ToList().Contains(0x00))
|
|
|
- {
|
|
|
- int endIndex = Array.FindIndex(systemIDBytes, (x) => { return x == 0x00; });
|
|
|
- //int endIndex = parameter.FindIndex((x) => { return x == 0x00; });
|
|
|
- if (endIndex != default && endIndex != -1)
|
|
|
- {
|
|
|
- systemIDBytes = systemIDBytes.Take(endIndex).ToArray();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (ModelName.TryLooseParse(systemIDBytes, out var modelName))
|
|
|
- {
|
|
|
- if (modelName.ToString() != setting.ModelName)
|
|
|
- {
|
|
|
- //HintDialog.ShowMessage($"{model.Module} Firemware and ModelName is Mismatched");
|
|
|
- HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderMismatchAlert, model.Module));
|
|
|
- isCheckPassed = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
- HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderFormatAlert, model.Module));
|
|
|
- isCheckPassed = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
- HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderFormatAlert, model.Module));
|
|
|
- isCheckPassed = false;
|
|
|
- }
|
|
|
-
|
|
|
- //byte[] imgType = new byte[4];
|
|
|
- //if (fs.Read(imgType, 0, 4) == 4)
|
|
|
- //{
|
|
|
- // if (!imgType.SequenceEqual(new byte[] { 0x10, 0x00, 0x00, 0x04, }))
|
|
|
- // {
|
|
|
- // HintDialog.ShowMessage($"{model.Module} Firemware type ERROR");
|
|
|
- // isCheckPassed = false;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
- // isCheckPassed = false;
|
|
|
- //}
|
|
|
- }
|
|
|
+ //isCheckPassed = CheckFileHeaderModel(setting, isCheckPassed, model, filePath);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
@@ -843,8 +796,67 @@ namespace AwInitilizer
|
|
|
}
|
|
|
|
|
|
return isCheckPassed;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ private static bool CheckFileHeaderModel(SettingConfig setting, bool isCheckPassed, FirmwareUpdateModel model, string filePath)
|
|
|
+ {
|
|
|
+ using (var fs = File.OpenRead(filePath))
|
|
|
+ {
|
|
|
+ byte[] systemIDBytes = new byte[16];
|
|
|
+ if (fs.Read(systemIDBytes, 0, 16) == 16)
|
|
|
+ {
|
|
|
+ if (systemIDBytes.ToList().Contains(0x00))
|
|
|
+ {
|
|
|
+ int endIndex = Array.FindIndex(systemIDBytes, (x) => { return x == 0x00; });
|
|
|
+ //int endIndex = parameter.FindIndex((x) => { return x == 0x00; });
|
|
|
+ if (endIndex != default && endIndex != -1)
|
|
|
+ {
|
|
|
+ systemIDBytes = systemIDBytes.Take(endIndex).ToArray();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ModelName.TryLooseParse(systemIDBytes, out var modelName))
|
|
|
+ {
|
|
|
+ if (modelName.ToString() != setting.ModelName)
|
|
|
+ {
|
|
|
+ //HintDialog.ShowMessage($"{model.Module} Firemware and ModelName is Mismatched");
|
|
|
+ HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderMismatchAlert, model.Module));
|
|
|
+ isCheckPassed = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
+ HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderFormatAlert, model.Module));
|
|
|
+ isCheckPassed = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
+ HintDialog.ShowMessage(string.Format(Resx.AppResources.InitFirmwareFileHeaderFormatAlert, model.Module));
|
|
|
+ isCheckPassed = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //byte[] imgType = new byte[4];
|
|
|
+ //if (fs.Read(imgType, 0, 4) == 4)
|
|
|
+ //{
|
|
|
+ // if (!imgType.SequenceEqual(new byte[] { 0x10, 0x00, 0x00, 0x04, }))
|
|
|
+ // {
|
|
|
+ // HintDialog.ShowMessage($"{model.Module} Firemware type ERROR");
|
|
|
+ // isCheckPassed = false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // HintDialog.ShowMessage($"{model.Module} Firemware header ERROR");
|
|
|
+ // isCheckPassed = false;
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ return isCheckPassed;
|
|
|
+ }
|
|
|
+
|
|
|
private void ResetLogoutTimer()
|
|
|
{
|
|
|
if (LogoutTimer != null)
|
|
@@ -963,6 +975,34 @@ namespace AwInitilizer
|
|
|
uxStatus.Foreground = new SolidColorBrush(Colors.White);
|
|
|
uxStatus.Content = Resx.AppResources.StatusFail;//"Fail";
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CheckDisplayManulEnterSN(Key key)
|
|
|
+ {
|
|
|
+ if (key != Key.F1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var dialog = new ManualSn() {};
|
|
|
+ try
|
|
|
+ {
|
|
|
+ dialog.Owner = Application.Current.MainWindow;
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ dialog.ShowDialog();
|
|
|
+ var enteredSN = dialog.EnteredSn;
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(enteredSN)||
|
|
|
+ !SystemID.TryLooseParse(enteredSN, out var enteredSystemID))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ SystemIDScanReseived(enteredSystemID);
|
|
|
}
|
|
|
}
|
|
|
}
|