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

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

            foreach (LinuxDiskSpaceSubEntry dsse in currentEntry.SubItems)
            {
                ListViewItem lvi = new ListViewItem()
                {
                    Text = dsse.FileSystemName
                };
                lvi.SubItems.Add(dsse.WarningValue.ToString());
                lvi.SubItems.Add(dsse.ErrorValue.ToString());
                lvi.Tag = dsse;
                lvwFileSystems.Items.Add(lvi);
            }
        }
Ejemplo 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/diskSpace"))
            {
                LinuxDiskSpaceEntry entry = new LinuxDiskSpaceEntry();
                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("fileSystem"))
                {
                    LinuxDiskSpaceSubEntry fse = new LinuxDiskSpaceSubEntry();
                    fse.FileSystemName = fileSystemNode.ReadXmlElementAttr("name", "");
                    fse.WarningValue   = fileSystemNode.ReadXmlElementAttr("warningValue", 10.0d);
                    fse.ErrorValue     = fileSystemNode.ReadXmlElementAttr("errorValue", 5.0d);
                    entry.SubItems.Add(fse);
                }
                Entries.Add(entry);
            }
        }