1.未选择文件禁止升级 2.优化提示 3.文件校验错误禁止升级
This commit is contained in:
@@ -168,6 +168,7 @@ namespace WinISP
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TopMost = true;
|
TopMost = true;
|
||||||
|
btnAuto.Enabled = false;
|
||||||
Connect();
|
Connect();
|
||||||
_lastNumOfMonitors = _numberOfMonitors;
|
_lastNumOfMonitors = _numberOfMonitors;
|
||||||
Application.Idle += Application_Idle;
|
Application.Idle += Application_Idle;
|
||||||
@@ -486,6 +487,7 @@ namespace WinISP
|
|||||||
frmISP.WriteLog("btnLoadFile_Click exception: " + ex.GetType().Name + ": " + ex.Message, "debug");
|
frmISP.WriteLog("btnLoadFile_Click exception: " + ex.GetType().Name + ": " + ex.Message, "debug");
|
||||||
MessageBox.Show(this, "加载文件失败: " + ex.GetType().Name + "\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(this, "加载文件失败: " + ex.GetType().Name + "\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
SetStatusMsg("Could not read file from disk.", true);
|
SetStatusMsg("Could not read file from disk.", true);
|
||||||
|
btnAuto.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_binFilePath == String.Empty)
|
if (_binFilePath == String.Empty)
|
||||||
@@ -504,10 +506,12 @@ namespace WinISP
|
|||||||
{
|
{
|
||||||
SetStatusMsg(verifyErr, true);
|
SetStatusMsg(verifyErr, true);
|
||||||
SetStatusMsg("Please select a F/W file.");
|
SetStatusMsg("Please select a F/W file.");
|
||||||
|
btnAuto.Enabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetStatusMsg("BIN loaded. Ready to upgrade.");
|
SetStatusMsg("BIN loaded. Ready to upgrade.");
|
||||||
|
btnAuto.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -643,7 +647,7 @@ namespace WinISP
|
|||||||
//if (IsConnect)
|
//if (IsConnect)
|
||||||
{
|
{
|
||||||
//WriteLog("IsConnect = true", "debug");
|
//WriteLog("IsConnect = true", "debug");
|
||||||
btnAuto.Enabled = true;
|
btnAuto.Enabled = !String.IsNullOrEmpty(_binFilePath);
|
||||||
if (String.IsNullOrEmpty(_binFilePath))
|
if (String.IsNullOrEmpty(_binFilePath))
|
||||||
SetStatusMsg("Please select a F/W file.");
|
SetStatusMsg("Please select a F/W file.");
|
||||||
else
|
else
|
||||||
@@ -1623,7 +1627,7 @@ namespace WinISP
|
|||||||
{
|
{
|
||||||
// BIN has a version but monitor version is unreadable – treat as mismatch.
|
// BIN has a version but monitor version is unreadable – treat as mismatch.
|
||||||
frmISP.WriteLog("ValidateMonitorVsBin: effVer is empty, cannot verify FW version.", "debug");
|
frmISP.WriteLog("ValidateMonitorVsBin: effVer is empty, cannot verify FW version.", "debug");
|
||||||
errMsg = "FWVersion not match" ;
|
errMsg = "FW Version not match." ;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string normalizedMonVer = NormalizeFwVersionForCompare(effVer);
|
string normalizedMonVer = NormalizeFwVersionForCompare(effVer);
|
||||||
@@ -1631,7 +1635,7 @@ namespace WinISP
|
|||||||
frmISP.WriteLog("ValidateMonitorVsBin: normalizedMonVer=" + normalizedMonVer + " normalizedBinVer=" + normalizedBinVer, "debug");
|
frmISP.WriteLog("ValidateMonitorVsBin: normalizedMonVer=" + normalizedMonVer + " normalizedBinVer=" + normalizedBinVer, "debug");
|
||||||
if (!string.Equals(normalizedMonVer, normalizedBinVer, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(normalizedMonVer, normalizedBinVer, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
errMsg = "FWVersion not match";
|
errMsg = "FW Version not match.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1692,6 +1696,7 @@ namespace WinISP
|
|||||||
if (!ValidateMonitorVsBin(out checkErr))
|
if (!ValidateMonitorVsBin(out checkErr))
|
||||||
{
|
{
|
||||||
SetStatusMsg(checkErr, true);
|
SetStatusMsg(checkErr, true);
|
||||||
|
btnAuto.Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prbProgress.Maximum = flashSectorInfo.Count;
|
prbProgress.Maximum = flashSectorInfo.Count;
|
||||||
@@ -1745,6 +1750,7 @@ namespace WinISP
|
|||||||
{
|
{
|
||||||
SetStatusMsg(verifyErr, true);
|
SetStatusMsg(verifyErr, true);
|
||||||
SetISPStatus(false);
|
SetISPStatus(false);
|
||||||
|
btnAuto.Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2105,14 +2111,26 @@ namespace WinISP
|
|||||||
System.IO.Directory.CreateDirectory(resultFolder);
|
System.IO.Directory.CreateDirectory(resultFolder);
|
||||||
|
|
||||||
string path = resultFolder + (fileName == "" ? "" : fileName + "_") + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
|
string path = resultFolder + (fileName == "" ? "" : fileName + "_") + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
|
||||||
if (_logWriter == null || _logPath != path)
|
try
|
||||||
{
|
{
|
||||||
if (_logWriter != null) { _logWriter.Flush(); _logWriter.Close(); }
|
if (_logWriter == null || _logPath != path)
|
||||||
_logPath = path;
|
{
|
||||||
_logWriter = new System.IO.StreamWriter(path, append: true);
|
if (_logWriter != null)
|
||||||
|
{
|
||||||
|
_logWriter.Flush();
|
||||||
|
_logWriter.Close();
|
||||||
|
}
|
||||||
|
_logPath = path;
|
||||||
|
var stream = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
|
||||||
|
_logWriter = new System.IO.StreamWriter(stream);
|
||||||
|
}
|
||||||
|
_logWriter.WriteLine(DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss.fff: ") + str);
|
||||||
|
_logWriter.Flush();
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
// Ignore logging failures caused by file locks.
|
||||||
}
|
}
|
||||||
_logWriter.WriteLine(DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss.fff: ") + str);
|
|
||||||
_logWriter.Flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Byte[] InitBinaryFile(String filepath)
|
public static Byte[] InitBinaryFile(String filepath)
|
||||||
|
|||||||
Reference in New Issue
Block a user