Compare commits
2 Commits
fdfca14fb3
...
97d42da9a2
| Author | SHA1 | Date | |
|---|---|---|---|
| 97d42da9a2 | |||
| 7d35ac2b37 |
@@ -6,8 +6,8 @@
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{73DED4CD-B2B1-491E-87B7-BC1F11759C53}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>SSH_Test</RootNamespace>
|
||||
<AssemblyName>SSH_Test</AssemblyName>
|
||||
<RootNamespace>FHT</RootNamespace>
|
||||
<AssemblyName>FHT</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
@@ -86,8 +86,8 @@
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=3.3.1.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\log4net.3.3.1\lib\net462\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
@@ -135,6 +135,7 @@
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
174
TastList.cs
174
TastList.cs
@@ -140,24 +140,34 @@ namespace FHT
|
||||
//Load Profile list from "Profilefilename"
|
||||
Profiles = utilities.LoadProfile(Profilefilename, aes);
|
||||
|
||||
// Configure Profile list to dropdown menu
|
||||
// AES button will update the dropdown menu when AES key is inputed.
|
||||
//try
|
||||
//{
|
||||
// foreach (Profile p in Profiles)
|
||||
// {
|
||||
// log.Info(string.Format("Profile: {0}", p.ProfileName));
|
||||
// }
|
||||
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[] { "" };
|
||||
|
||||
// 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);
|
||||
//}
|
||||
Profiles.Add(temp);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (Profile p in Profiles)
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -353,7 +363,20 @@ namespace FHT
|
||||
//try reloading Profilefilename
|
||||
Profiles.Clear();
|
||||
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
|
||||
{
|
||||
foreach (Profile p in Profiles)
|
||||
@@ -370,6 +393,7 @@ namespace FHT
|
||||
{
|
||||
log.Error(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -488,50 +512,43 @@ namespace FHT
|
||||
{
|
||||
profile = Profiles.Find(x => x.ProfileName == currentTask.sProfile.ToString());
|
||||
|
||||
|
||||
// print out task
|
||||
log.Info(string.Format("Current task profile {0}:", currentTask.sTaskDevice.ToString()));
|
||||
|
||||
foreach (string c in profile.ProfileCommands)
|
||||
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 !=null && profile.ProfileName != "Do nothing")
|
||||
{
|
||||
//Get Values for Parameters
|
||||
FormParameters formParameter = new FormParameters(currentTask.dParameters, richTextBoxOutput.Text,
|
||||
string.Format("{0}: {1}", currentTask.sTaskDescription, currentTask.sProfile));
|
||||
if (formParameter.ShowDialog() == DialogResult.Cancel)
|
||||
// print out task
|
||||
log.Info(string.Format("Current task profile {0}:", currentTask.sTaskDevice.ToString()));
|
||||
|
||||
foreach (string c in profile.ProfileCommands)
|
||||
log.Info(c);
|
||||
if (profile.ProfileParameters.Length > 0)
|
||||
{
|
||||
log.Info("formParameter returns with Cancel");
|
||||
break;
|
||||
//Get Values for Parameters
|
||||
FormParameters formParameter = new FormParameters(currentTask.dParameters, richTextBoxOutput.Text,
|
||||
string.Format("{0}: {1}", currentTask.sTaskDescription, currentTask.sProfile));
|
||||
if (formParameter.ShowDialog() == DialogResult.Cancel)
|
||||
{
|
||||
log.Info("formParameter returns with Cancel");
|
||||
break;
|
||||
}
|
||||
|
||||
//foreach (var c in currentTask.dParameters)
|
||||
// log.Info(string.Format("Parameter {0}: {1}", c.Key, c.Value));
|
||||
}
|
||||
|
||||
//foreach (var c in currentTask.dParameters)
|
||||
// log.Info(string.Format("Parameter {0}: {1}", c.Key, c.Value));
|
||||
//clear richtextboxoutput
|
||||
richTextBoxOutput.Clear();
|
||||
|
||||
// Run a Task and display result on the textbox
|
||||
|
||||
richTextBoxOutput.AppendText(Utilities.RunaTask(currentTask, profile, conInfo, aes));
|
||||
richTextBoxOutput.SelectionStart = richTextBoxOutput.Text.Length;
|
||||
richTextBoxOutput.ScrollToCaret();
|
||||
//update Status LastRun
|
||||
string ttt = DateTime.Now.ToString(("HH:mm:ss"));
|
||||
dataGridViewTask.Rows[e.RowIndex].Cells[6].Value = ttt;
|
||||
}
|
||||
|
||||
//clear richtextboxoutput
|
||||
richTextBoxOutput.Clear();
|
||||
|
||||
// Run a Task and display result on the textbox
|
||||
|
||||
richTextBoxOutput.AppendText(Utilities.RunaTask(currentTask, profile, conInfo,aes));
|
||||
richTextBoxOutput.SelectionStart = richTextBoxOutput.Text.Length;
|
||||
richTextBoxOutput.ScrollToCaret();
|
||||
//update Status LastRun
|
||||
string ttt = DateTime.Now.ToString(("HH:mm:ss"));
|
||||
dataGridViewTask.Rows[e.RowIndex].Cells[6].Value = ttt;
|
||||
else
|
||||
log.Info("Profile = Null");
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -584,7 +601,12 @@ namespace FHT
|
||||
|
||||
break;
|
||||
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;
|
||||
|
||||
break;
|
||||
case 2:
|
||||
Tasks[e.RowIndex].sTaskDevice = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
@@ -593,7 +615,8 @@ namespace FHT
|
||||
|
||||
break;
|
||||
case 4:
|
||||
Tasks[e.RowIndex].bTaskSelect = (bool)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
if ((string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
|
||||
Tasks[e.RowIndex].bTaskSelect = (bool)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
break;
|
||||
case 5:
|
||||
|
||||
@@ -604,18 +627,21 @@ namespace FHT
|
||||
Tasks[e.RowIndex].sProfile = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
else
|
||||
Tasks[e.RowIndex].sProfile = "Do nothing";
|
||||
|
||||
profile = Profiles.Find(x => x.ProfileName == Tasks[e.RowIndex].sProfile.ToString());
|
||||
if ( (profile != null) && (profile.ProfileParameters.Length > 0))
|
||||
if (!Profiles.Any())
|
||||
{
|
||||
//clear task profile parameters first
|
||||
Tasks[e.RowIndex].dParameters.Clear();
|
||||
//add new parameters
|
||||
foreach (string c in profile.ProfileParameters)
|
||||
profile = Profiles.Find(x => x.ProfileName == Tasks[e.RowIndex].sProfile.ToString());
|
||||
if ((profile != null) && (profile.ProfileParameters.Length > 0))
|
||||
{
|
||||
Tasks[e.RowIndex].dParameters.Add(c, "");
|
||||
//clear task profile parameters first
|
||||
Tasks[e.RowIndex].dParameters.Clear();
|
||||
//add new parameters
|
||||
foreach (string c in profile.ProfileParameters)
|
||||
{
|
||||
Tasks[e.RowIndex].dParameters.Add(c, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.Info(string.Format("Task {0}, profile {1}", e.RowIndex, Tasks[e.RowIndex].sProfile));
|
||||
|
||||
@@ -793,7 +819,19 @@ namespace FHT
|
||||
//try reloading Profilefilename
|
||||
Profiles.Clear();
|
||||
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
|
||||
{
|
||||
foreach (Profile p in Profiles)
|
||||
@@ -810,7 +848,7 @@ namespace FHT
|
||||
{
|
||||
log.Error(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
dataGridViewTask.Refresh();
|
||||
}
|
||||
catch
|
||||
|
||||
Binary file not shown.
31
bin/Debug/FHT.exe.config
Normal file
31
bin/Debug/FHT.exe.config
Normal 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.
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<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.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net48" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.3" targetFramework="net48" />
|
||||
|
||||
Reference in New Issue
Block a user