Advertisement
Wouto1997

Minecraft Skin Donwloader (2.0) (form code)

Jun 25th, 2011
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Net;
  10. using System.IO;
  11.  
  12. namespace GetSkins
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             if (!Directory.Exists("skins"))
  19.             {
  20.                 Directory.CreateDirectory("skins");
  21.             }
  22.             InitializeComponent();
  23.             WebClient wc = new WebClient();
  24.             wc.DownloadFile("http://www.minecraft.net/skin/char.png", "char.png");
  25.             pictureBox1.ImageLocation = "char.png";
  26.             wc.Dispose();
  27.         }
  28.  
  29.         private void button1_Click(object sender, EventArgs e)
  30.         {
  31.             bool beta = true;
  32.             WebClient wc = new WebClient();
  33.             string haspaid = wc.DownloadString("http://www.minecraft.net/haspaid.jsp?user=" + textBox1.Text);
  34.             if (haspaid.Contains("true"))
  35.             {
  36.                 try
  37.                 {
  38.                     wc.DownloadFile("http://s3.amazonaws.com/MinecraftSkins/" + textBox1.Text + ".png", "skins/" + textBox1.Text + ".png");
  39.                 }
  40.                 catch
  41.                 {
  42.                     beta = false;
  43.                     pictureBox1.ImageLocation = "char.png";
  44.                     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);
  45.                 }
  46.                 try
  47.                 {
  48.                     pictureBox1.ImageLocation = "skins/" + textBox1.Text + ".png";
  49.                 }
  50.                 catch
  51.                 {
  52.                     beta = false;
  53.                     pictureBox1.ImageLocation = "char.png";
  54.                     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);
  55.                 }
  56.             }
  57.             else
  58.             {
  59.                 MessageBox.Show("User hasn't bought minecraft", "not bought...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  60.             }
  61.             if (beta)
  62.             {
  63.                 File.Delete("char.png");
  64.             }
  65.             label2.Text = textBox1.Text;
  66.             label2.Visible = true;
  67.             textBox1.Text = "";
  68.         }
  69.  
  70.         private void textBox1_Click(object sender, EventArgs e)
  71.         {
  72.             textBox1.Text = "";
  73.             if (File.Exists("char.png"))
  74.                 File.Delete("char.png");
  75.         }
  76.  
  77.         private void button4_Click(object sender, EventArgs e)
  78.         {
  79.             Application.Exit();
  80.             if (File.Exists("char.png"))
  81.                 File.Delete("char.png");
  82.         }
  83.  
  84.         private void button3_Click(object sender, EventArgs e)
  85.         {
  86.             string path = "skins";
  87.             System.Diagnostics.Process.Start(path);
  88.  
  89.             if (File.Exists("char.png"))
  90.                 File.Delete("char.png");
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement