Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MySql.Data.MySqlClient;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Rack
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- checkInternetState();
- checkforUpdates();
- }
- // Zostanie użyte w przyszłości
- public float version = 1.1f;
- public static int loggedUserID = -1;
- public bool czyjestPol = false;
- public bool logged1 = false;
- public bool logged2 = false;
- void checkforUpdates()
- {
- if(czyjestPol == false)
- {
- return;
- }
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/update.txt");
- string b = wc.DownloadString("http://www.rack.c0.pl/updatelink.txt");
- if (a == "1")
- {
- MessageBox.Show("Wymagana Aktualizacja. Ctrl + V w przeglądarce w miejscu na url. " + b);
- string z = "Wymagana Aktualizacja. Link: " + b;
- System.Windows.Forms.Clipboard.SetText(b);
- }
- }
- void checkInternetState(){
- try
- {
- using (var klient = new WebClient())
- {
- using (var strumien = klient.OpenRead("https://www.google.com"))
- {
- checkBox2.Checked = true;
- checkBox2.Text = "połączony";
- checkBox2.BackColor = Color.Green;
- czyjestPol = true;
- }
- }
- }
- catch
- {
- checkBox2.Checked = false;
- checkBox2.Text = "brak połączenia";
- checkBox2.BackColor = Color.Red;
- czyjestPol = false;
- }
- if (czyjestPol)
- {
- panel1.Show();
- }
- else {
- panel1.Hide();
- }
- }
- private void exit(object sender, EventArgs e)
- {
- System.Diagnostics.Process.GetCurrentProcess().Kill();
- }
- private void Zaloguj_Click(object sender, EventArgs e)
- {
- try
- {
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/User1/ID.txt");
- string b = wc.DownloadString("http://www.rack.c0.pl/User2/ID.txt");
- if (textBox1.Text == a)
- {
- logged1 = true;
- loggedUserID = 1;
- }
- if (textBox1.Text == b) {
- logged1 = true;
- loggedUserID = 2;
- }
- }
- catch
- {
- MessageBox.Show("Nie wpisałeś ID lub nie masz połączenia");
- }
- try
- {
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/User1/pass.txt");
- string b = wc.DownloadString("http://www.rack.c0.pl/User2/pass.txt");
- if (textBox2.Text == a || textBox2.Text == b)
- {
- logged2 = true;
- }
- }
- catch
- {
- MessageBox.Show("Nie wpisałeś hasła lub nie masz połączenia");
- }
- if (logged1 && logged2) {
- MessageBox.Show("Zalogowano Pomyślnie","Informacja",MessageBoxButtons.OK,MessageBoxIcon.Information);
- Form2 x = new Form2();
- x.Show();
- this.Hide();
- }
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Rack
- {
- public partial class Form2 : Form
- {
- private bool consoleopen = false;
- public int userID = -1;
- public Form2()
- {
- InitializeComponent();
- initializeGames();
- ustawConsole();
- }
- void initializeGames() {
- if (getIDfromForm1)
- {
- userID = Form1.loggedUserID;
- }
- if(userID == 1)
- {
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/User1/gra1.txt");
- if (a == "1")
- {
- panel1.Show();
- }
- else {
- panel1.Hide();
- }
- string b = wc.DownloadString("http://www.rack.c0.pl/User1/gra2.txt");
- if (b == "1")
- {
- panel2.Show();
- }
- else
- {
- panel2.Hide();
- }
- }
- if (userID == 2)
- {
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/User2/gra1.txt");
- if (a == "1")
- {
- panel1.Show();
- }
- else {
- panel1.Hide();
- }
- string b = wc.DownloadString("http://www.rack.c0.pl/User2/gra2.txt");
- if (b == "1")
- {
- panel2.Show();
- }
- else
- {
- panel2.Hide();
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Form1 y = new Form1();
- y.Show();
- this.Hide();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Process.Start("notepad.exe");
- }
- private void download(object sender, EventArgs e)
- {
- System.Net.WebClient wc = new System.Net.WebClient();
- string a = wc.DownloadString("http://www.rack.c0.pl/User2/gra1.txt");
- }
- private void downloadTest06(object sender, EventArgs e)
- {
- webBrowser1.Navigate("http://download850.mediafire.com/2j7dkhwr98dg/kgoxw293765ib3e/test-06.rar");
- }
- private void kill(object sender, FormClosedEventArgs e)
- {
- Process.GetCurrentProcess().Kill();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (consoleopen)
- {
- consoleopen = false;
- }
- else
- {
- consoleopen = true;
- }
- ustawConsole();
- }
- void ustawConsole()
- {
- if (consoleopen)
- {
- textBox1.Show();
- textBox2.Show();
- }
- else
- {
- textBox1.Hide();
- textBox2.Hide();
- }
- }
- public bool getIDfromForm1 = true;
- public int NowOnForm = 0;
- private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- string x = "";
- if(e.KeyChar == '\r')
- {
- x = textBox2.Text;
- textBox2.Text = "";
- switch (x)
- {
- case "mkd form2":
- textBox1.Text += "\r\n Pomyślnie Ustawiono MKD na 2";
- NowOnForm = 2;
- break;
- case "mkd form1":
- textBox1.Text += "\r\n Pomyślnie Ustawiono MKD na 1";
- NowOnForm = 1;
- break;
- case "s panel1":
- if(NowOnForm == 2) {
- textBox1.Text += "\r\n Pomyślnie pokazano panel1";
- panel1.Show();
- }
- break;
- case "s panel2":
- if (NowOnForm == 2)
- {
- textBox1.Text += "\r\n Pomyślnie pokazano panel2";
- panel2.Show();
- }
- break;
- case "h panel1":
- if (NowOnForm == 2)
- {
- textBox1.Text += "\r\n Pomyślnie schowano panel1";
- panel1.Hide();
- }
- break;
- case "h panel2":
- if (NowOnForm == 2)
- {
- textBox1.Text += "\r\n Pomyślnie schowano panel2";
- panel2.Hide();
- }
- break;
- case "exit":
- Process.GetCurrentProcess().Kill();
- break;
- case "logout":
- Form1 y = new Form1();
- y.Show();
- this.Hide();
- break;
- case "u log 1":
- getIDfromForm1 = false;
- userID = 1;
- initializeGames();
- textBox1.Text += "\r\n Pomyślnie zmieniono użytkownika";
- break;
- case "u log 2":
- getIDfromForm1 = false;
- userID = 2;
- initializeGames();
- textBox1.Text += "\r\n Pomyślnie zmieniono użytkownika";
- break;
- case "u log 3":
- break;
- case "":
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement