V3.15 iterim BR changes
This commit is contained in:
39
AiQ_GUI.Designer.cs
generated
39
AiQ_GUI.Designer.cs
generated
@@ -148,6 +148,7 @@ namespace AiQ_GUI
|
||||
BtnFirewall = new Button();
|
||||
TabImages = new TabPage();
|
||||
TabSoak = new TabPage();
|
||||
BtnFactoryDefault = new Button();
|
||||
SetGodModeAll = new Button();
|
||||
BtnUploadBlob = new Button();
|
||||
CkBxTickAll = new CheckBox();
|
||||
@@ -157,7 +158,6 @@ namespace AiQ_GUI
|
||||
LblGUIVers = new Label();
|
||||
timerTypeIP = new System.Windows.Forms.Timer(components);
|
||||
TimerFlash = new System.Windows.Forms.Timer(components);
|
||||
BtnFactoryDefault = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)PicBxMAV).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)PicBxAiQ).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)PicBxIRF2).BeginInit();
|
||||
@@ -273,6 +273,7 @@ namespace AiQ_GUI
|
||||
CbBxUserName.Items.AddRange(new object[] { "Guest", "Clive", "Conor", "Charlie", "Henry", "Sam C", "Sam L", "Simon", "Toby", "Tom" });
|
||||
CbBxUserName.Location = new Point(10, 262);
|
||||
CbBxUserName.Margin = new Padding(4, 3, 4, 3);
|
||||
CbBxUserName.MaxDropDownItems = 20;
|
||||
CbBxUserName.Name = "CbBxUserName";
|
||||
CbBxUserName.Size = new Size(233, 25);
|
||||
CbBxUserName.TabIndex = 159;
|
||||
@@ -1910,6 +1911,24 @@ namespace AiQ_GUI
|
||||
TabSoak.TabIndex = 2;
|
||||
TabSoak.Text = "Soak";
|
||||
//
|
||||
// BtnFactoryDefault
|
||||
//
|
||||
BtnFactoryDefault.BackColor = Color.FromArgb(70, 65, 80);
|
||||
BtnFactoryDefault.Enabled = false;
|
||||
BtnFactoryDefault.FlatAppearance.BorderColor = Color.FromArgb(70, 65, 80);
|
||||
BtnFactoryDefault.FlatAppearance.BorderSize = 0;
|
||||
BtnFactoryDefault.FlatStyle = FlatStyle.Flat;
|
||||
BtnFactoryDefault.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
|
||||
BtnFactoryDefault.ForeColor = SystemColors.Control;
|
||||
BtnFactoryDefault.Location = new Point(222, 209);
|
||||
BtnFactoryDefault.Margin = new Padding(4, 3, 4, 3);
|
||||
BtnFactoryDefault.Name = "BtnFactoryDefault";
|
||||
BtnFactoryDefault.Size = new Size(181, 49);
|
||||
BtnFactoryDefault.TabIndex = 242;
|
||||
BtnFactoryDefault.Text = "Set Modules to Factory Defaults";
|
||||
BtnFactoryDefault.UseVisualStyleBackColor = false;
|
||||
BtnFactoryDefault.Click += BtnFactoryDefault_Click;
|
||||
//
|
||||
// SetGodModeAll
|
||||
//
|
||||
SetGodModeAll.BackColor = Color.FromArgb(70, 65, 80);
|
||||
@@ -2000,24 +2019,6 @@ namespace AiQ_GUI
|
||||
timerTypeIP.Interval = 2000;
|
||||
timerTypeIP.Tick += timerTypeIP_Tick;
|
||||
//
|
||||
// BtnFactoryDefault
|
||||
//
|
||||
BtnFactoryDefault.BackColor = Color.FromArgb(70, 65, 80);
|
||||
BtnFactoryDefault.Enabled = false;
|
||||
BtnFactoryDefault.FlatAppearance.BorderColor = Color.FromArgb(70, 65, 80);
|
||||
BtnFactoryDefault.FlatAppearance.BorderSize = 0;
|
||||
BtnFactoryDefault.FlatStyle = FlatStyle.Flat;
|
||||
BtnFactoryDefault.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
|
||||
BtnFactoryDefault.ForeColor = SystemColors.Control;
|
||||
BtnFactoryDefault.Location = new Point(222, 209);
|
||||
BtnFactoryDefault.Margin = new Padding(4, 3, 4, 3);
|
||||
BtnFactoryDefault.Name = "BtnFactoryDefault";
|
||||
BtnFactoryDefault.Size = new Size(181, 49);
|
||||
BtnFactoryDefault.TabIndex = 242;
|
||||
BtnFactoryDefault.Text = "Set Modules to Factory Defaults";
|
||||
BtnFactoryDefault.UseVisualStyleBackColor = false;
|
||||
BtnFactoryDefault.Click += BtnFactoryDefault_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
|
||||
74
AiQ_GUI.cs
74
AiQ_GUI.cs
@@ -218,7 +218,7 @@ namespace AiQ_GUI
|
||||
// If there are any actions identified then fail the test.
|
||||
// If any labels are red then fail. Only labels in panel so can foreach on labels not controls
|
||||
if (RhTxBxActions.Text.Length > 2 || PnlLbls.Controls.OfType<Label>().Any(c => c.ForeColor == Color.Red) == true)
|
||||
await TestFailed(BtnStartTest);// If approved then pass otherwise GUI would have restarted before getting to TestPassed.
|
||||
await TestFailed(BtnStartTest, "Failed due to action box text and/or red label");// If approved then pass otherwise GUI would have restarted before getting to TestPassed.
|
||||
|
||||
await TestPassed(PCTime);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ namespace AiQ_GUI
|
||||
// Purge camera of all reads
|
||||
await FlexiAPI.APIHTTPRequest("/api/purge-all", CamOnTest.IP);
|
||||
|
||||
if (await DisplayQuestion("Do you want to set this camera to 211 and God mode?"))
|
||||
if (await DisplayQuestion("Do you want to set this camera to 211 and God mode off?"))
|
||||
{
|
||||
// Turn off God mode
|
||||
string[,] GOD_JSON = { { "propGodMode", "false" } };
|
||||
@@ -331,17 +331,14 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
public async Task TestFailed(Button Btn, string ErrMssg)
|
||||
{
|
||||
AddToActionsList(ErrMssg);
|
||||
await TestFailed(Btn);
|
||||
}
|
||||
|
||||
private async Task TestFailed(Button Btn)
|
||||
{
|
||||
// Indicators to the user the test has failed
|
||||
Btn.BackColor = Color.Maroon;
|
||||
Btn.Text = "Test Failed";
|
||||
|
||||
AddToActionsList(ErrMssg);
|
||||
// TODO Track Tests Failed
|
||||
|
||||
if (await DisplayQuestion("Test failed, appeal?" + Environment.NewLine + "See Actions textbox for details."))
|
||||
{
|
||||
if (CbBxUserName.Text == "Bradley")
|
||||
@@ -1659,8 +1656,8 @@ namespace AiQ_GUI
|
||||
|
||||
// Constants
|
||||
const double RealPlateWidthMeters = 0.52; // UK standard plate width
|
||||
const double FocalLengthPixels = (50 * 1280) / 14.111224; // focal mm * pixel width / sensor width for IQ
|
||||
// const double FocalLengthPixels = (50 * 1920) / 6.95; // focal mm * pixel width / sensor width for AiQ
|
||||
// const double FocalLengthPixels = (50 * 1280) / 14.111224; // focal mm * pixel width / sensor width for IQ
|
||||
const double FocalLengthPixels = (35 * 1920) / 6.95; // focal mm * pixel width / sensor width for AiQ
|
||||
const double FrameRate = 25.0; // Frames per second
|
||||
|
||||
public class FrameData
|
||||
@@ -1689,35 +1686,46 @@ namespace AiQ_GUI
|
||||
return speedMph;
|
||||
}
|
||||
|
||||
|
||||
// ***** Test & Debug *****
|
||||
private void BtnTest_Click(object sender, EventArgs e)
|
||||
private async void BtnTest_Click(object sender, EventArgs e)
|
||||
{
|
||||
Stopwatch stopWatchTest = Stopwatch.StartNew();
|
||||
|
||||
//string[,] GOD_JSON = { { "propURI", "rtsp://ADMIN:1234@192.168.0.49:554/live/main" } };
|
||||
//string str = FlexiAPI.BuildJsonUpdate(GOD_JSON, "CameraA");
|
||||
//string OUT = await FlexiAPI.HTTP_Update("CameraA", "100.118.196.113:8080", GOD_JSON);
|
||||
//AddToActionsList(OUT);
|
||||
|
||||
List<FrameData> frames = new List<FrameData>
|
||||
{
|
||||
new FrameData { FrameID = 60192555, PlatePosX = 1172, PlatePosY = 393, PlateWidthPixels = 108 },
|
||||
new FrameData { FrameID = 60192556, PlatePosX = 1103, PlatePosY = 361, PlateWidthPixels = 105 },
|
||||
new FrameData { FrameID = 60192558, PlatePosX = 983, PlatePosY = 331, PlateWidthPixels = 99 },
|
||||
new FrameData { FrameID = 60192559, PlatePosX = 930, PlatePosY = 301, PlateWidthPixels = 95 },
|
||||
new FrameData { FrameID = 60192560, PlatePosX = 880, PlatePosY = 304, PlateWidthPixels = 93 },
|
||||
new FrameData { FrameID = 60192561, PlatePosX = 834, PlatePosY = 278, PlateWidthPixels = 89 },
|
||||
new FrameData { FrameID = 60192562, PlatePosX = 792, PlatePosY = 229, PlateWidthPixels = 87 },
|
||||
new FrameData { FrameID = 60192563, PlatePosX = 752, PlatePosY = 208, PlateWidthPixels = 85 },
|
||||
new FrameData { FrameID = 60192565, PlatePosX = 680, PlatePosY = 187, PlateWidthPixels = 81 },
|
||||
new FrameData { FrameID = 60192566, PlatePosX = 648, PlatePosY = 167, PlateWidthPixels = 78 },
|
||||
new FrameData { FrameID = 60192567, PlatePosX = 617, PlatePosY = 149, PlateWidthPixels = 76 },
|
||||
new FrameData { FrameID = 60192568, PlatePosX = 588, PlatePosY = 132, PlateWidthPixels = 75 },
|
||||
new FrameData { FrameID = 60192569, PlatePosX = 561, PlatePosY = 100, PlateWidthPixels = 70 },
|
||||
new FrameData { FrameID = 60192570, PlatePosX = 535, PlatePosY = 85, PlateWidthPixels = 72 },
|
||||
new FrameData { FrameID = 60192572, PlatePosX = 488, PlatePosY = 70, PlateWidthPixels = 69 },
|
||||
new FrameData { FrameID = 60192573, PlatePosX = 466, PlatePosY = 55, PlateWidthPixels = 67 }
|
||||
};
|
||||
string[,] TEST_JSON = { { "propSerialNumber", "1234567" }, { "propMavModelNumber", "XA45HF" } };
|
||||
string JSONResponse = await FlexiAPI.HTTP_Update("Internal Config", "100.118.196.113", TEST_JSON);
|
||||
AddToActionsList(JSONResponse);
|
||||
|
||||
double Spd = EstimateSpeed(frames);
|
||||
AddToActionsList("Estimated Speed: " + Spd.ToString("F2") + " MPH");
|
||||
//string OUT = await FlexiAPI.HTTP_Fetch("InternalConfig", "100.118.196.113");
|
||||
//AddToActionsList(OUT);
|
||||
|
||||
// To estimate speed
|
||||
//List<FrameData> frames = new List<FrameData>
|
||||
//{
|
||||
// new FrameData { FrameID = 60192555, PlatePosX = 1172, PlatePosY = 393, PlateWidthPixels = 108 },
|
||||
// new FrameData { FrameID = 60192556, PlatePosX = 1103, PlatePosY = 361, PlateWidthPixels = 105 },
|
||||
// new FrameData { FrameID = 60192558, PlatePosX = 983, PlatePosY = 331, PlateWidthPixels = 99 },
|
||||
// new FrameData { FrameID = 60192559, PlatePosX = 930, PlatePosY = 301, PlateWidthPixels = 95 },
|
||||
// new FrameData { FrameID = 60192560, PlatePosX = 880, PlatePosY = 304, PlateWidthPixels = 93 },
|
||||
// new FrameData { FrameID = 60192561, PlatePosX = 834, PlatePosY = 278, PlateWidthPixels = 89 },
|
||||
// new FrameData { FrameID = 60192562, PlatePosX = 792, PlatePosY = 229, PlateWidthPixels = 87 },
|
||||
// new FrameData { FrameID = 60192563, PlatePosX = 752, PlatePosY = 208, PlateWidthPixels = 85 },
|
||||
// new FrameData { FrameID = 60192565, PlatePosX = 680, PlatePosY = 187, PlateWidthPixels = 81 },
|
||||
// new FrameData { FrameID = 60192566, PlatePosX = 648, PlatePosY = 167, PlateWidthPixels = 78 },
|
||||
// new FrameData { FrameID = 60192567, PlatePosX = 617, PlatePosY = 149, PlateWidthPixels = 76 },
|
||||
// new FrameData { FrameID = 60192568, PlatePosX = 588, PlatePosY = 132, PlateWidthPixels = 75 },
|
||||
// new FrameData { FrameID = 60192569, PlatePosX = 561, PlatePosY = 100, PlateWidthPixels = 70 },
|
||||
// new FrameData { FrameID = 60192570, PlatePosX = 535, PlatePosY = 85, PlateWidthPixels = 72 },
|
||||
// new FrameData { FrameID = 60192572, PlatePosX = 488, PlatePosY = 70, PlateWidthPixels = 69 },
|
||||
// new FrameData { FrameID = 60192573, PlatePosX = 466, PlatePosY = 55, PlateWidthPixels = 67 }
|
||||
//};
|
||||
|
||||
//double Spd = EstimateSpeed(frames);
|
||||
//AddToActionsList("Estimated Speed: " + Spd.ToString("F2") + " MPH");
|
||||
|
||||
stopWatchTest.Stop();
|
||||
AddToActionsList("RunTime " + stopWatchTest.Elapsed.ToString(@"hh\:mm\:ss\.ff"));
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||
<PackageReference Include="Emgu.CV" Version="4.12.0.5764" />
|
||||
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.12.0.5764" />
|
||||
<PackageReference Include="Google.Apis.Auth" Version="1.71.0" />
|
||||
<PackageReference Include="Google.Apis.Auth" Version="1.72.0" />
|
||||
<PackageReference Include="Google.Apis.Gmail.v1" Version="1.70.0.3833" />
|
||||
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.70.0.3819" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="PDFsharp-MigraDoc-gdi" Version="6.2.1" />
|
||||
<PackageReference Include="Selenium.Support" Version="4.35.0" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.35.0" />
|
||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="140.0.7339.8200" />
|
||||
<PackageReference Include="PDFsharp-MigraDoc-gdi" Version="6.2.2" />
|
||||
<PackageReference Include="Selenium.Support" Version="4.36.0" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.36.0" />
|
||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="141.0.7390.7600" />
|
||||
<PackageReference Include="SSH.NET" Version="2025.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="9.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace AiQ_GUI
|
||||
{
|
||||
string requestUrl = $"http://{IPAddress}/{suffix}";
|
||||
|
||||
HttpClientHandler handler = new HttpClientHandler
|
||||
HttpClientHandler handler = new()
|
||||
{
|
||||
Credentials = new NetworkCredential("developer", DevPass),
|
||||
PreAuthenticate = true
|
||||
|
||||
@@ -151,16 +151,12 @@ namespace AiQ_GUI
|
||||
double Exp_PSU_V = Convert.ToDouble(CameraAccessInfo.PowerType.Remove(CameraAccessInfo.PowerType.IndexOf('V')));
|
||||
double Exp_PSU_I = Math.Round(UniversalData.PowerConsumption / Exp_PSU_V, 2); // 32W device if AiQ Mk2 on medium LED power
|
||||
|
||||
if (PSU_V > Exp_PSU_V + 1 || PSU_V < Exp_PSU_V - 1)
|
||||
{
|
||||
if (Math.Abs(PSU_V - Exp_PSU_V) > 1)
|
||||
MainForm.Instance.AddToActionsList($"PSU Voltage out of range: {PSUVoltage}V. Expected {Exp_PSU_V}V ± 1V.");
|
||||
}
|
||||
|
||||
if (PSU_I < Exp_PSU_I * 0.8 || PSU_I > Exp_PSU_I * 1.2)
|
||||
{
|
||||
if (Math.Abs(PSU_I - Exp_PSU_I) > 0.2 * Math.Abs(Exp_PSU_I))
|
||||
MainForm.Instance.AddToActionsList($"PSU Current out of range: {PSUCurrent}A. Expected {Exp_PSU_I}A ± 20%.");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MainForm.Instance.AddToActionsList("PSU did not reply as expected.");
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace AiQ_GUI
|
||||
// Reads camera model numbers and descriptions from the database, sorts them alphabetically by model number (except "AB12CD", which appears last), and formats each entry as "ModelNumber - Description".
|
||||
public static string[] ReadCamTypes()
|
||||
{
|
||||
List<Tuple<string, string>> modelTuples = new List<Tuple<string, string>>(30); // Preallocate list with estimated capacity to reduce internal resizing
|
||||
List<Tuple<string, string>> modelTuples = new(30); // Preallocate list with estimated capacity to reduce internal resizing
|
||||
using OleDbConnection conn = new(connString);
|
||||
|
||||
try
|
||||
@@ -38,6 +38,7 @@ namespace AiQ_GUI
|
||||
IOrderedEnumerable<Tuple<string, string>> sorted = modelTuples.OrderBy(t => t.Item1.Equals("AB12CD", StringComparison.OrdinalIgnoreCase) ? 1 : 0)
|
||||
.ThenBy(t => t.Item1, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
conn.Close();
|
||||
// Format the sorted tuples as "ModelNumber - Description" strings and return as array
|
||||
return sorted.Select(t => $"{t.Item1} - {t.Item2}").ToArray();
|
||||
}
|
||||
@@ -67,6 +68,7 @@ namespace AiQ_GUI
|
||||
UniversalData.LatestVersion = Convert.ToString(reader["AiQGUIVersion"]);
|
||||
UniversalData.PowerConsumption = Convert.ToInt16(reader["PowerConsumption"]);
|
||||
UniversalData.LicencingServerURL = Convert.ToString(reader["LicencingServerURL"]);
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
// Knowing the model number on test, this function reads the database and populates the Camera class with the values.
|
||||
@@ -97,6 +99,7 @@ namespace AiQ_GUI
|
||||
CameraAccessInfo.LED_V = Convert.ToDouble(reader["LEDVoltage"]);
|
||||
CameraAccessInfo.LED_I = Convert.ToInt32(reader["LEDCurrent"]);
|
||||
CameraAccessInfo.SpreadsheetID = Convert.ToString(reader["SSID"]);
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,28 +66,22 @@ namespace AiQ_GUI
|
||||
return "Spreadsheet not found";
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(FilePath);
|
||||
using XLWorkbook workbook = new(FilePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
// Start from row 1 and check downwards to find next empty row in column B
|
||||
int row = 1;
|
||||
while (!worksheet.Cell(row, 2).IsEmpty()) // Column B = Serial numbers
|
||||
{
|
||||
row++;
|
||||
}
|
||||
|
||||
// Safety check to avoid invalid index
|
||||
if (row <= 1)
|
||||
{
|
||||
return "Last serial number not found";
|
||||
}
|
||||
|
||||
// Generate new serial number from previous
|
||||
string lastSerialNumber = worksheet.Cell(row - 1, 2).GetString(); // Column B
|
||||
if (string.IsNullOrWhiteSpace(lastSerialNumber) || !lastSerialNumber.StartsWith("K"))
|
||||
{
|
||||
return "Invalid last serial number format";
|
||||
}
|
||||
|
||||
int NewSerialNumberInt = Convert.ToInt32(lastSerialNumber.Substring(1)) + 1;
|
||||
string newSerialNumber = "K" + NewSerialNumberInt;
|
||||
@@ -124,7 +118,7 @@ namespace AiQ_GUI
|
||||
return "Spreadsheet not found";
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(filePath);
|
||||
using XLWorkbook workbook = new(filePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
// Find the row with the matching serial number in column B
|
||||
@@ -136,8 +130,7 @@ namespace AiQ_GUI
|
||||
{
|
||||
// Update columns D-E
|
||||
worksheet.Cell(row, 4).Value = "Pre Test: " + DateTime.Now.ToString("dd/MM/yyyy");
|
||||
worksheet.Cell(row, 5).Value = Vers.version + " - " + Vers.revision + Environment.NewLine +
|
||||
Vers.buildtime + Environment.NewLine + Vers.proquint;
|
||||
worksheet.Cell(row, 5).Value = $"{Vers.version} - {Vers.revision}" + Environment.NewLine + Vers.buildtime + Environment.NewLine + Vers.proquint;
|
||||
// Update MAC to column H
|
||||
worksheet.Cell(row, 8).Value = Vers.MAC;
|
||||
|
||||
@@ -172,7 +165,7 @@ namespace AiQ_GUI
|
||||
return "Spreadsheet not found";
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(FilePath);
|
||||
using XLWorkbook workbook = new(FilePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
// Find the row with the matching serial number in column B
|
||||
@@ -224,15 +217,13 @@ namespace AiQ_GUI
|
||||
return "Spreadsheet not found";
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(FilePath);
|
||||
using XLWorkbook workbook = new(FilePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
// Find next free row by checking column C
|
||||
int row = 2;
|
||||
while (!worksheet.Cell(row, 3).IsEmpty()) // Column C
|
||||
{
|
||||
row++;
|
||||
}
|
||||
|
||||
// Write model, serial, date, and protectionKeyId to columns C–F
|
||||
worksheet.Cell(row, 3).Value = model; // Column C
|
||||
@@ -263,7 +254,7 @@ namespace AiQ_GUI
|
||||
return 0;
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(filePath);
|
||||
using XLWorkbook workbook = new(filePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
int row = 2; // Start from row 2
|
||||
@@ -277,12 +268,11 @@ namespace AiQ_GUI
|
||||
if (sheetSerial.Contains(serial) && sheetModel.Contains(model))
|
||||
{
|
||||
string rmaStr = worksheet.Cell(row, 1).GetString(); // Column A
|
||||
|
||||
if (int.TryParse(rmaStr, out int rmaNumber))
|
||||
{
|
||||
return rmaNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { /* Safe to ignore bad row */ }
|
||||
|
||||
row++;
|
||||
@@ -306,7 +296,7 @@ namespace AiQ_GUI
|
||||
return 0;
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(filePath);
|
||||
using XLWorkbook workbook = new(filePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
int row = 1;
|
||||
@@ -315,11 +305,10 @@ namespace AiQ_GUI
|
||||
try
|
||||
{
|
||||
string cellSerial = worksheet.Cell(row, 2).GetString();
|
||||
|
||||
if (cellSerial.Contains(serial))
|
||||
{
|
||||
return row;
|
||||
}
|
||||
}
|
||||
catch { /* Ignore malformed rows */ }
|
||||
|
||||
row++;
|
||||
@@ -343,14 +332,12 @@ namespace AiQ_GUI
|
||||
return -1;
|
||||
}
|
||||
|
||||
using XLWorkbook workbook = new XLWorkbook(filePath);
|
||||
using XLWorkbook workbook = new(filePath);
|
||||
IXLWorksheet worksheet = workbook.Worksheets.First();
|
||||
|
||||
int row = 2; // Start from C2
|
||||
while (!worksheet.Cell(row, 3).IsEmpty()) // Column C = 3
|
||||
{
|
||||
row++;
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
@@ -368,7 +355,7 @@ namespace AiQ_GUI
|
||||
// 1. Ensure spreadsheet exists and has valid starting data
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
XLWorkbook workbook = new XLWorkbook();
|
||||
XLWorkbook workbook = new();
|
||||
IXLWorksheet ws = workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
// Pre-fill first row with dummy data for serial
|
||||
@@ -379,7 +366,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
// 2. Run Pre-Test update
|
||||
Versions fakeVersion = new Versions
|
||||
Versions fakeVersion = new()
|
||||
{
|
||||
version = "1.6.4",
|
||||
revision = "bf16134",
|
||||
@@ -388,11 +375,11 @@ namespace AiQ_GUI
|
||||
MAC = "00:1A:2B:3C:4D:5E"
|
||||
};
|
||||
|
||||
string preTestResult = Excel.UpdateSpreadSheetPreTest(filePath, fakeVersion, "Fake Cam", "TestModel");
|
||||
string preTestResult = UpdateSpreadSheetPreTest(filePath, fakeVersion, "Fake Cam", "TestModel");
|
||||
Debug.WriteLine("Pre-Test Result: " + preTestResult);
|
||||
|
||||
// 3. Run Final Test update
|
||||
Diags fakeDiags = new Diags
|
||||
Diags fakeDiags = new()
|
||||
{
|
||||
serialNumber = preTestResult, // Newly generated serial
|
||||
licenses = new Licenses
|
||||
@@ -404,13 +391,13 @@ namespace AiQ_GUI
|
||||
}
|
||||
};
|
||||
|
||||
SSHData fakeSSH = new SSHData
|
||||
SSHData fakeSSH = new()
|
||||
{
|
||||
packages = "\r\nlibvaxtorocr10 - 8.4.20-1\r\nvaxtorocrdatacpu3 - 8.4.20-1",
|
||||
tailscale = true
|
||||
};
|
||||
|
||||
string finalTestResult = Excel.UpdateSpreadSheetFinalTest(filePath, fakeDiags, fakeSSH, 0);
|
||||
string finalTestResult = UpdateSpreadSheetFinalTest(filePath, fakeDiags, fakeSSH, 0);
|
||||
Debug.WriteLine("Final-Test Result: " + finalTestResult);
|
||||
|
||||
// // 4. Run Vaxtor update
|
||||
@@ -430,7 +417,6 @@ namespace AiQ_GUI
|
||||
// int nextFree = Excel.CheckNextFree(filePath);
|
||||
// Debug.WriteLine("Next free row in Vaxtor sheet (Column C): " + nextFree);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace AiQ_GUI
|
||||
{
|
||||
StartAsAdmin(ExeLoc);
|
||||
}
|
||||
else if (runAsAdmin)
|
||||
else if (Properties.Settings.Default.FirstRun && runAsAdmin)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -86,6 +86,8 @@ namespace AiQ_GUI
|
||||
|
||||
Properties.Settings.Default.FirstRun = false;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Application.Restart(); // Restart to not be in admin mode
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user