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.Windows.Forms;
- using System.Net;
- using System.IO;
- namespace GetSkins
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- if (!Directory.Exists("skins"))
- {
- Directory.CreateDirectory("skins");
- }
- InitializeComponent();
- WebClient wc = new WebClient();
- wc.DownloadFile("http://www.minecraft.net/skin/char.png", "char.png");
- pictureBox1.ImageLocation = "char.png";
- wc.Dispose();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- bool beta = true;
- WebClient wc = new WebClient();
- string haspaid = wc.DownloadString("http://www.minecraft.net/haspaid.jsp?user=" + textBox1.Text);
- if (haspaid.Contains("true"))
- {
- try
- {
- wc.DownloadFile("http://s3.amazonaws.com/MinecraftSkins/" + textBox1.Text + ".png", "skins/" + textBox1.Text + ".png");
- }
- catch
- {
- beta = false;
- pictureBox1.ImageLocation = "char.png";
- MessageBox.Show("User has paid but no image was found... You have probably made a mistake with the upper and lowercase characters", "No image", MessageBoxButtons.OK);
- }
- try
- {
- pictureBox1.ImageLocation = "skins/" + textBox1.Text + ".png";
- }
- catch
- {
- beta = false;
- pictureBox1.ImageLocation = "char.png";
- MessageBox.Show("User has paid but no image was found... You have probably made a mistake with the upper and lowercase characters", "No image", MessageBoxButtons.OK);
- }
- }
- else
- {
- MessageBox.Show("User hasn't bought minecraft", "not bought...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- if (beta)
- {
- File.Delete("char.png");
- }
- label2.Text = textBox1.Text;
- label2.Visible = true;
- textBox1.Text = "";
- }
- private void textBox1_Click(object sender, EventArgs e)
- {
- textBox1.Text = "";
- if (File.Exists("char.png"))
- File.Delete("char.png");
- }
- private void button4_Click(object sender, EventArgs e)
- {
- Application.Exit();
- if (File.Exists("char.png"))
- File.Delete("char.png");
- }
- private void button3_Click(object sender, EventArgs e)
- {
- string path = "skins";
- System.Diagnostics.Process.Start(path);
- if (File.Exists("char.png"))
- File.Delete("char.png");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement