Compare commits

..

2 Commits

Author SHA1 Message Date
AnD
97d42da9a2 Merge branch 'main' of http://10.1.101.60:3000/andnb/FAT_Test
# Conflicts:
#	TastList.cs
#	bin/Debug/FHT.exe
#	bin/Debug/FHT.pdb
#	bin/Debug/profile.json
2026-04-25 14:13:43 -06:00
AnD
7d35ac2b37 load different profile.json
fix bugs relating to profile loading
2026-04-25 14:10:43 -06:00
11 changed files with 571 additions and 432 deletions

View File

@@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{73DED4CD-B2B1-491E-87B7-BC1F11759C53}</ProjectGuid> <ProjectGuid>{73DED4CD-B2B1-491E-87B7-BC1F11759C53}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>SSH_Test</RootNamespace> <RootNamespace>FHT</RootNamespace>
<AssemblyName>SSH_Test</AssemblyName> <AssemblyName>FHT</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -86,8 +86,8 @@
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>packages\BouncyCastle.Cryptography.2.6.2\lib\net461\BouncyCastle.Cryptography.dll</HintPath> <HintPath>packages\BouncyCastle.Cryptography.2.6.2\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=3.3.1.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath> <HintPath>packages\log4net.3.3.1\lib\net462\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> <HintPath>packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
@@ -135,6 +135,7 @@
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />

View File

