generatePassword() public method

Generates a password based on the IMEI or Wifi Mac adress
public generatePassword ( string ImeiMac, DeviceOS OS ) : string
ImeiMac string The IMEI number or the Wifi Mac Adress
OS DeviceOS The mobile operating system the account was registered on.
return string
Ejemplo n.º 1
0
        /// <summary>
        /// Verifies the new account that is about to be added, this method is supposed to run
        /// in a seperated thread.
        /// </summary>
        private void verifyAccount()
        {
            WhatsAppHelper Helper = new WhatsAppHelper();

            WhatsAppHelper.DeviceOS OS = WhatsAppHelper.DeviceOS.Other;
            if (ComboBox_DeviceOS.Text == "iOS")
            {
                OS = WhatsAppHelper.DeviceOS.iOS;
            }
            string Password = Helper.generatePassword(TextBox_ImeiMac.Text, OS);
            bool   Result   = Helper.verifyAccount(ComboBox_CountryCode.Text, TextBox_Phonenumber.Text, Password);

            if (Result == true)
            {
                // Account exists, insert into database
                Dictionary <string, string> Values = new Dictionary <string, string>();
                Values.Add("countrycode", ComboBox_CountryCode.Text);
                Values.Add("phonenumber", TextBox_Phonenumber.Text);
                Values.Add("password", Password);
                Database.Insert("accounts", Values);

                // Resize form
                CollapseForm();

                // Update combobox
                updateAccounts();

                // Set phonenumber as selected
                ComboBox_Login.Text = TextBox_Phonenumber.Text;

                // Clear all fields
                TextBox_ImeiMac.Text     = "";
                TextBox_Phonenumber.Text = "";
                ComboBox_DeviceOS.Text   = "Android";
                Label_ImeiMac.Text       = "International Mobile Equipment Identity (IMEI):";

                // Re-enable controls
                SetControlsEnabled(true);
                Label_Status.Visible = false;
            }
            else
            {
                // Account does not exists
                MessageBox.Show("Sorry, your account does not exists or you have given invalid information. Please re-check all field.", "Error: Account does not exists", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        /// <summary>
        /// Verifies the new account that is about to be added, this method is supposed to run
        /// in a seperated thread.
        /// </summary>
        private void verifyAccount()
        {
            WhatsAppHelper Helper = new WhatsAppHelper();
            WhatsAppHelper.DeviceOS OS = WhatsAppHelper.DeviceOS.Other;
            if (ComboBox_DeviceOS.Text == "iOS") OS = WhatsAppHelper.DeviceOS.iOS;
            string Password = Helper.generatePassword(TextBox_ImeiMac.Text, OS);
            bool Result = Helper.verifyAccount(ComboBox_CountryCode.Text, TextBox_Phonenumber.Text, Password);
            if (Result == true)
            {
                // Account exists, insert into database
                Dictionary<string, string> Values = new Dictionary<string,string>();
                Values.Add("countrycode", ComboBox_CountryCode.Text);
                Values.Add("phonenumber", TextBox_Phonenumber.Text);
                Values.Add("password", Password);
                Database.Insert("accounts", Values);

                // Resize form
                CollapseForm();

                // Update combobox
                updateAccounts();

                // Set phonenumber as selected
                ComboBox_Login.Text = TextBox_Phonenumber.Text;

                // Clear all fields
                TextBox_ImeiMac.Text = "";
                TextBox_Phonenumber.Text = "";
                ComboBox_DeviceOS.Text = "Android";
                Label_ImeiMac.Text = "International Mobile Equipment Identity (IMEI):";

                // Re-enable controls
                SetControlsEnabled(true);
                Label_Status.Visible = false;
            }
            else
            {
                // Account does not exists
                MessageBox.Show("Sorry, your account does not exists or you have given invalid information. Please re-check all field.", "Error: Account does not exists", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }