Си диез / Говнокод #3892 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
private void _Login()
        {
            if (Get_IPAdress_Server() != 0)
            {
                if (Error_Connect_Method != null) Error_Connect_Method(this, "Серевер недоступен!");
                return;
            }
            try
            {
                TcpClient MClient = new TcpClient(Server_IPAdress, Server_Port);
                Sock = MClient.Client;
                if (Sock == null)
                {
                    if (Error_Connect_Method != null) Error_Connect_Method(this ,"Серевер недоступен!");
                    return;
                }
                mrim_packet_header Pack = new mrim_packet_header(Msg.CS_MAGIC, Msg.PROTO_VERSION, seq, Msg.MRIM_CS_HELLO, 0, 0, 0, 0, 0, 0, 0);
                byte[] Hello = Pack.Generat_Packet();
                Sock.Send(Hello);
                byte[] Buf = new byte[48];
                Sock.Receive(Buf);
                if (BitConverter.ToUInt32(Buf.Skip(12).Take(4).ToArray(), 0) != Msg.MRIM_CS_HELLO_ACK)
                {
                    Sock.Close();
                    if (Error_Connect_Method != null) Error_Connect_Method(this, "Серевер недоступен!");
                }
                Ping_Timer = new System.Timers.Timer();
                long j = 0;
                Ping_Timer.Interval = mrim_packet_header.Get_UL(Buf.Skip(44).ToArray(), ref j) * 1000;
                Ping_Timer.Elapsed += new System.Timers.ElapsedEventHandler(Send_Ping);
                Ping_Timer.Start();
                Pack = new mrim_packet_header(Msg.CS_MAGIC, Msg.PROTO_VERSION, seq, Msg.MRIM_CS_LOGIN2, 0, 0, 0, 0, 0, 0, 0);
                Pack.Add_Date_LPS(new string[] {Login, Password });
                Pack.Add_Date_UL(new long[] { Status });
                Pack.Add_Date_LPS(new string[] { User_Agent });
                byte[] Auth = Pack.Generat_Packet();
                Sock.Send(Auth);
                Buf = new byte[48];
                Sock.Receive(Buf);
                byte[] Date_Len;
                byte[] Date;
                if (BitConverter.ToUInt32(Buf.Skip(12).Take(4).ToArray(), 0) != Msg.MRIM_CS_LOGIN_ACK)
                {
                    Date_Len = new byte[4] { Buf[16], Buf[17], Buf[18], Buf[19] };
                    Date = new byte[BitConverter.ToUInt32(Date_Len, 0)];
                    int N = Sock.Receive(Date);
                    mrim.mrim_packet_header.Loger(Date, N);
                    if (Error_Connect_Method != null) Error_Connect_Method(this, Encoding.GetEncoding("windows-1251").GetString(Date));
                    return;
                }
                if (Complite_Connect_Method != null) Complite_Connect_Method(this);
                Sock.Receive(Buf = new byte[44]);
                if (BitConverter.ToUInt32(Buf.Skip(12).Take(4).ToArray(), 0) == Msg.MRIM_CS_USER_INFO)
                {
                    Date_Len = new byte[4] { Buf[16], Buf[17], Buf[18], Buf[19] };
                    Date = new byte[BitConverter.ToUInt32(Date_Len, 0)];
                    int N = Sock.Receive(Date);
                    long M = 0;
                    long J = 0;
                    byte[] Buf_Text;
                    while (N > J)

Мега авторизация на сервере mrim.mail.ru

Запостил: Nigma143 Nigma143, (Updated )

Комментарии (2) RSS

Добавить комментарий

Семь раз отмерь — один отрежь, guest!

    А не использовать ли нам bbcode?


    8