コード例 #1
0
        public play_scr(main_hub_scr ref_main_hub)
        {
            InitializeComponent();

            main_hub = ref_main_hub;

            play_lobby_grid.DefaultCellStyle.Font = c_font.load_font(10, 1, true);

            //play_lobby_grid.Rows.Add("PREVIEW #1", "Vaba", "Pole valitud", "0/10", "0 - 0", "-", 0);
            //play_lobby_grid.Rows.Add("PREVIEW #2", "Vaba", "Pole valitud", "0/10", "0 - 0", "-", 1);
            //play_lobby_grid.Rows.Add("PREVIEW #3", "Vaba", "Pole valitud", "0/10", "0 - 0", "-", 2);
            //play_lobby_grid.Rows.Add("PREVIEW #4", "Vaba", "Pole valitud", "0/10", "0 - 0", "-", 3);

            for (int i = 0; i <= play_lobby_grid.Rows.Count - 1; i++)
            {
                play_lobby_grid.Rows[i].MinimumHeight = 38;
            }
        }
コード例 #2
0
ファイル: lobby_scr.cs プロジェクト: everezt/Gather-Klient
 public lobby_scr(main_hub_scr ref_main_hub_scr)
 {
     InitializeComponent();
     main_hub_screen = ref_main_hub_scr;
 }
コード例 #3
0
        private void try_login()
        {
            try
            {
                if (username_input.Text == "")
                {
                    throw new Exception("Sisesta kasutajanimi");
                }

                if (password_input.Text == "")
                {
                    throw new Exception("Sisesta parool");
                }

                network udpcon = new network();

                if (udpcon.connect_to_server())
                {
                    // Get sha512 password
                    string sha512_password = "";

                    if (Properties.Settings.Default.remember_me)
                    {
                        sha512_password = Properties.Settings.Default.sha512_pw;
                    }
                    else
                    {
                        UnicodeEncoding UE         = new UnicodeEncoding();
                        byte[]          message    = UE.GetBytes(password_input.Text);
                        SHA512Managed   hashString = new SHA512Managed();

                        byte[] hashValue = hashString.ComputeHash(message);
                        foreach (byte x in hashValue)
                        {
                            sha512_password += String.Format("{0:x2}", x);
                        }
                    }


                    // Let's start building the packet
                    List <string> login_packet = new List <string>();
                    string        version      = Properties.Settings.Default.version.ToString();
                    //Clipboard.SetText(sha512_password);
                    if (version.Contains(","))
                    {
                        version = version.Replace(',', '.');
                    }

                    login_packet.Add(username_input.Text.ToLower());
                    login_packet.Add(sha512_password);

                    login_packet.Add(version);
                    login_packet.Add(get_hw_id());

                    // Send login packet and recieve response
                    byte[] login_response = udpcon.send_and_recieve(0x02, login_packet);

                    if (login_response[0] == 0xFA)
                    {
                        // we have failed login attempt
                        switch (login_response[1])
                        {
                        case 0x01:
                            throw new Exception("Tundmatu veateade!");

                        case 0x02:
                            throw new Exception("Sinu kliendi versioon on liiga vana!");

                        case 0x03:
                            throw new Exception("Vale kasutajanimi või parool!");

                        case 0x04:
                            throw new Exception("Kasutaja on juba sisse loginud. Juhul kui Sinu ühendus aegus, oota 2min!");

                        case 0x05:
                            List <string> ban_info = udpcon.extract_data(login_response);
                            throw new Exception("Sa oled banned.\nPõhjus: " + ban_info[0] + "\nKestab kuni: " + ban_info[1]);

                        case 0x06:
                            throw new Exception("Serveriga ühenduse loomine ebaõnnestus!");
                        }
                    }

                    if (login_response[0] == 0xFF)
                    {
                        // Login was successful
                        List <string> recieved_data = udpcon.extract_data(login_response);
                        steamid = recieved_data[0];
                        string password = recieved_data[1];
                        s_hash = long.Parse(recieved_data[2]);

                        if (password != sha512_password)
                        {
                            List <string> abuse_data = new List <string>();
                            abuse_data.Add("Passwords do not match at user-side after getting 'ok'");
                            //main_client.send_data(0x16, abuseData);
                        }
                        else
                        {
                            if (remember_me.Checked)
                            {
                                string keyName = @"HKEY_CURRENT_USER\SOFTWARE\everest\Gather";
                                Registry.SetValue(keyName, "username", username_input.Text);
                                Registry.SetValue(keyName, "password", sha512_password);
                                Registry.SetValue(keyName, "remember_me", true);
                            }
                            else
                            {
                                string keyName = @"HKEY_CURRENT_USER\SOFTWARE\everest\Gather";
                                Registry.SetValue(keyName, "username", "");
                                Registry.SetValue(keyName, "password", "");
                                Registry.SetValue(keyName, "remember_me", false);
                            }

                            // initialize new window and give refrence to connection and this form
                            main_hub_scr main_window = new main_hub_scr(this, udpcon);
                            main_window.Show();
                            this.Hide();
                            //throw new Exception("LOGIN OK");
                        }
                    }

                    //c_msgbox.show_msg(false, "See funktsioon ei ole valmis veel!\nSinu hw_id: " + get_hw_id());
                }
                else
                {
                    c_msgbox.show_msg(true, "Serveriga ühenduse loomine ebaõnnestus!");
                }
            }
            catch (Exception ex)
            {
                c_msgbox.show_msg(true, ex.Message);
            }
        }
コード例 #4
0
 public update_prof_pic_scr(main_hub_scr ref_hub)
 {
     main_hub_screen = ref_hub;
     InitializeComponent();
     url_input.Font = c_font.load_font(12, 1, true);
 }
コード例 #5
0
ファイル: ready_scr.cs プロジェクト: everezt/Gather-Klient
 public ready_scr(main_hub_scr ref_main_hub)
 {
     InitializeComponent();
     main_hub = ref_main_hub;
     //player_1_ready.AccessibleDescription = "TERE TERE";
 }