@@ -140,24 +140,34 @@ namespace FHT
//Load Profile list from "Profilefilename" //Load Profile list from "Profilefilename"
Profiles = utilities.LoadProfile(Profilefilename, aes); Profiles = utilities.LoadProfile(Profilefilename, aes);
// Configure Profile list to dropdown menu if (!Profiles.Any())
// AES button will update the dropdown menu when AES key is inputed. {
//try //load "do nothing" to Profiles
//{ Profile temp = new Profile();
// foreach (Profile p in Profiles) temp.ProfileType = "";
// { temp.ProfileName = "Do nothing";
// log.Info(string.Format("Profile: {0}", p.ProfileName)); temp.ProfileCommands = new string[] { "echo Do nothing" };
// } temp.ProfileParameters = new string[] { "" };
// var comboBoxColumn = (DataGridViewComboBoxColumn)dataGridViewTask.Columns[7]; Profiles.Add(temp);
// comboBoxColumn.DataSource = Profiles; // Set the data source of the ComboBox column }
// comboBoxColumn.DisplayMember = "profileName"; // Displayed property name
// comboBoxColumn.ValueMember = "profileName"; //The property name of the value try
//} {
//catch (Exception ex) foreach (Profile p in Profiles)
//{ {
// log.Error(ex.Message); log.Info(string.Format("Profile: {0}", p.ProfileName));
//} }
var comboBoxColumn = (DataGridViewComboBoxColumn)dataGridViewTask.Columns[7];
comboBoxColumn.DataSource = Profiles; // Set the data source of the ComboBox column
comboBoxColumn.DisplayMember = "profileName"; // Displayed property name
comboBoxColumn.ValueMember = "profileName"; //The property name of the value
}
catch (Exception ex)
{
log.Error(ex.Message);
}
dataGridViewTask.Refresh(); dataGridViewTask.Refresh();
@@ -353,7 +363,20 @@ namespace FHT
//try reloading Profilefilename //try reloading Profilefilename
Profiles.Clear(); Profiles.Clear();
Profiles = utilities.LoadProfile(Profilefilename, aes); Profiles = utilities.LoadProfile(Profilefilename, aes);
// Configure Profile list to dropdown menu
// Configure Profile list to dropdown menu, first to check if profiles is empty
if (!Profiles.Any())
{
//load "do nothing" to Profiles
Profile temp = new Profile();
temp.ProfileType = "";
temp.ProfileName = "Do nothing";
temp.ProfileCommands = new string[] { "echo Do nothing" };
temp.ProfileParameters = new string[] { "" };
Profiles.Add(temp);
}
try try
{ {
foreach (Profile p in Profiles) foreach (Profile p in Profiles)
@@ -373,6 +396,7 @@ namespace FHT
//reload tasklist //reload tasklist
buttonLoad_Click(null, null); buttonLoad_Click(null, null);
@@ -488,24 +512,13 @@ namespace FHT
{ {
profile = Profiles.Find(x => x.ProfileName == currentTask.sProfile.ToString()); profile = Profiles.Find(x => x.ProfileName == currentTask.sProfile.ToString());
if (profile !=null && profile.ProfileName != "Do nothing")
{
// print out task // print out task
log.Info(string.Format("Current task profile {0}:", currentTask.sTaskDevice.ToString())); log.Info(string.Format("Current task profile {0}:", currentTask.sTaskDevice.ToString()));
foreach (string c in profile.ProfileCommands) foreach (string c in profile.ProfileCommands)
log.Info(c); log.Info(c);
//hostInfo.Commands = profile.ProfileCommands;
//check if task has parameters and get parameters list
//foreach (string c in profile.ProfileParameters)
//{
// if (currentTask.dParameters[c] == "")
// currentTask.dParameters.Add(c, "");
//}
if (profile.ProfileParameters.Length > 0) if (profile.ProfileParameters.Length > 0)
{ {
//Get Values for Parameters //Get Values for Parameters
@@ -526,13 +539,17 @@ namespace FHT
// Run a Task and display result on the textbox // Run a Task and display result on the textbox
richTextBoxOutput.AppendText(Utilities.RunaTask(currentTask, profile, conInfo,aes)); richTextBoxOutput.AppendText(Utilities.RunaTask(currentTask, profile, conInfo, aes));
richTextBoxOutput.SelectionStart = richTextBoxOutput.Text.Length; richTextBoxOutput.SelectionStart = richTextBoxOutput.Text.Length;
richTextBoxOutput.ScrollToCaret(); richTextBoxOutput.ScrollToCaret();
//update Status LastRun //update Status LastRun
string ttt = DateTime.Now.ToString(("HH:mm:ss")); string ttt = DateTime.Now.ToString(("HH:mm:ss"));
dataGridViewTask.Rows[e.RowIndex].Cells[6].Value = ttt; dataGridViewTask.Rows[e.RowIndex].Cells[6].Value = ttt;
} }
else
log.Info("Profile = Null");
}
catch catch
{ {
log.Error("Can not load profile or Profile is empty"); log.Error("Can not load profile or Profile is empty");
@@ -584,7 +601,12 @@ namespace FHT
break; break;
case 1: case 1:
if (dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null)
{
dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
}
Tasks[e.RowIndex].sTaskDescription = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; Tasks[e.RowIndex].sTaskDescription = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
break; break;
case 2: case 2:
Tasks[e.RowIndex].sTaskDevice = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; Tasks[e.RowIndex].sTaskDevice = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
@@ -593,6 +615,7 @@ namespace FHT
break; break;
case 4: case 4:
if ((string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
Tasks[e.RowIndex].bTaskSelect = (bool)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; Tasks[e.RowIndex].bTaskSelect = (bool)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
break; break;
case 5: case 5:
@@ -604,9 +627,10 @@ namespace FHT
Tasks[e.RowIndex].sProfile = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; Tasks[e.RowIndex].sProfile = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
else else
Tasks[e.RowIndex].sProfile = "Do nothing"; Tasks[e.RowIndex].sProfile = "Do nothing";
if (!Profiles.Any())
{
profile = Profiles.Find(x => x.ProfileName == Tasks[e.RowIndex].sProfile.ToString()); profile = Profiles.Find(x => x.ProfileName == Tasks[e.RowIndex].sProfile.ToString());
if ( (profile != null) && (profile.ProfileParameters.Length > 0)) if ((profile != null) && (profile.ProfileParameters.Length > 0))
{ {
//clear task profile parameters first //clear task profile parameters first
Tasks[e.RowIndex].dParameters.Clear(); Tasks[e.RowIndex].dParameters.Clear();
@@ -616,6 +640,8 @@ namespace FHT
Tasks[e.RowIndex].dParameters.Add(c, ""); Tasks[e.RowIndex].dParameters.Add(c, "");
} }
} }
}
log.Info(string.Format("Task {0}, profile {1}", e.RowIndex, Tasks[e.RowIndex].sProfile)); log.Info(string.Format("Task {0}, profile {1}", e.RowIndex, Tasks[e.RowIndex].sProfile));
@@ -793,7 +819,19 @@ namespace FHT
//try reloading Profilefilename //try reloading Profilefilename
Profiles.Clear(); Profiles.Clear();
Profiles = utilities.LoadProfile(Profilefilename, aes); Profiles = utilities.LoadProfile(Profilefilename, aes);
// Configure Profile list to dropdown menu // Configure Profile list to dropdown menu, first to check if Profiles is empty
if (!Profiles.Any())
{
//load "do nothing" to Profiles
Profile temp = new Profile();
temp.ProfileType = "";
temp.ProfileName = "Do nothing";
temp.ProfileCommands = new string[] { "echo Do nothing" };
temp.ProfileParameters = new string[]{ "" };
Profiles.Add(temp);
}
try try
{ {
foreach (Profile p in Profiles) foreach (Profile p in Profiles)

Binary file not shown.

31
bin/Debug/FHT.exe.config Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="BouncyCastle.Cryptography" version="2.6.2" targetFramework="net48" /> <package id="BouncyCastle.Cryptography" version="2.6.2" targetFramework="net48" />
<package id="log4net" version="3.2.0" targetFramework="net48" /> <package id="log4net" version="3.3.1" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net48" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net48" /> <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.3" targetFramework="net48" /> <package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.3" targetFramework="net48" />