Ejemplo n.º 1
0
        private async Task <Tuple <string, bool?> > Check(int i = 0)
        {
            while (PhoneList.Count == 0)
            {
                await Task.Run(() => Thread.Sleep(1));
            }
            var phone = PhoneList.First();

            try
            {
                TLRequestImportContacts requestImportContacts = new TLRequestImportContacts();
                requestImportContacts.Contacts = new TLVector <TLInputPhoneContact>();
                requestImportContacts.Contacts.Add(new TLInputPhoneContact()
                {
                    Phone     = phone,
                    FirstName = "",
                    LastName  = ""
                });
                var o2 = await Client.SendRequestAsync <TLImportedContacts>(requestImportContacts);

                return(new Tuple <string, bool?>(phone, o2.Imported.Count > 0));
            }
            catch (TLSharp.Core.Network.FloodException err)
            {
                await Task.Run(() => Thread.Sleep(err.TimeToWait));

                return(await Check());
            }
            catch when(i < 5)
                {
                    return(await Check(i + 1));
                }
Ejemplo n.º 2
0
        public async Task <int?> ImportContact(string phone, string first_name, string last_name)
        {
            var input_contact = new TLInputPhoneContact()
            {
                Phone     = phone,
                FirstName = first_name,
                LastName  = last_name,
                ClientId  = 0
            };

            List <TLInputPhoneContact> lst = new List <TLInputPhoneContact>();

            lst.Add(input_contact);

            var request = new TLRequestImportContacts()
            {
                Contacts = new TLVector <TLInputPhoneContact>()
                {
                    lists = lst
                }
            };
            await _sender.Send(request);

            await _sender.Receive(request);

            var importedUser = request.Response.Imported.FirstOrDefault();

            return(importedUser?.UserId);
        }
Ejemplo n.º 3
0
        private async void enviarMensaje()
        {
            User u = new User();

            u.recoverUser(id);
            if (MainWindow.client.IsUserAuthorized())
            {
                var result = await MainWindow.client.GetContactsAsync();

                var user = result.Users
                           .Where(x => x.GetType() == typeof(TLUser))
                           .Cast <TLUser>()
                           .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                bool enviar = true;
                if (user == null)
                {
                    var phoneContact = new TLInputPhoneContact()
                    {
                        Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                    };
                    var contacts = new List <TLInputPhoneContact>()
                    {
                        phoneContact
                    };
                    var req = new TLRequestImportContacts()
                    {
                        Contacts = new TLVector <TLInputPhoneContact>(contacts)
                    };
                    var rrr = await MainWindow.client.SendRequestAsync <TLImportedContacts>(req);

                    if (rrr.Imported.Count == 1)
                    {
                        user = result.Users
                               .Where(x => x.GetType() == typeof(TLUser))
                               .Cast <TLUser>()
                               .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                    }
                    else
                    {
                        enviar = false;
                    }
                }
                if (enviar && user != null)
                {
                    StringBuilder mensaje = new StringBuilder();
                    mensaje.Append(Strings.TelegramServiciosModificado + " \n");
                    DataTable servicios = us.datosMensaje(u.Iduser);
                    foreach (DataRow dr in servicios.Rows)
                    {
                        mensaje.Append(" - " + dr["nombre"] + ", " + diasSemana(dr["dias"].ToString()) + ", " + dr["turno"] + "\n");
                    }
                    await MainWindow.client.SendMessageAsync(new TLInputPeerUser()
                    {
                        UserId = user.Id
                    }, mensaje.ToString());
                }
            }
        }
Ejemplo n.º 4
0
        public async Task <TLImportedContacts> ImportContactsAsync(IReadOnlyList <TLInputPhoneContact> contacts, CancellationToken token = default(CancellationToken))
        {
            var req = new TLRequestImportContacts {
                Contacts = new TLVector <TLInputPhoneContact>(contacts)
            };

            return(await SendAuthenticatedRequestAsync <TLImportedContacts>(req, token)
                   .ConfigureAwait(false));
        }
Ejemplo n.º 5
0
        private async void enviarMensaje()
        {
            User u = new User();

            u.recoverUser(id);
            if (MainWindow.client.IsUserAuthorized())
            {
                var result = await MainWindow.client.GetContactsAsync();

                var user = result.Users
                           .Where(x => x.GetType() == typeof(TLUser))
                           .Cast <TLUser>()
                           .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                bool enviar = true;
                if (user == null)
                {
                    var phoneContact = new TLInputPhoneContact()
                    {
                        Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                    };
                    var contacts = new List <TLInputPhoneContact>()
                    {
                        phoneContact
                    };
                    var req = new TLRequestImportContacts()
                    {
                        Contacts = new TLVector <TLInputPhoneContact>(contacts)
                    };
                    var rrr = await MainWindow.client.SendRequestAsync <TLImportedContacts>(req);

                    if (rrr.Imported.Count == 1)
                    {
                        user = result.Users
                               .Where(x => x.GetType() == typeof(TLUser))
                               .Cast <TLUser>()
                               .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                    }
                    else
                    {
                        enviar = false;
                    }
                }
                if (enviar && user != null)
                {
                    await MainWindow.client.SendMessageAsync(new TLInputPeerUser()
                    {
                        UserId = user.Id
                    }, texto.Text);

                    CustomMessageBox.Show(Strings.MensajeEnviado);
                }
                else
                {
                    CustomMessageBox.Show(Strings.MsgNoTelegram);
                }
            }
        }
Ejemplo n.º 6
0
        private async void enviarMensaje()
        {
            User u = new User();

            u.recoverUser(iduser);
            if (MainWindow.client.IsUserAuthorized())
            {
                var result = await MainWindow.client.GetContactsAsync();

                var user = result.Users
                           .Where(x => x.GetType() == typeof(TLUser))
                           .Cast <TLUser>()
                           .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                bool enviar = true;
                if (user == null)
                {
                    var phoneContact = new TLInputPhoneContact()
                    {
                        Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                    };
                    var contacts = new List <TLInputPhoneContact>()
                    {
                        phoneContact
                    };
                    var req = new TLRequestImportContacts()
                    {
                        Contacts = new TLVector <TLInputPhoneContact>(contacts)
                    };
                    var rrr = await MainWindow.client.SendRequestAsync <TLImportedContacts>(req);

                    if (rrr.Imported.Count == 1)
                    {
                        user = result.Users
                               .Where(x => x.GetType() == typeof(TLUser))
                               .Cast <TLUser>()
                               .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                    }
                    else
                    {
                        enviar = false;
                    }
                }
                if (enviar && user != null)
                {
                    StringBuilder mensaje = new StringBuilder();
                    mensaje.Append(Strings.TelegramTrabajoCreado + " \n");
                    mensaje.Append(" - " + Strings.Nombre + a.Nombre + "\n - " + Strings.Fecha + a.Fecha + "\n - " + Strings.Precio + a.Precio + "€\n - " + Strings.Descripcion + a.Descripcion);
                    await MainWindow.client.SendMessageAsync(new TLInputPeerUser()
                    {
                        UserId = user.Id
                    }, mensaje.ToString());
                }
            }
        }
Ejemplo n.º 7
0
        private async void enviarMensaje(Stream tmp)
        {
            if (client.IsUserAuthorized())
            {
                var result = await client.GetContactsAsync();

                var user = result.Users
                           .Where(x => x.GetType() == typeof(TLUser))
                           .Cast <TLUser>()
                           .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                bool enviar = true;
                if (user == null)
                {
                    var phoneContact = new TLInputPhoneContact()
                    {
                        Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                    };
                    var contacts = new List <TLInputPhoneContact>()
                    {
                        phoneContact
                    };
                    var req = new TLRequestImportContacts()
                    {
                        Contacts = new TLVector <TLInputPhoneContact>(contacts)
                    };
                    var rrr = await client.SendRequestAsync <TLImportedContacts>(req);

                    if (rrr.Imported.Count == 1)
                    {
                        user = result.Users
                               .Where(x => x.GetType() == typeof(TLUser))
                               .Cast <TLUser>()
                               .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                    }
                    else
                    {
                        enviar = false;
                    }
                }
                if (enviar && user != null)
                {
                    var fileResult = await client.UploadFile(Strings.Factura + i.Mes + "/" + i.Año, new StreamReader(tmp));

                    TLDocumentAttributeFilename name = new TLDocumentAttributeFilename();
                    name.FileName = Strings.Factura + i.Mes + "/" + i.Año + ".pdf";
                    await client.SendUploadedDocument(new TLInputPeerUser()
                    {
                        UserId = user.Id
                    }, fileResult, "", "application/pdf", new TLVector <TLAbsDocumentAttribute>() { name });
                }
            }
        }
Ejemplo n.º 8
0
        public async Task <TLImportedContacts> AddContact(string phoneNumber, string firstName, string lastName)
        {
            var contacts = new TLVector <TLInputPhoneContact>();

            contacts.Add(new TLInputPhoneContact
            {
                Phone     = phoneNumber,
                FirstName = firstName,
                LastName  = lastName
            });

            var req = new TLRequestImportContacts()
            {
                Contacts = contacts
            };

            return(await telegramClient?.SendRequestAsync <TLImportedContacts>(req));
        }
Ejemplo n.º 9
0
        public async Task <TLImportedContacts> ImportContactsAsync(List <TLInputPhoneContact> list)
        {
            if (!IsUserAuthorized())
            {
                throw new InvalidOperationException("Authorize user first!");
            }
            TLRequestImportContacts tr = new TLRequestImportContacts()
            {
                replace  = false,
                contacts = new TLVector <TLInputPhoneContact>()
                {
                    lists = list
                },
                Dirty = false
            };

            return(await SendRequestAsync <TLImportedContacts>(tr));
        }
Ejemplo n.º 10
0
        public async Task AddUserToContactsAsync(UserInfoDto model)
        {
            if (string.IsNullOrWhiteSpace(model.Login))
            {
                throw new ArgumentException("Login can't be empty");
            }

            if (!Regex.Match(model.Login, phoneNumberPattern).Success)
            {
                throw new ArgumentException("Login is not a valid phone number: " + model.Login);
            }

            // this is because the contacts in the address come without the "+" prefix
            var normalizedNumber = model.Login.StartsWith("+") ?
                                   model.Login.Substring(1, model.Login.Length - 1) :
                                   model.Login;

            if (string.IsNullOrWhiteSpace(model.FirstName))
            {
                throw new ArgumentException("First name can't be empty");
            }

            if (string.IsNullOrWhiteSpace(model.LastName))
            {
                throw new ArgumentException("Last name can't be empty");
            }

            TLVector <TLInputPhoneContact> contacts = new TLVector <TLInputPhoneContact>
            {
                new TLInputPhoneContact()
                {
                    Phone = normalizedNumber, FirstName = model.FirstName, LastName = model.LastName
                }
            };

            var request = new TLRequestImportContacts()
            {
                Contacts = contacts
            };

            await client.SendRequestAsync <TLImportedContacts>(request);

            Contacts = await client.GetContactsAsync(); // Updating saved contacts
        }
Ejemplo n.º 11
0
        private async void enviarMensaje()
        {
            User        utmp  = new User();
            DataTable   uws   = utmp.userWithService(s.Idservice);
            List <User> lista = new List <User>();

            foreach (DataRow dr in uws.Rows)
            {
                utmp.recoverUser(int.Parse(dr["iduser"].ToString()));
                lista.Add(utmp);
            }


            if (MainWindow.client.IsUserAuthorized())
            {
                var result = await MainWindow.client.GetContactsAsync();

                foreach (User u in lista)
                {
                    var user = result.Users
                               .Where(x => x.GetType() == typeof(TLUser))
                               .Cast <TLUser>()
                               .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                    bool enviar = true;
                    if (user == null)
                    {
                        var phoneContact = new TLInputPhoneContact()
                        {
                            Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                        };
                        var contacts = new List <TLInputPhoneContact>()
                        {
                            phoneContact
                        };
                        var req = new TLRequestImportContacts()
                        {
                            Contacts = new TLVector <TLInputPhoneContact>(contacts)
                        };
                        var rrr = await MainWindow.client.SendRequestAsync <TLImportedContacts>(req);

                        if (rrr.Imported.Count == 1)
                        {
                            user = result.Users
                                   .Where(x => x.GetType() == typeof(TLUser))
                                   .Cast <TLUser>()
                                   .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                        }
                        else
                        {
                            enviar = false;
                        }
                    }
                    if (enviar && user != null)
                    {
                        Turn          t       = new Turn();
                        DataRow       dr      = t.singleTurn(s.Refturn);
                        StringBuilder mensaje = new StringBuilder();
                        mensaje.Append(Strings.TelegramServicioModificado + " \n");
                        mensaje.Append(" - " + Strings.Nombre + s.Nombre + "\n - " + Strings.Dias + diasSemana(s.Dias.ToString()) + "\n - " + Strings.Precio + s.Precio + "€\n - " + Strings.Turno + dr[0].ToString() + " - " + dr[1].ToString() + "\n - " + Strings.Descripcion + s.Descripcion);
                        await MainWindow.client.SendMessageAsync(new TLInputPeerUser()
                        {
                            UserId = user.Id
                        }, mensaje.ToString());
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private async void obtenerFoto()
        {
            var result = await MainWindow.client.GetContactsAsync();

            var user = result.Users
                       .Where(x => x.GetType() == typeof(TLUser))
                       .Cast <TLUser>()
                       .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
            bool mirarfoto = true;

            if (user == null)
            {
                //await MainWindow.client.ConnectAsync();
                var phoneContact = new TLInputPhoneContact()
                {
                    Phone = "34" + u.Telefono, FirstName = u.Nombre, LastName = u.Apellidos
                };
                var contacts = new List <TLInputPhoneContact>()
                {
                    phoneContact
                };
                var req = new TLRequestImportContacts()
                {
                    Contacts = new TLVector <TLInputPhoneContact>(contacts)
                };
                var rrr = await MainWindow.client.SendRequestAsync <TLImportedContacts>(req);

                if (rrr.Imported.Count == 1)
                {
                    user = result.Users
                           .Where(x => x.GetType() == typeof(TLUser))
                           .Cast <TLUser>()
                           .FirstOrDefault(x => x.Phone == "34" + u.Telefono);
                }
                else
                {
                    mirarfoto = false;
                }
            }
            if (mirarfoto && user != null)
            {
                TLAbsUserProfilePhoto photo = user.Photo;
                TLUserProfilePhoto    up    = (TLUserProfilePhoto)photo;
                if (up != null && up.PhotoBig != null)
                {
                    TLFileLocation         tf   = (TLFileLocation)up.PhotoBig;
                    TLAbsInputFileLocation aifl = new TLInputFileLocation()
                    {
                        LocalId  = tf.LocalId,
                        Secret   = tf.Secret,
                        VolumeId = tf.VolumeId
                    };
                    TeleSharp.TL.Upload.TLFile buffer = await MainWindow.client.GetFile(aifl, 1024 * 1024);

                    if (buffer.Bytes != null)
                    {
                        u.Photo = buffer.Bytes;
                        u.cambiarFoto();
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public async Task <Respuestas> EnviarMensajeAUsuarioN(Mensaje nuevo, string pathArchivo, string nombreUsuario = "")
        {
            Respuestas respuesta = new Respuestas();

            try
            {
                var numeroformateado = nuevo.NumeroDestino.StartsWith("+") ?
                                       nuevo.NumeroDestino.Substring(1) :
                                       nuevo.NumeroDestino;
                contexto = Iniciar();
                await contexto.ConnectAsync();

                var nvoContacto = new TLInputPhoneContact()
                {
                    Phone = numeroformateado, FirstName = ((string.IsNullOrEmpty(nuevo.NombreNuevoUsuario) ? "user" + numeroformateado : nuevo.NombreNuevoUsuario)), LastName = string.Empty
                };

                var req = new TLRequestImportContacts()
                {
                    Contacts = new TLVector <TLInputPhoneContact>()
                    {
                        nvoContacto
                    }
                };
                var resultado = await contexto.SendRequestAsync <TLImportedContacts>(req);

                //aqui carga 1ro infaliblemente el user_id 1ro... y es extraible...
                if (resultado.Users.Count > 0)
                {
                    var idnuevo        = resultado.Users.OfType <TLUser>().ElementAtOrDefault(0).Id;
                    var usuarioDestino = resultado.Users.OfType <TLUser>().FirstOrDefault(x => x.Id == idnuevo);
                    if (usuarioDestino == null)
                    {
                        respuesta.MESSAGE = "No se encontro usuario Destino, verifique que sea un número telefónico asociado a una cuenta Telegram...";
                        respuesta.STATUS  = false;
                        return(respuesta);
                    }
                    bool completado = false;
                    completado = await contexto.SendTypingAsync(new TLInputPeerUser()
                    {
                        UserId = usuarioDestino.Id
                    });

                    await Task.Delay(3000);

                    if (completado)
                    {
                        await contexto.SendMessageAsync(new TLInputPeerUser()
                        {
                            UserId = usuarioDestino.Id
                        }, nuevo.TextoContenido);
                    }
                    else
                    {
                        respuesta.MESSAGE = "No se pudo sincronizar con Telegram, intente nuevamente o pruebe reautenticando...";
                        respuesta.STATUS  = false;
                        return(respuesta);
                    }
                    respuesta.MESSAGE = "Mensaje enviado exitosamente a: " + numeroformateado;
                    respuesta.STATUS  = true;
                    return(respuesta);
                }
                else
                {
                    respuesta.MESSAGE = "Error interno, no se pudo enviar mensaje a nuevo usuario";
                    respuesta.STATUS  = false;
                    return(respuesta);
                }
            }
            catch (Exception e)
            {
                respuesta.MESSAGE = "No se pudo enviar mensaje error: " + e.Message;
                respuesta.STATUS  = false;
                return(respuesta);
            }
        }
Ejemplo n.º 14
0
        public async Task <Respuestas> EnviarImagenAUsuarioN(Mensaje nuevo)
        {
            Respuestas respuesta = new Respuestas();

            try
            {
                var numeroformateado = nuevo.NumeroDestino.StartsWith("+") ?
                                       nuevo.NumeroDestino.Substring(1) :
                                       nuevo.NumeroDestino;
                contexto = Iniciar();
                await contexto.ConnectAsync();

                var nvoContacto = new TLInputPhoneContact()
                {
                    Phone = numeroformateado, FirstName = ((string.IsNullOrEmpty(nuevo.NombreNuevoUsuario) ? "user" + numeroformateado : nuevo.NombreNuevoUsuario)), LastName = string.Empty
                };
                var contactos = new List <TLInputPhoneContact>()
                {
                    nvoContacto
                };

                var req = new TLRequestImportContacts()
                {
                    Contacts = new TLVector <TLInputPhoneContact>()
                    {
                        nvoContacto
                    }
                };
                var resultado = await contexto.SendRequestAsync <TLImportedContacts>(req);

                //aqui carga 1ro infaliblemente el user_id 1ro... y es extraible...
                if (resultado.Users.Count > 0)
                {
                    var idnuevo        = resultado.Users.OfType <TLUser>().ElementAtOrDefault(0).Id;
                    var usuarioDestino = resultado.Users.OfType <TLUser>().FirstOrDefault(x => x.Id == idnuevo);
                    if (usuarioDestino == null)
                    {
                        respuesta.MESSAGE = "No se encontro usuario Destino, verifique que sea un número telefónico asociado a una cuenta Telegram...";
                        respuesta.STATUS  = false;
                        return(respuesta);
                    }


                    MemoryStream imagen = new MemoryStream(Convert.FromBase64String(nuevo.Imagen));
                    //var im = Image.FromStream(imagen);
                    //Image imagen_redimensionada = ResizeImage(im, 300, 60);
                    //args.Image = imagen_redimensionada;
                    StreamReader imageStream = new StreamReader(imagen); //verificar encoding

                    var archivo = new TLInputFile();
                    archivo = (TLInputFile)await contexto.UploadFile("Image" + (new Random().Next()) + ".jpg", imageStream);

                    if (archivo != null)
                    {
                        await contexto.SendUploadedPhoto(new TLInputPeerUser()
                        {
                            UserId = usuarioDestino.Id
                        }, archivo, nuevo.DescripcionImagen);

                        respuesta.MESSAGE = "Imagen enviada a: " + numeroformateado;
                        respuesta.STATUS  = true;
                        return(respuesta);
                    }
                    else
                    {
                        respuesta.MESSAGE = "No se pudo enviar imagen, ERROR INTERNO...";
                        respuesta.STATUS  = false;
                        return(respuesta);
                    }
                }
                else
                {
                    respuesta.MESSAGE = "Error interno, no se pudo enviar mensaje a nuevo usuario";
                    respuesta.STATUS  = false;
                    return(respuesta);
                }
            }
            catch (Exception e)
            {
                respuesta.MESSAGE = "No se pudo enviar mensaje error: " + e.Message;
                respuesta.STATUS  = false;
                return(respuesta);
            }
        }
Ejemplo n.º 15
0
        private async void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.textBox1.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(this.textBox2.Text))
            {
                return;
            }
            try
            {
                int num1 = await Program.client.ConnectAsync(false) ? 1 : 0;

                IEnumerable <string> source = ((IEnumerable <string>) this.textBox1.Text.Split(',')).Select <string, string>((Func <string, string>)(x => x.Trim()));
                if (source.Count <string>() > 3)
                {
                    int num2 = (int)MessageBox.Show("In FREE version you can send only to 3 users at once. Get FULL version to remove the restriction.", "Full Version needed");
                }
                else
                {
                    TLRequestImportContacts requestImportContacts = new TLRequestImportContacts();
                    requestImportContacts.contacts = new TLVector <TLInputPhoneContact>();
                    int num3 = 0;
                    this.progressBar1.Minimum = 0;
                    this.progressBar1.Maximum = source.Count <string>();
                    this.progressBar1.Step    = 1;
                    this.progressBar1.Enabled = true;
                    foreach (string str in source)
                    {
                        requestImportContacts.contacts.lists.Add(new TLInputPhoneContact()
                        {
                            phone      = str,
                            first_name = num3.ToString(),
                            last_name  = num3.ToString()
                        });
                        ++num3;
                    }
                    foreach (object list in (await Program.client.SendRequestAsync <TLImportedContacts>((TLMethod)requestImportContacts)).users.lists)
                    {
                    }
                }
            }

            /*
             * // ISSUE: reference to a compiler-generated field
             *    if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__3 == null)
             *    {
             *      // ISSUE: reference to a compiler-generated field
             *      MainForm.\u003C\u003Eo__1.\u003C\u003Ep__3 = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, ExpressionType.IsTrue, typeof (MainForm), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
             *      {
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
             *      }));
             *    }
             *    // ISSUE: reference to a compiler-generated field
             *    Func<CallSite, object, bool> target1 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__3.Target;
             *    // ISSUE: reference to a compiler-generated field
             *    CallSite<Func<CallSite, object, bool>> p3 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__3;
             *    // ISSUE: reference to a compiler-generated field
             *    if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__2 == null)
             *    {
             *      // ISSUE: reference to a compiler-generated field
             *      MainForm.\u003C\u003Eo__1.\u003C\u003Ep__2 = CallSite<Func<CallSite, object, object, object>>.Create(Binder.BinaryOperation(CSharpBinderFlags.None, ExpressionType.Equal, typeof (MainForm), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[2]
             *      {
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null),
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.Constant, (string) null)
             *      }));
             *    }
             *    // ISSUE: reference to a compiler-generated field
             *    Func<CallSite, object, object, object> target2 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__2.Target;
             *    // ISSUE: reference to a compiler-generated field
             *    CallSite<Func<CallSite, object, object, object>> p2 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__2;
             *    // ISSUE: reference to a compiler-generated field
             *    if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__1 == null)
             *    {
             *      // ISSUE: reference to a compiler-generated field
             *      MainForm.\u003C\u003Eo__1.\u003C\u003Ep__1 = CallSite<Func<CallSite, object, string, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "GetProperty", (IEnumerable<Type>) null, typeof (MainForm), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[2]
             *      {
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null),
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, (string) null)
             *      }));
             *    }
             *    // ISSUE: reference to a compiler-generated field
             *    Func<CallSite, object, string, object> target3 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__1.Target;
             *    // ISSUE: reference to a compiler-generated field
             *    CallSite<Func<CallSite, object, string, object>> p1 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__1;
             *    // ISSUE: reference to a compiler-generated field
             *    if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__0 == null)
             *    {
             *      // ISSUE: reference to a compiler-generated field
             *      MainForm.\u003C\u003Eo__1.\u003C\u003Ep__0 = CallSite<Func<CallSite, object, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "GetType", (IEnumerable<Type>) null, typeof (MainForm), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
             *      {
             *        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
             *      }));
             *    }
             *    // ISSUE: reference to a compiler-generated field
             *    // ISSUE: reference to a compiler-generated field
             *    object obj1 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__0.Target((CallSite) MainForm.\u003C\u003Eo__1.\u003C\u003Ep__0, list);
             *    string str = "id";
             *    object obj2 = target3((CallSite) p1, obj1, str);
             *    // ISSUE: variable of the null type
             *    __Null local = null;
             *    object obj3 = target2((CallSite) p2, obj2, (object) local);
             *    if (!target1((CallSite) p3, obj3))
             *    {
             *      TLInputPeerUser tlInputPeerUser1 = new TLInputPeerUser();
             *      TLInputPeerUser tlInputPeerUser2 = tlInputPeerUser1;
             *      // ISSUE: reference to a compiler-generated field
             *      if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__5 == null)
             *      {
             *        // ISSUE: reference to a compiler-generated field
             *        MainForm.\u003C\u003Eo__1.\u003C\u003Ep__5 = CallSite<Func<CallSite, object, int>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof (int), typeof (MainForm)));
             *      }
             *      // ISSUE: reference to a compiler-generated field
             *      Func<CallSite, object, int> target4 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__5.Target;
             *      // ISSUE: reference to a compiler-generated field
             *      CallSite<Func<CallSite, object, int>> p5 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__5;
             *      // ISSUE: reference to a compiler-generated field
             *      if (MainForm.\u003C\u003Eo__1.\u003C\u003Ep__4 == null)
             *      {
             *        // ISSUE: reference to a compiler-generated field
             *        MainForm.\u003C\u003Eo__1.\u003C\u003Ep__4 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "id", typeof (MainForm), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
             *        {
             *          CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
             *        }));
             *      }
             *      // ISSUE: reference to a compiler-generated field
             *      // ISSUE: reference to a compiler-generated field
             *      object obj4 = MainForm.\u003C\u003Eo__1.\u003C\u003Ep__4.Target((CallSite) MainForm.\u003C\u003Eo__1.\u003C\u003Ep__4, list);
             *      int num4 = target4((CallSite) p5, obj4);
             *      tlInputPeerUser2.user_id = num4;
             *      TLAbsUpdates tlAbsUpdates = await Program.client.SendMessageAsync((TLAbsInputPeer) tlInputPeerUser1, this.textBox2.Text);
             *      this.progressBar1.PerformStep();
             *      Thread.Sleep(2000);
             *    }
             *  }
             *  List<TLAbsUser>.Enumerator enumerator = new List<TLAbsUser>.Enumerator();
             *  this.progressBar1.Enabled = false;
             *  this.progressBar1.Value = 0;
             *  int num5 = (int) MessageBox.Show("Sent!", "Success");
             *
             */

            catch (Exception ex)
            {
                int num = (int)MessageBox.Show(string.Format("Something went wrong. Exception: {0}", (object)ex.ToString()), "Error");
            }
        }