diff --git a/FormConfiguration.Designer.cs b/FormConfiguration.Designer.cs index e76c440..a649618 100644 --- a/FormConfiguration.Designer.cs +++ b/FormConfiguration.Designer.cs @@ -45,7 +45,6 @@ this.buttonTasklistDec = new System.Windows.Forms.Button(); this.buttonTasklistEnc = new System.Windows.Forms.Button(); this.buttonEncryptTaskList = new System.Windows.Forms.Button(); - this.checkBox_Encryption = new System.Windows.Forms.CheckBox(); this.openFileDialogTasklist = new System.Windows.Forms.OpenFileDialog(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -157,7 +156,6 @@ // this.groupBox3.Controls.Add(this.groupBox4); this.groupBox3.Controls.Add(this.buttonEncryptTaskList); - this.groupBox3.Controls.Add(this.checkBox_Encryption); this.groupBox3.Location = new System.Drawing.Point(307, 12); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(240, 177); @@ -169,7 +167,7 @@ // this.groupBox4.Controls.Add(this.buttonTasklistDec); this.groupBox4.Controls.Add(this.buttonTasklistEnc); - this.groupBox4.Location = new System.Drawing.Point(8, 42); + this.groupBox4.Location = new System.Drawing.Point(8, 22); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(220, 62); this.groupBox4.TabIndex = 8; @@ -205,17 +203,6 @@ this.buttonEncryptTaskList.Text = "Encrypt"; this.buttonEncryptTaskList.UseVisualStyleBackColor = true; // - // checkBox_Encryption - // - this.checkBox_Encryption.AutoSize = true; - this.checkBox_Encryption.Location = new System.Drawing.Point(23, 19); - this.checkBox_Encryption.Name = "checkBox_Encryption"; - this.checkBox_Encryption.Size = new System.Drawing.Size(59, 17); - this.checkBox_Encryption.TabIndex = 6; - this.checkBox_Encryption.Text = "Enable"; - this.checkBox_Encryption.UseVisualStyleBackColor = true; - this.checkBox_Encryption.CheckedChanged += new System.EventHandler(this.checkBox_Local_CheckedChanged); - // // openFileDialogTasklist // this.openFileDialogTasklist.DefaultExt = "json"; @@ -241,7 +228,6 @@ this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); this.groupBox4.ResumeLayout(false); this.ResumeLayout(false); @@ -261,7 +247,6 @@ private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox textBoxTftpIP; private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.CheckBox checkBox_Encryption; private System.Windows.Forms.Button buttonEncryptTaskList; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.Button buttonTasklistDec; diff --git a/FormConfiguration.cs b/FormConfiguration.cs index 886417f..8d4c64a 100644 --- a/FormConfiguration.cs +++ b/FormConfiguration.cs @@ -36,20 +36,24 @@ namespace SSH_Test this.textBoxSftpIP.Text = Sftp_IP = sftpIP; this.textBoxSftpUsername.Text = Sftp_Username = sftp_Username; this.textBoxSftpPassword.Text = Sftp_Password = sftp_Password; - checkBox_Encryption.Checked = bEncryption = bencryption; aes = aaes; log = Log; this.Update(); } + public void AdminDisable() + { + buttonTasklistEnc.Enabled = false; + buttonTasklistDec.Enabled = false; + + } private void buttonOK_Click(object sender, EventArgs e) { Tftp_IP = textBoxTftpIP.Text; Sftp_IP = textBoxSftpIP.Text; Sftp_Username = textBoxSftpUsername.Text; Sftp_Password = textBoxSftpPassword.Text; - bEncryption = checkBox_Encryption.Checked; this.Close(); } @@ -58,20 +62,6 @@ namespace SSH_Test } - private void checkBox_Local_CheckedChanged(object sender, EventArgs e) - { - if (checkBox_Encryption.Checked) - { - checkBox_Encryption.Checked = true; - bEncryption = checkBox_Encryption.Checked; - } - else - { - checkBox_Encryption.Checked = false; - bEncryption = checkBox_Encryption.Checked; - } - - } private void buttonTasklistEnc_Click(object sender, EventArgs e) { diff --git a/TastList.Designer.cs b/TastList.Designer.cs index d7cc2e5..d4aa251 100644 --- a/TastList.Designer.cs +++ b/TastList.Designer.cs @@ -33,17 +33,9 @@ this.buttonConf = new System.Windows.Forms.Button(); this.richTextBoxOutput = new System.Windows.Forms.RichTextBox(); this.dataGridViewTask = new System.Windows.Forms.DataGridView(); - this.TaskNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.contextMenuStripRow = new System.Windows.Forms.ContextMenuStrip(this.components); this.MoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.TaskDescription = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.TaskDevice = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.TaskIp = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Select = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.Run = new System.Windows.Forms.DataGridViewImageColumn(); - this.Configuration = new System.Windows.Forms.DataGridViewButtonColumn(); - this.Profile = new System.Windows.Forms.DataGridViewComboBoxColumn(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn(); this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn(); @@ -59,6 +51,14 @@ this.toolTipbuttonTasklist = new System.Windows.Forms.ToolTip(this.components); this.toolTipGeneralConf = new System.Windows.Forms.ToolTip(this.components); this.buttonAESString = new System.Windows.Forms.Button(); + this.TaskNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.TaskDescription = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.TaskDevice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.TaskIp = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Select = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.Run = new System.Windows.Forms.DataGridViewImageColumn(); + this.Status = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Profile = new System.Windows.Forms.DataGridViewComboBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewTask)).BeginInit(); this.contextMenuStripRow.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -99,7 +99,7 @@ this.TaskIp, this.Select, this.Run, - this.Configuration, + this.Status, this.Profile}); this.dataGridViewTask.ContextMenuStrip = this.contextMenuStripRow; this.dataGridViewTask.Dock = System.Windows.Forms.DockStyle.Fill; @@ -116,17 +116,6 @@ this.dataGridViewTask.DragDrop += new System.Windows.Forms.DragEventHandler(this.dataGridViewTask_DragDrop); this.dataGridViewTask.DragEnter += new System.Windows.Forms.DragEventHandler(this.dataGridViewTask_DragEnter); // - // TaskNum - // - this.TaskNum.ContextMenuStrip = this.contextMenuStripRow; - this.TaskNum.FillWeight = 111.9059F; - this.TaskNum.HeaderText = "Task #"; - this.TaskNum.Name = "TaskNum"; - this.TaskNum.ReadOnly = true; - this.TaskNum.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.TaskNum.ToolTipText = "sfasfsfsfsaf"; - this.TaskNum.Width = 50; - // // contextMenuStripRow // this.contextMenuStripRow.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -153,67 +142,6 @@ this.DeleteToolStripMenuItem.Text = "Delete"; this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click); // - // TaskDescription - // - this.TaskDescription.FillWeight = 47.00047F; - this.TaskDescription.HeaderText = "Description"; - this.TaskDescription.MinimumWidth = 50; - this.TaskDescription.Name = "TaskDescription"; - this.TaskDescription.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.TaskDescription.Width = 300; - // - // TaskDevice - // - this.TaskDevice.FillWeight = 406.0913F; - this.TaskDevice.HeaderText = "Device"; - this.TaskDevice.Name = "TaskDevice"; - this.TaskDevice.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.TaskDevice.Width = 80; - // - // TaskIp - // - this.TaskIp.FillWeight = 47.00047F; - this.TaskIp.HeaderText = "IP"; - this.TaskIp.Name = "TaskIp"; - this.TaskIp.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.TaskIp.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.TaskIp.ToolTipText = "IP address"; - this.TaskIp.Width = 80; - // - // Select - // - this.Select.FillWeight = 47.00047F; - this.Select.HeaderText = "Select"; - this.Select.Name = "Select"; - this.Select.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.Select.ToolTipText = "Select to Run All"; - this.Select.Width = 40; - // - // Run - // - this.Run.FillWeight = 47.00047F; - this.Run.HeaderText = "Run"; - this.Run.Image = global::SSH_Test.Properties.Resources.Run16b; - this.Run.Name = "Run"; - this.Run.ReadOnly = true; - this.Run.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.Run.ToolTipText = "Run a Task"; - this.Run.Width = 30; - // - // Configuration - // - this.Configuration.FillWeight = 47.00047F; - this.Configuration.HeaderText = "Configuration"; - this.Configuration.Name = "Configuration"; - this.Configuration.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.Configuration.Width = 70; - // - // Profile - // - this.Profile.HeaderText = "Profile"; - this.Profile.Name = "Profile"; - this.Profile.Width = 392; - // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -370,6 +298,80 @@ this.buttonAESString.UseVisualStyleBackColor = true; this.buttonAESString.Click += new System.EventHandler(this.buttonAESString_Click); // + // TaskNum + // + this.TaskNum.ContextMenuStrip = this.contextMenuStripRow; + this.TaskNum.FillWeight = 111.9059F; + this.TaskNum.HeaderText = "Task #"; + this.TaskNum.Name = "TaskNum"; + this.TaskNum.ReadOnly = true; + this.TaskNum.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.TaskNum.ToolTipText = "sfasfsfsfsaf"; + this.TaskNum.Width = 50; + // + // TaskDescription + // + this.TaskDescription.FillWeight = 47.00047F; + this.TaskDescription.HeaderText = "Description"; + this.TaskDescription.MinimumWidth = 50; + this.TaskDescription.Name = "TaskDescription"; + this.TaskDescription.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.TaskDescription.Width = 300; + // + // TaskDevice + // + this.TaskDevice.FillWeight = 406.0913F; + this.TaskDevice.HeaderText = "Device"; + this.TaskDevice.Name = "TaskDevice"; + this.TaskDevice.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.TaskDevice.Width = 80; + // + // TaskIp + // + this.TaskIp.FillWeight = 47.00047F; + this.TaskIp.HeaderText = "IP"; + this.TaskIp.Name = "TaskIp"; + this.TaskIp.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.TaskIp.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.TaskIp.ToolTipText = "IP address"; + this.TaskIp.Width = 80; + // + // Select + // + this.Select.FillWeight = 47.00047F; + this.Select.HeaderText = "Select"; + this.Select.Name = "Select"; + this.Select.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.Select.ToolTipText = "Select to Run All"; + this.Select.Width = 40; + // + // Run + // + this.Run.FillWeight = 47.00047F; + this.Run.HeaderText = "Run"; + this.Run.Image = global::SSH_Test.Properties.Resources.Run16b; + this.Run.Name = "Run"; + this.Run.ReadOnly = true; + this.Run.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.Run.ToolTipText = "Run a Task"; + this.Run.Width = 30; + // + // Status + // + this.Status.FillWeight = 47.00047F; + this.Status.HeaderText = "LastRun"; + this.Status.Name = "Status"; + this.Status.ReadOnly = true; + this.Status.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.Status.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.Status.Width = 70; + // + // Profile + // + this.Profile.HeaderText = "Profile"; + this.Profile.Name = "Profile"; + this.Profile.Width = 392; + // // TastList // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -421,16 +423,16 @@ private System.Windows.Forms.OpenFileDialog openFileDialogTasklist; private System.Windows.Forms.Button buttonTasklistPath; private System.Windows.Forms.ToolTip toolTipbuttonTasklist; + private System.Windows.Forms.ToolTip toolTipGeneralConf; + private System.Windows.Forms.Button buttonAESString; private System.Windows.Forms.DataGridViewTextBoxColumn TaskNum; private System.Windows.Forms.DataGridViewTextBoxColumn TaskDescription; private System.Windows.Forms.DataGridViewTextBoxColumn TaskDevice; private System.Windows.Forms.DataGridViewTextBoxColumn TaskIp; private System.Windows.Forms.DataGridViewCheckBoxColumn Select; private System.Windows.Forms.DataGridViewImageColumn Run; - private System.Windows.Forms.DataGridViewButtonColumn Configuration; + private System.Windows.Forms.DataGridViewTextBoxColumn Status; private System.Windows.Forms.DataGridViewComboBoxColumn Profile; - private System.Windows.Forms.ToolTip toolTipGeneralConf; - private System.Windows.Forms.Button buttonAESString; } } diff --git a/TastList.cs b/TastList.cs index 9196280..fd9080c 100644 --- a/TastList.cs +++ b/TastList.cs @@ -33,7 +33,10 @@ namespace SSH_Test public partial class TastList : Form { - + // set to false to enable Encrypt , Decrypt Buttons + public const bool IsAdminDisabled = true; + + public List Tasks = new List(); public cConInfo conInfo = new cConInfo("", "", "", "", "", ""); private List Profiles = new List(); @@ -221,14 +224,26 @@ namespace SSH_Test richTextBoxOutput.AppendText(Utilities.RunaTask(currentTask, profile, conInfo,aes)); richTextBoxOutput.SelectionStart = richTextBoxOutput.Text.Length; richTextBoxOutput.ScrollToCaret(); + + + } catch { log.Error("Can not load profile or Profile is empty"); } + //update Status LastRun + string ttt = DateTime.Now.ToString(("HH:mm:ss")); + dataGridViewTask.Rows[row.Index].Cells[6].Value = ttt; + } + + + } + + } //dump output to file.txt @@ -321,7 +336,11 @@ namespace SSH_Test FormConfiguration formConfiguration = new FormConfiguration(conInfo.sTftpIP, conInfo.sSftpIP, conInfo.sSftpUsername, conInfo.sSftpPassword, bEncryption, aes, log); - + // Disable Encrypt, Decrypt buttons + if(IsAdminDisabled) + { + formConfiguration.AdminDisable(); + } formConfiguration.ShowDialog(); conInfo.sTftpIP = formConfiguration.Tftp_IP; conInfo.sSftpIP = formConfiguration.Sftp_IP; @@ -473,6 +492,9 @@ namespace SSH_Test 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; } catch { diff --git a/TastList.resx b/TastList.resx index ac56254..ae5bcb5 100644 --- a/TastList.resx +++ b/TastList.resx @@ -138,7 +138,7 @@ True - + True diff --git a/bin/Debug/SSH_Test.exe b/bin/Debug/SSH_Test.exe index 4b7907f..97908eb 100644 Binary files a/bin/Debug/SSH_Test.exe and b/bin/Debug/SSH_Test.exe differ diff --git a/bin/Debug/SSH_Test.pdb b/bin/Debug/SSH_Test.pdb index e7eb86c..c5ab833 100644 Binary files a/bin/Debug/SSH_Test.pdb and b/bin/Debug/SSH_Test.pdb differ diff --git a/bin/Debug/tasklist.json b/bin/Debug/tasklist.json index aa820dd..a5b7373 100644 Binary files a/bin/Debug/tasklist.json and b/bin/Debug/tasklist.json differ