Exemplo n.º 1
0
        private void ChangeComboBox()
        {
            if (cmboSavedSite.Text == "None")
            {
                txtIPAddress.Text      = "";
                txtPassword.Text       = "";
                txtServerName.Text     = "";
                txtUsername.Text       = "";
                txtPort.Text           = "22";
                chckEnableICMP.Checked = false;
                chckSkipConfig.Checked = false;
                chckSkipSFTP.Checked   = true;
                chckSkipStatus.Checked = false;
                return;
            }
            string        FileName = $@"{Program.PIDConfig()}{cmboSavedSite.Text}";
            XmlSerializer xs       = new XmlSerializer(typeof(Settings));
            FileStream    read     = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            Settings      se       = (Settings)xs.Deserialize(read);

            read.Dispose();
            txtIPAddress.Text = se.HostIP;
            if (se.isPWEncrypted == false)
            {
                txtPassword.Text = se.Password;
            }
            else
            {
                PasswordManager pm = new PasswordManager();
                txtPassword.Text = pm.DecodeString(se.Password);
            }
            txtServerName.Text     = se.GenericName;
            txtUsername.Text       = se.Username;
            txtPort.Text           = se.Port;
            chckSkipConfig.Checked = se.SkipConfig;
            chckSkipSFTP.Checked   = se.SkipSFTP;
            chckSkipStatus.Checked = se.SkipStatus;
            chckEnableICMP.Checked = se.SkipICMPScan;
        }
Exemplo n.º 2
0
 private void ChangeCurrentSiteInMemory()
 {
     CheckIfNeedsToBeSaved();
     txtNewFileName.Text = cmboSiteName.Text;
     try
     {
         SiteName = cmboSiteName.Text;
         string        FileName = $@"{Program.PIDConfig()}{cmboSiteName.Text}";
         XmlSerializer xs       = new XmlSerializer(typeof(Settings));
         FileStream    read     = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
         Settings      se       = (Settings)xs.Deserialize(read);
         if (se.isPWEncrypted == false)
         {
             txtPassword.Text = se.Password;
         }
         else
         {
             PasswordManager pm = new PasswordManager();
             txtPassword.Text = pm.DecodeString(se.Password);
         }
         read.Dispose();
         txtDefaultIP.Text      = se.HostIP;
         txtUsername.Text       = se.Username;
         txtSiteName.Text       = se.GenericName;
         txtPort.Text           = se.Port;
         chckSkipStatus.Checked = se.SkipStatus;
         chckSkipConfig.Checked = se.SkipConfig;
         chckSkipSFTP.Checked   = se.SkipSFTP;
         chckEnableICMP.Checked = se.SkipICMPScan;
         ChangeSaveToANegative();
     }
     catch
     {
         return;
     }
 }