Пример #1
0
        private void LoadEntryDetails()
        {
            LinuxDiskIOEntry currentEntry = (LinuxDiskIOEntry)SelectedEntry;

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

            foreach (LinuxDiskIOSubEntry dsse in currentEntry.SubItems)
            {
                ListViewItem lvi = new ListViewItem()
                {
                    Text = dsse.Disk
                };
                lvi.SubItems.Add(dsse.WarningValue.ToString());
                lvi.SubItems.Add(dsse.ErrorValue.ToString());
                lvi.Tag = dsse;
                lvwDisks.Items.Add(lvi);
            }
        }
Пример #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/diskIO"))
            {
                LinuxDiskIOEntry entry = new LinuxDiskIOEntry();
                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("disk"))
                {
                    LinuxDiskIOSubEntry fse = new LinuxDiskIOSubEntry();
                    fse.Disk         = fileSystemNode.ReadXmlElementAttr("name", "");
                    fse.WarningValue = fileSystemNode.ReadXmlElementAttr("warningValue", 10.0d);
                    fse.ErrorValue   = fileSystemNode.ReadXmlElementAttr("errorValue", 5.0d);
                    entry.SubItems.Add(fse);
                }
                Entries.Add(entry);
            }
        }