Exemple #1
0
        private static void RegisterAccount()
        {
            Console.Write("CountryCode (ex. 31): ");
            string countryCode = Console.ReadLine();

            Console.Write("Phonenumber (ex. 650568134): ");
            string phoneNumber = Console.ReadLine();
            string password    = null;

            if (!WhatsRegisterV2.RequestCode(countryCode, phoneNumber, out password))
            {
                return;
            }
            Console.Write("Enter received code: ");
            string tmpCode = Console.ReadLine();

            password = WhatsRegisterV2.RegisterCode(countryCode, phoneNumber, tmpCode);
            if (String.IsNullOrEmpty(password))
            {
                Console.WriteLine("Error registering code");
            }
            else
            {
                Console.WriteLine(String.Format("Registration succesful. Password = {0}", password));
            }
            Console.ReadLine();
        }
Exemple #2
0
        private void btnRegisterCode_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtCode.Text) || this.txtCode.Text.Length != 6)
            {
                return;
            }
            this.code = this.txtCode.Text;
            string str1 = string.Empty;

            this.password = WhatsRegisterV2.RegisterCode(this.number, this.code, out str1, this.identity);
            MessageBox.Show(str1);
            if (this.debug)
            {
                string   format   = "Code register:\nCode = {0}\nNumber = {1}\nIdentity = {2}\nResponse = {3}";
                object[] objArray = new object[4];
                int      index1   = 0;
                string   str2     = this.code;
                objArray[index1] = (object)str2;
                int    index2 = 1;
                string str3   = this.number;
                objArray[index2] = (object)str3;
                int    index3 = 2;
                string str4   = this.identity;
                objArray[index3] = (object)str4;
                int    index4 = 3;
                string str5   = str1;
                objArray[index4] = (object)str5;
                this.Notify(string.Format(format, objArray));
            }
            if (!string.IsNullOrEmpty(this.password))
            {
                this.OnReceivePassword();
            }
            else
            {
                this.Notify("Verification code not accepted");
            }
        }