Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using System.Net;
- using System.Diagnostics;
- using Microsoft.Win32;
- using Microsoft.VisualBasic;
- namespace _launcher
- {
- public partial class Form1 : Form
- {
- string _mainPage = "http://pawno.ru/";
- string _imgURL = "http://add0n.hol.es/_launcher/logo.png";
- string _newsURL = "http://add0n.hol.es/_launcher/_testNews.txt";
- string _ip = "127.0.0.1:7777";
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {//loading
- pictureBox1.Load(_imgURL);
- richTextBox1.Clear();
- siteNews();
- }
- private void button1_Click(object sender, EventArgs e)
- {//connect
- if (textBox1.Text.Length < 3 || textBox1.Text.Length > 22) return;
- using (var key = Registry.ClassesRoot.OpenSubKey(@"samp\shell\open\command\"))
- {
- string value = (string)key.GetValue(null);
- value = value.Remove(0, 1);
- value = value.Remove(value.Length - 14);
- key.Close();
- Registry.CurrentUser.OpenSubKey(@"Software\SAMP", true).SetValue("PlayerName", textBox1.Text);
- Process.Start(value+"samp", _ip);
- }
- }
- private void pictureBox1_DoubleClick(object sender, EventArgs e) { Process.Start(_mainPage); }
- private void button2_Click(object sender, EventArgs e) { Process.Start(_mainPage); }
- public void siteNews()
- {
- WebRequest request = WebRequest.Create(_newsURL);
- request.Credentials = CredentialCache.DefaultCredentials;
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- Console.WriteLine(response.StatusDescription);
- Stream dataStream = response.GetResponseStream();
- StreamReader reader = new StreamReader(dataStream);
- string responseFromServer = reader.ReadToEnd();
- reader.Close();
- dataStream.Close();
- response.Close();
- richTextBox1.Text = "Новости проекта:\n" + responseFromServer;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement