using log4net;
using log4net.Config;
using Org.BouncyCastle.Cms;
using Renci.SshNet;
using Renci.SshNet.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace SSH_Test
{


    public partial class TastList : Form
    {

        public List<cTask> Tasks = new List<cTask>();
        public cConInfo conInfo = new cConInfo("","","","","","","","","",false);
        private List<Profile> Profiles = new List<Profile>();
        private static readonly ILog log = LogManager.GetLogger(typeof(Program));
        public TastList()
        {

            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
            XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));

            InitializeComponent();


            //Load Profile list from "profile.json"
            Profiles = LoadProfile("profile.json");

            // Configure Profile list to dropdown menu
            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();
            
        }

        private void fSSHTest_Load(object sender, EventArgs e)
        {
        }

        private void bRunAll_Click(object sender, EventArgs e)
        {


        }

        private void dataGridViewTask_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string host = "";
            string username = "";
            string password = "";
            Profile profile;

            try
            {
                var currentTask = Tasks[e.RowIndex];
                host = currentTask.sTaskIP.ToString();
                username = currentTask.sUsername.ToString();
                password = currentTask.sPassword.ToString();
                switch (e.ColumnIndex)
                {
                    case 5:
                        
                        profile = Profiles.Find(x => x.ProfileName == currentTask.sProfile.ToString());
                        cHostInfo hostInfo = new cHostInfo();
                        hostInfo.host = host;
                        hostInfo.username = username;
                        hostInfo.password = password;
                        hostInfo.device = currentTask.sTaskDevice.ToString();
                        
                        // print out task
                        log.Info(string.Format("Current task profile {0}:", hostInfo.device));

                        foreach (string c in profile.ProfileCommands)
                            log.Info(c);

                        hostInfo.Commands = profile.ProfileCommands;

                        
                        switch (profile.ProfileType)
                        {
                            case "SSH":
                                try
                                {
                                    Thread thread1 = new Thread(new ParameterizedThreadStart(fSSH));
                                    hostInfo.TftpIP = conInfo.sTftpIP;
                                    hostInfo.SftpIP = conInfo.sTftpIP;
                                    hostInfo.SftpPassword = conInfo.sTftpPassword;
                                    hostInfo.SftpUsername = conInfo.sTftpUsername;
                                    thread1.Start(hostInfo);
                                }
                                catch(Exception ex1)
                                { 
                                    log.Error(ex1);                                    
                                }
                                
                                break;
                            case "SSH_Catalyst":
                                try
                                {
                                    Thread thread2 = new Thread(new ParameterizedThreadStart(fSSH_Catalyst));
                                    hostInfo.TftpIP = conInfo.sTftpIP;
                                    hostInfo.SftpIP = conInfo.sTftpIP;
                                    hostInfo.SftpPassword = conInfo.sTftpPassword;
                                    hostInfo.SftpUsername = conInfo.sTftpUsername;
                                    thread2.Start(hostInfo);
                                }
                                catch (Exception ex1)
                                { 
                                    log.Error(ex1);
                                    
                                }


                                break;
                            case "RAC9":
                                string command = "";
                                
                                if (!conInfo.bisLocal)
                                {
                                    command = " --nocertwarn -r " + conInfo.sIDracIP + " -u " + conInfo.sIDracUsername + " -p " + conInfo.sIDracPassword + " ";
                                }
                                                                                                                               
                                foreach (string c in profile.ProfileCommands)
                                {
                                    Process process = new Process();
                                    process.StartInfo.FileName = "racadm.exe";
                                    process.StartInfo.UseShellExecute = false; // Required for 'runas' verb
                                    process.StartInfo.Verb = "runas"; // Request administrator privileges
                                    process.StartInfo.WorkingDirectory = Environment.CurrentDirectory; // current working dir
                                    process.StartInfo.RedirectStandardOutput = true;
                                                                       
                                    try
                                    {
                                        
                                        string tempfile = DateTime.Now.ToString().Replace(":", "").Replace(" ","") + ".txt";

                                        process.StartInfo.Arguments = command + " " + c;
                                        process.Start();
                                        string result = process.StandardOutput.ReadToEnd();
                                        log.Info(string.Format("From RAC9 {0}: {1}", currentTask.sTaskDevice.ToString(), result));
                                        
                                        process.WaitForExit();                                        


                                    }
                                    catch (Win32Exception ex)
                                    {
                                        log.Info(string.Format($"Error: {ex.Message}. The user likely declined the UAC prompt."));
                                        
                                    }
                                }
                                break;

                            case "CMD":
                                command = "/c";
                                
                                foreach (string c in profile.ProfileCommands)
                                {
                                    Process process = new Process();
                                    process.StartInfo.FileName = "cmd.exe";
                                    process.StartInfo.UseShellExecute = false; // Required for 'runas' verb
                                    process.StartInfo.Verb = "runas"; // Request administrator privileges
                                    process.StartInfo.WorkingDirectory = Environment.CurrentDirectory; // current working dir
                                    process.StartInfo.RedirectStandardOutput = true;

                                    try
                                    {

                                        string tempfile = DateTime.Now.ToString().Replace(":", "").Replace(" ", "") + ".txt";

                                        process.StartInfo.Arguments = command + " " + c;
                                        process.Start();
                                        string result = process.StandardOutput.ReadToEnd();
                                        
                                        log.Info(string.Format("From CMD {0}: {1}", currentTask.sTaskDevice.ToString(), result));
                                        process.WaitForExit();


                                    }
                                    catch (Win32Exception ex)
                                    {
                                        log.Error(ex);
                                    }
                                }
                                break;
                            case "Powershell":
                                command = " ";

                                foreach (string c in profile.ProfileCommands)
                                {
                                    Process process = new Process();
                                    process.StartInfo.FileName = "powershell";
                                    process.StartInfo.UseShellExecute = false; // Required for 'runas' verb
                                    process.StartInfo.Verb = "runas"; // Request administrator privileges
                                    string folderPathPS = Environment.CurrentDirectory + "\\PS";
                                    process.StartInfo.WorkingDirectory = folderPathPS; // current working dir

                                    // check if Powershell Script folder "PS" exists, if not , create one.
                                    if (!Directory.Exists(folderPathPS))
                                    {
                                        Directory.CreateDirectory(folderPathPS);
                                        log.Info(string.Format("Cound not find folder PS, create new {0}", folderPathPS));                                        
                                        
                                    }
                                    

                                    process.StartInfo.RedirectStandardOutput = true;

                                    try
                                    {

                                        string tempfile = DateTime.Now.ToString().Replace(":", "").Replace(" ", "") + ".txt";

                                        process.StartInfo.Arguments = command + " " + c;
                                        process.Start();
                                        string result = process.StandardOutput.ReadToEnd();
                                        log.Info(string.Format("From Powershell {0}: {1}", currentTask.sTaskDevice.ToString(), result));
                                        
                                        process.WaitForExit();


                                    }
                                    catch (Win32Exception ex)
                                    {
                                        log.Error(ex);
                                        
                                    }
                                }
                                break;

                            default:
                                break;

                        }
                        //switch (profile)
                        //{
                        //    case "Cisco_Switch":
                        //        Thread thread1 = new Thread(new ParameterizedThreadStart(fSSHCisco));
                        //        thread1.Start(hostInfo);
                        //        break;
                        //    case "Cisco_Switch_Tftp":
                        //        hostInfo.SftpIP = ftpInfo.sTftpIP;
                                
                        //        Thread thread2 = new Thread(new ParameterizedThreadStart(fSSHCisco_Tftp));
                        //        thread2.Start(hostInfo);
                        //        break;
                        //    case "Cisco_Switch_Tftp_Startup":
                        //        hostInfo.SftpIP = ftpInfo.sTftpIP;
                        //        hostInfo.SftpPassword = ftpInfo.sTftpPassword;
                        //        hostInfo.SftpUsername = ftpInfo.sTftpUsername;


                        //        Thread thread3 = new Thread(new ParameterizedThreadStart(fSSHCisco_Tftp_Startup));
                        //        thread3.Start(hostInfo);
                        //        break;

                        //    default:
                        //        break;


                        //}




                        break;
                    case 6: //call Credential

                        FormCredential formCredential = new FormCredential(username, password);
                        formCredential.ShowDialog();
                        if ((formCredential.Username != "") && (formCredential.Username != username))
                            username = currentTask.sUsername = formCredential.Username;
                        if ((formCredential.Password != "") && formCredential.Password != password)
                            password = currentTask.sPassword = formCredential.Password;

                        break;
                    case 7: //select profile

                        //FormProfile formProfile = new FormProfile(profile);
                        //formProfile.ShowDialog();
                        //profile = currentTask.sProfile = formProfile.sProfile;

                        // dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = profile;
                        break;

                    default:
                        break;

                }
            }
            catch ( Exception ex) 
            {
                log.Error(ex);  
            }
        }

        private void dataGridViewTask_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != 5)
            {
                if (Tasks.Count < (e.RowIndex + 1))
                {
                    Tasks.Add(new cTask(e.RowIndex + 1, "", "", "", "", "", "",""));
                }
                switch (e.ColumnIndex)
                {
                    case 0:
                        Tasks[e.RowIndex].iTaskNum = e.RowIndex + 1;
                        break;
                    case 1:
                        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;
                        break;
                    case 3:
                        Tasks[e.RowIndex].sTaskIP = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                        break;
                    case 4:
                        Tasks[e.RowIndex].uTaskPort = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                        break;
                    case 5:
                        
                        break;
                    case 7:  // Profile
                        Tasks[e.RowIndex].sProfile = (string)dataGridViewTask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                        log.Info(string.Format("Task {0}, profile {1}", e.RowIndex, Tasks[e.RowIndex].sProfile));
                        
                        break;
                    default:
                        break;
                }
            }
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (Tasks.Count >= 1)
            {
                using (Stream stream = File.Open("tasklist.dat", FileMode.Create))
                {
                    log.Info("Saving Tasklist.dat");                    
                    var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    binaryFormatter.Serialize(stream, Tasks);
                }
                using (Stream stream = File.Open("ftpInfo.dat", FileMode.Create))
                {
                    var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    binaryFormatter.Serialize(stream, conInfo);
                }
            }
        }

        private void buttonLoad_Click(object sender, EventArgs e)
        {
            using (Stream stream = File.Open("tasklist.dat", FileMode.Open))
            {

                var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                Tasks = (List<cTask>)binaryFormatter.Deserialize(stream);
            }
            using (Stream stream = File.Open("ftpInfo.dat", FileMode.Open))
            {

                var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                conInfo = (cConInfo)binaryFormatter.Deserialize(stream);
            }

            //clear TaskList
            dataGridViewTask.Rows.Clear();

            foreach (var task in Tasks)
            {
                DataGridViewRow row = (DataGridViewRow)dataGridViewTask.Rows[0].Clone();
                row.Cells[0].Value = task.iTaskNum;
                row.Cells[1].Value = task.sTaskDescription;
                row.Cells[2].Value = task.sTaskDevice;
                row.Cells[3].Value = task.sTaskIP;
                row.Cells[4].Value = task.uTaskPort;
                row.Cells[7].Value = task.sProfile;
                dataGridViewTask.Rows.Add(row);

            }
        }
        public class cHostInfo
        {
            public string device { get; set; }
            public string host { get; set; }
            public string username { get; set; }
            public string password { get; set; }
            public string TftpIP { get; set; }  

            public string SftpIP { get; set; }
            public string SftpUsername { get; set; }
            public string SftpPassword { get; set; }
            public string[] Commands { get; set; }
            public cHostInfo()
            {
                device = "";
                host = "localhost";
                username = "";
                password = "";
                TftpIP = "127.0.0.1";
                SftpIP = "127.0.0.1";
                SftpUsername = "";
                SftpPassword = "";
            }

        }

        public void fSSH(object data)
        {
            try
            {
                cHostInfo hostinfo = (cHostInfo)data;
                string host = hostinfo.host;
                string device = hostinfo.device;
                string username = hostinfo.username;
                string password = hostinfo.password;
                string tftpIp = hostinfo.TftpIP;
                string sftpIp = hostinfo.SftpIP;
                string sftpUsername = hostinfo.SftpUsername;
                string sftpPassword = hostinfo.SftpPassword;
                string[] Commands = hostinfo.Commands;
                var client = new SshClient(hostinfo.host, hostinfo.username, hostinfo.password);
                log.Info(string.Format("From fSSH {0}: Establishing a connection", device));
                

                client.Connect();
                log.Info(client.ConnectionInfo.ServerVersion);
                
                if (client.IsConnected)
                {
                    var shellStream = client.CreateShellStream("xterm", 80, 24, 800, 600, 1024);
                    var output = "";
                    var result = "";

                    //wait for "User Name:"

                    output = shellStream.Expect(new Regex(@"Name:|name:"));
                    log.Info(string.Format("From fSSH {0}: {1}", device, output));
                    

                    //send username
                    shellStream.WriteLine(username);

                    //wait for "Password:"
                    output = shellStream.Expect(new Regex(@"word:"));
                    log.Info(string.Format("From fSSH {0}: {1}", device, output));

                    //send password
                    shellStream.WriteLine(password);

                    //wait for "Prompt:"
                    output = shellStream.Expect(new Regex(@"#"));
                    log.Info(string.Format("From fSSH {0}: {1}", device, output));

                    output = "";

                    //create filename
                    string datetime = DateTime.Now.ToString().Replace(":", "");
                    datetime = datetime.Replace(" ", "_");
                    // string filePath = string.Format("{0}_{1}.txt", currentTask.sTaskDevice, datetime.Replace("-", ""));
                    string filePath = string.Format("{0}_{1}.txt", device, datetime.Replace("-", ""));

                    foreach (string c in Commands)
                    {
                        switch (c)
                        {
                            //enable
                            case "enable":
                                output = "";
                                shellStream.WriteLine(c);
                                //wait for "Password:"
                                output = shellStream.Expect(new Regex(@"word:"));
                                log.Info(string.Format("From fSSH {0}: {1}", device, c));
                                

                                //send password
                                shellStream.WriteLine(password);
                                break;

                            // tftp
                            case string s when Regex.IsMatch(c, @"tftp"):
                                output = "";
                                string command = string.Format("{0}{1}/{2}", c, tftpIp, filePath);
                                log.Info(string.Format("From fSSH {0}: {1}", device, command));
                                

                                //send tftp command 
                                shellStream.WriteLine(command);


                                //wait "<return>" to send "space" and loop until get prompt
                                while (!Regex.IsMatch(output, "#"))
                                {
                                    output = shellStream.Expect(new Regex(@"More|<return>|#"));

                                    shellStream.WriteLine(" ");
                                    string[] lines = output.Split('\n');
                                    var output1 = "";
                                    for (int ii = 0; ii < (lines.Length - 1); ii++)
                                        output1 += lines[ii];
                                    log.Info(output1);
                                    
                                    result += output1;
                                }
                                break;
                            default:
                                shellStream.WriteLine(c);
                                //wait for "Prompt:"
                                output = shellStream.Expect(new Regex(@"#"));
                                log.Info(string.Format("From fSSH_Test {0}: {1}", device, output));
                                
                                break;

                        }
                    }
                }

                client.Disconnect();
                log.Info(string.Format("From SSH_Test: Disconnected"));
                
            }
            catch (Exception e)
            {
                log.Error("SSH function: cannot run SSH");
                log.Error(e);
                
            }

        }

        public void fSSH_Catalyst(object data)
        {
            try
            {
                cHostInfo hostinfo = (cHostInfo)data;

                string host = hostinfo.host;
                string device = hostinfo.device;
                string username = hostinfo.username;
                string password = hostinfo.password;
                string tftpIp = hostinfo.TftpIP;
                string sftpIp = hostinfo.SftpIP;
                string sftpUsername = hostinfo.SftpUsername;
                string sftpPassword = hostinfo.SftpPassword;
                string[] Commands = hostinfo.Commands;

                var client = new SshClient(hostinfo.host, hostinfo.username, hostinfo.password);
                log.Info(string.Format("From fSSH_Catalyst {0}: Establishing a connection {1}", device, host));
                

                client.Connect();
                log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, client.ConnectionInfo.ServerVersion));
                


                if (client.IsConnected)
                {
                    var shellStream = client.CreateShellStream("xterm", 80, 24, 800, 600, 1024);
                    var output = "";
                    var result = "";
                    var prompt = "";
                    //output = "";
                    output = shellStream.Expect(new Regex(@"#"));
                    log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, output));
                    
                    prompt = output;

                    shellStream.WriteLine("");
                    shellStream.Flush();

                    output = shellStream.Expect(new Regex(prompt));
                    log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, output));
                    

                    //create filename
                    string datetime = DateTime.Now.ToString().Replace(":", "");
                    datetime = datetime.Replace(" ", "_");
                    // string filePath = string.Format("{0}_{1}.txt", currentTask.sTaskDevice, datetime.Replace("-", ""));
                    string filePath = string.Format("{0}_{1}.txt", device, datetime.Replace("-", ""));

                    foreach (string c in Commands)
                    {
                        switch (c)
                        {
                            //enable
                            case "enable":
                                output = "";
                                shellStream.WriteLine(c);
                                //wait for "Password:"
                                output = shellStream.Expect(new Regex(@"word:"));
                                log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, c));
                                

                                //send password
                                shellStream.WriteLine(password);
                                break;

                            // tftp
                            case string s when Regex.IsMatch(c, @"tftp"):
                                output = "";

                                string command = string.Format("{0}{1}/{2}", c, tftpIp, filePath);
                                
                                log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, command));
                                //send tftp command 
                                output = "";
                                shellStream.WriteLine(command);
                                shellStream.Flush();

                                //handle shell interaction, wait for "?" then send "enter"

                                output = shellStream.Expect(new Regex(@"\?"));
                                
                                log.Info(string.Format("From fSSH_Catalyst{0}: {1}", device, output));
                                while (output.Contains("?"))
                                {
                                    output = "";
                                    shellStream.WriteLine("");
                                    shellStream.Flush();
                                    output = shellStream.Expect(new Regex(@"\?|#"));
                                    log.Info(string.Format("From fSSH_Catalyst  {0}: {1}", device, output));
                                    
                                }

                                break;
                            default:
                                shellStream.WriteLine(c);
                                //wait for "Prompt:"
                                output = shellStream.Expect(prompt);
                                
                                log.Info(string.Format("From fSSH_Catalyst {0}: {1}", device, output));
                                break;

                        }
                    }

                }

                client.Disconnect();
                log.Info(string.Format("From SSH_Catalyst: Disconnected"));
                

            }
            catch (Exception e)
            {
                log.Error("SSH_Catalyst function: cannot run SSH_Catalyst");
                log.Error(e);
                
            }
        }

                    

        private void buttonConf_Click(object sender, EventArgs e)
        {
            FormConfiguration formConfiguration = new FormConfiguration(conInfo.sTftpIP, conInfo.sSftpIP, conInfo.sSftpUsername, conInfo.sSftpPassword,conInfo.sIDracIP, conInfo.sIDracUsername, conInfo.sIDracPassword, conInfo.bisLocal);
            formConfiguration.ShowDialog();
            conInfo.sTftpIP = formConfiguration.Tftp_IP;
            conInfo.sSftpIP = formConfiguration.Sftp_IP;
            conInfo.sSftpUsername = formConfiguration.Sftp_Username;
            conInfo.sSftpPassword = formConfiguration.Sftp_Password;
            conInfo.sIDracIP = formConfiguration.IDRAC_IP;
            conInfo.sIDracUsername = formConfiguration.IDRAC_Username;
            conInfo.sIDracPassword = formConfiguration.IDRAC_Password;
            conInfo.bisLocal = formConfiguration.IDRAC_Local;

        }
        //Seriallize Profile to a Json file
        private static void SaveProfile(List<Profile> data, string filePath)
        {
            JsonSerializerOptions options = new JsonSerializerOptions
            {
                WriteIndented = true
            };
            string jsonString = JsonSerializer.Serialize(data, options);
            File.WriteAllText(filePath, jsonString);
        }
        //Deseriallize Profile from a Json file
        private static List<Profile> LoadProfile(string filePath)
        {
            
            if (File.Exists(filePath))
            {
                try
                {
                    string jsonString = File.ReadAllText(filePath);
                    return JsonSerializer.Deserialize<List<Profile>>(jsonString);
                }
                catch (Exception ex)
                {
                    //could not read profile.json properly
                    log.Error("Could not load profile.json");
                    log.Error(ex);
                    
                    //return an empty list if file could not be read
                    
                    return new List<Profile>();

                }
                
            }
            return new List<Profile>(); // Return an empty list if file doesn't exist
        }

        [Serializable]
        public class cTask
        {
            public int iTaskNum { get; set; }
            public String sTaskDescription { get; set; }
            public String sTaskDevice { get; set; }
            public String sTaskIP { get; set; }
            public String uTaskPort { get; set; }
            public String sUsername { get; set; }
            public String sPassword { get; set; }
            public String sProfile { get; set; }
            public cTask(int iTaskNum, string uTaskDescription, string uTaskDevice, string uTaskIP, string uTaskPort, string sUsername, string sPassword, string sProfile)
            {
                this.iTaskNum = iTaskNum;
                this.sTaskDescription = uTaskDescription;
                this.sTaskDevice = uTaskDevice;
                this.sTaskIP = uTaskIP;
                this.uTaskPort = uTaskPort;
                this.sUsername = sUsername;
                this.sPassword = sPassword;
            }
        }


        [Serializable]
        public class cConInfo
        {
            
            public String sTftpIP { get; set; }
            public String sTftpUsername { get; set; }
            public String sTftpPassword { get; set; }
            public String sSftpIP { get; set; }
            public String sSftpUsername { get; set; }
            public String sSftpPassword { get; set; }
            public string sIDracIP { get; set; }
            public string sIDracUsername { get; set; }
            public string sIDracPassword { get; set; }
            public bool bisLocal { get; set; }
            public cConInfo( string TftpIP, string TftpUsername, string TftpPassword, string SftpIP, String SftpUsername, String SftPassword, String IdracIP, String IdracUsername, String IdracPassword, bool IsLocal)
            {
                this.sTftpIP = TftpIP;
                this.sTftpUsername = TftpUsername;
                this.sTftpPassword = TftpPassword;
                this.sSftpIP = SftpIP;
                this.sSftpUsername = SftpUsername;
                this.sSftpPassword = SftPassword;
                this.sIDracIP = IdracIP;
                this.sIDracUsername = IdracUsername;
                this.sIDracPassword = IdracPassword;
                this.bisLocal = IsLocal;
                                
            }
        }

    }

}