A class with some functions to verify accounts, register accounts
        public void ExcuteAnalyzeFile()
        {
            if (FilePath == "")
            {
                State = "请输入文件路径";
                return;
            }

            State = "解析中...";
            Task.Factory.StartNew(() =>
            {
                try
                {
                    HeapFileAnalyzer x = new HeapFileAnalyzer(FilePath);

                    x.DoWork();
                    Msgs  = WhatsAppHelper.GetMessages(x);
                    State = "解析完成!";
                }
                catch
                {
                    State = "解析出现异常";
                }
            });
        }
Exemple #2
0
        /// <summary>
        /// Handles logging in, supposed to run in a seperated thread
        /// </summary>
        private void login()
        {
            if (ComboBox_Login.SelectedItem == null)
            {
                return;
            }
            WhatsappAccount Account = (WhatsappAccount)ComboBox_Login.SelectedItem;

            // Verify Account
            WhatsAppHelper Helper = new WhatsAppHelper();
            bool           Result = Helper.verifyAccount(Account.CountryCode, Account.Phonenumber, Account.Password);

            if (Result == true)
            {
                // Account is valid, show main form
                Form_Main frmMain = new Form_Main(Account);
                this.Close();
                frmMain.ShowDialog();
            }
            else
            {
                DialogResult Re = MessageBox.Show("The selected acocunt does not appear to be working, do you want to remove it?", "Error: Account not working", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (Re == DialogResult.Yes)
                {
                    // Delete account
                    Database.Query("DELETE FROM accounts WHERE phonenumber='" + Account.Phonenumber + "'");

                    // Reload combobox
                    updateAccounts();

                    // Hide status label
                    Label_Status.Visible = false;
                    Label_Status.Text    = "Please wait while we verify your account.";

                    // Enable controls
                    SetControlsEnabled(true);
                }
                else
                {
                    // Reload combobox
                    updateAccounts();

                    // Hide status label
                    Label_Status.Visible = false;
                    Label_Status.Text    = "Please wait while we verify your account.";

                    // Enable controls
                    SetControlsEnabled(true);
                }
            }
        }
Exemple #3
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;
            }
        }
        /// <summary>
        /// Handles logging in, supposed to run in a seperated thread
        /// </summary>
        private void login()
        {
            if (ComboBox_Login.SelectedItem == null)
                return;
            WhatsappAccount Account = (WhatsappAccount)ComboBox_Login.SelectedItem;

            // Verify Account
            WhatsAppHelper Helper = new WhatsAppHelper();
            bool Result = Helper.verifyAccount(Account.CountryCode, Account.Phonenumber, Account.Password);
            if (Result == true)
            {
                // Account is valid, show main form
                Form_Main frmMain = new Form_Main(Account);
                this.Close();
                frmMain.ShowDialog();
            }
            else
            {
                DialogResult Re = MessageBox.Show("The selected acocunt does not appear to be working, do you want to remove it?", "Error: Account not working", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (Re == DialogResult.Yes)
                {
                    // Delete account
                    Database.Query("DELETE FROM accounts WHERE phonenumber='" + Account.Phonenumber + "'");

                    // Reload combobox
                    updateAccounts();

                    // Hide status label
                    Label_Status.Visible = false;
                    Label_Status.Text = "Please wait while we verify your account.";

                    // Enable controls
                    SetControlsEnabled(true);
                }
                else
                {
                    // Reload combobox
                    updateAccounts();

                    // Hide status label
                    Label_Status.Visible = false;
                    Label_Status.Text = "Please wait while we verify your account.";

                    // Enable controls
                    SetControlsEnabled(true);
                }
            }
        }