Exemplo n.º 1
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/memory"))
            {
                LinuxMemoryEntry entry = new LinuxMemoryEntry();
                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.LinuxMemoryType = LinuxMemoryTypeTypeConverter.FromString(pcNode.ReadXmlElementAttr("memoryType", "MemAvailable"));
                entry.WarningValue    = float.Parse(pcNode.ReadXmlElementAttr("warningValue", "20"));
                entry.ErrorValue      = float.Parse(pcNode.ReadXmlElementAttr("errorValue", "10"));
                Entries.Add(entry);
            }
        }
Exemplo n.º 2
0
        private void LoadEntryDetails()
        {
            LinuxMemoryEntry currentEntry = (LinuxMemoryEntry)SelectedEntry;

            if (currentEntry == null)
            {
                currentEntry = new LinuxMemoryEntry();
            }
            sshConnectionDetails             = currentEntry.SSHConnection;
            txtSSHConnection.Text            = Linux.SSHConnectionDetails.FormatSSHConnection(sshConnectionDetails);
            cboLinuxMemoryType.SelectedIndex = (int)currentEntry.LinuxMemoryType;
            warningNumericUpDown.SaveValueSet((decimal)currentEntry.WarningValue);
            errorNumericUpDown.SaveValueSet((decimal)currentEntry.ErrorValue);
        }