Exemplo n.º 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();
        }
Exemplo n.º 2
0
        private bool _requestCode(out string response)
        {
            string str1 = (string)null;
            bool   flag = WhatsRegisterV2.RequestCode(this.number, out this.password, out str1, out response, this.method, this.identity);

            MessageBox.Show(str1 + "!!!!" + response);
            textBox2.Text = str1;
            if (this.debug)
            {
                string   format   = "Code Request:\nToken = {0}\nIdentity = {1}\nUser Agent = {2}\nRequest = {3}\nResponse = {4}";
                object[] objArray = new object[5];
                int      index1   = 0;
                string   token    = WhatsRegisterV2.GetToken(this.phone);
                objArray[index1] = (object)token;
                int    index2 = 1;
                string str2   = this.identity;
                objArray[index2] = (object)str2;
                int    index3 = 2;
                string str3   = "WhatsApp/2.12.81 S40Version/14.26 Device/Nokia302";
                objArray[index3] = (object)str3;
                int    index4 = 3;
                string str4   = str1;
                objArray[index4] = (object)str4;
                int    index5 = 4;
                string str5   = response;
                objArray[index5] = (object)str5;
                this.Notify(string.Format(format, objArray));
            }
            if (flag)
            {
                if (!string.IsNullOrEmpty(this.password))
                {
                    this.OnReceivePassword();
                }
                else
                {
                    this.grpStep1.Enabled = false;
                    this.grpStep2.Enabled = true;
                    this.Notify(string.Format("Code sent by {0} to {1}", (object)this.method, (object)this.number));
                }
            }
            return(flag);
        }