Ejemplo n.º 1
0
 private void button_login_Click(object sender, EventArgs e)
 {
     Crypt cr = new Crypt();
     string encUsername = cr.Encrypt(textBox_username.Text, "1i2dpMdSp1npd?!_1wi-1dijw1");
     string encPassword = cr.Encrypt(textBox_password.Text, "!@a0s0kdasdASKF424GG*Rergl)");
     string serverip = textBox_ip.Text;
     int serverport = int.Parse(textBox_port.Text);
     //save to file
     SettingsManager manager = new SettingsManager(encUsername, encPassword, serverip, serverport, Properties.Resources.SETTINGS_FILE_ADDRESS);
     int port = 0;
     try
     {
         port = int.Parse(textBox_port.Text);
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid Port", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     Cursor = Cursors.WaitCursor;
     if (ValidateCredentials(textBox_username.Text, textBox_password.Text, textBox_ip.Text, port))
     {
         Cursor = Cursors.Default;
         this.Close();
     }
     else
         Cursor = Cursors.Default;
 }
Ejemplo n.º 2
0
 public Form1()
 {
     InitializeComponent();
     SETTINGS_FILE_ADDRESS = Properties.Resources.SETTINGS_FILE_ADDRESS;
     qualities = new List<string>();
     comboBox_quality.Items.Add(new ComboboxItem("Default Quality", 0));
     comboBox_quality.SelectedIndex = 0;
     SettingsManager manager = new SettingsManager(SETTINGS_FILE_ADDRESS);
     bool login = false;
     if (manager.serverIP != null)
     {
         SERVER_IP = manager.serverIP;
     }
     else
         login = true;
     if (manager.serverPort != null)
     {
         SERVER_PORT = (int)manager.serverPort;
     }
     else
         login = true;
     if (manager.encUsername != null)
     {
         Crypt cr = new Crypt();
         SERVER_USERNAME = cr.Decrypt(manager.encUsername, "1i2dpMdSp1npd?!_1wi-1dijw1");
     }
     else
         login = true;
     if (manager.encPassword != null)
     {
         Crypt cr = new Crypt();
         SERVER_PASSWORD = cr.Decrypt(manager.encPassword, "!@a0s0kdasdASKF424GG*Rergl)");
     }
     else
         login = true;
     if (login)
     {
         Login(SERVER_USERNAME, SERVER_PASSWORD, SERVER_IP, SERVER_PORT);
     }
     string[] args = Environment.GetCommandLineArgs();
     if (args.Length > 1)
     {
         textBox_link.Text = args[1];
         Update();
     }
 }