private void LoadEntryDetails()
        {
            LinuxNICEntry currentEntry = (LinuxNICEntry)SelectedEntry;

            if (currentEntry == null)
            {
                currentEntry = new LinuxNICEntry();
            }
            sshConnectionDetails  = currentEntry.SSHConnection;
            txtSSHConnection.Text = Linux.SSHConnectionDetails.FormatSSHConnection(sshConnectionDetails);

            foreach (LinuxNICSubEntry dsse in currentEntry.SubItems)
            {
                ListViewItem lvi = new ListViewItem()
                {
                    Text = dsse.NICName
                };
                lvi.SubItems.Add(dsse.WarningValueKB.ToString());
                lvi.SubItems.Add(dsse.ErrorValueKB.ToString());
                lvi.Tag = dsse;
                lvwNICs.Items.Add(lvi);
            }
        }
Esempio n. 2
0
        public void FromXml(string configurationString)
        {
            if (configurationString == null || configurationString.Length == 0)
            {
                return;
            }
            XmlDocument config = new XmlDocument();

            config.LoadXml(configurationString);
            XmlElement root = config.DocumentElement;

            Entries.Clear();
            foreach (XmlElement pcNode in root.SelectNodes("linux/nics"))
            {
                LinuxNICEntry entry = new LinuxNICEntry();
                entry.SSHConnection = SSHConnectionDetails.FromXmlElement(pcNode);

                //entry.SSHConnection.SSHSecurityOption = SSHSecurityOptionTypeConverter.FromString(pcNode.ReadXmlElementAttr("sshSecOpt", "password"));
                //entry.SSHConnection.ComputerName = pcNode.ReadXmlElementAttr("machine", ".");
                //entry.SSHConnection.SSHPort = pcNode.ReadXmlElementAttr("sshPort", 22);
                //entry.SSHConnection.UserName = pcNode.ReadXmlElementAttr("userName", "");
                //entry.SSHConnection.Password = pcNode.ReadXmlElementAttr("password", "");
                //entry.SSHConnection.PrivateKeyFile = pcNode.ReadXmlElementAttr("privateKeyFile", "");
                //entry.SSHConnection.PassPhrase = pcNode.ReadXmlElementAttr("passPhrase", "");

                entry.SubItems = new List <ICollectorConfigSubEntry>();
                foreach (XmlElement fileSystemNode in pcNode.SelectNodes("nic"))
                {
                    LinuxNICSubEntry fse = new LinuxNICSubEntry();
                    fse.NICName        = fileSystemNode.ReadXmlElementAttr("name", "");
                    fse.WarningValueKB = fileSystemNode.ReadXmlElementAttr("warningValueKB", 1024);
                    fse.ErrorValueKB   = fileSystemNode.ReadXmlElementAttr("errorValueKB", 5120);
                    entry.SubItems.Add(fse);
                }
                Entries.Add(entry);
            }
        }