Advertisement
Wouto1997

Minecraft Skin Donwloader (form code)

Jun 25th, 2011
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.27 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 Form1_Load(object sender, EventArgs e)
  30.         {
  31.  
  32.         }
  33.  
  34.         private void pictureBox1_Click(object sender, EventArgs e)
  35.         {
  36.  
  37.         }
  38.  
  39.         private void button1_Click(object sender, EventArgs e)
  40.         {
  41.             bool beta = true;
  42.             WebClient wc = new WebClient();
  43.             string haspaid = wc.DownloadString("http://www.minecraft.net/haspaid.jsp?user=" + textBox1.Text);
  44.             if (haspaid.Contains("true"))
  45.             {
  46.                 try
  47.                 {
  48.                     wc.DownloadFile("http://s3.amazonaws.com/MinecraftSkins/" + textBox1.Text + ".png", "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.                 try
  57.                 {
  58.                     pictureBox1.ImageLocation = "skins/" + textBox1.Text + ".png";
  59.                 }
  60.                 catch
  61.                 {
  62.                     beta = false;
  63.                     pictureBox1.ImageLocation = "char.png";
  64.                     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);
  65.                 }
  66.             }
  67.             else
  68.             {
  69.                 MessageBox.Show("User hasn't bought minecraft", "not bought...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  70.             }
  71.             if (beta)
  72.             {
  73.                 File.Delete("char.png");
  74.             }
  75.             label2.Text = textBox1.Text;
  76.             label2.Visible = true;
  77.             textBox1.Text = "";
  78.         }
  79.  
  80.         private void textBox1_Click(object sender, EventArgs e)
  81.         {
  82.             textBox1.Text = "";
  83.             if (File.Exists("char.png"))
  84.                 File.Delete("char.png");
  85.         }
  86.  
  87.         private void button4_Click(object sender, EventArgs e)
  88.         {
  89.             Application.Exit();
  90.             if (File.Exists("char.png"))
  91.                 File.Delete("char.png");
  92.         }
  93.  
  94.         private void button3_Click(object sender, EventArgs e)
  95.         {
  96.             string path = "skins";
  97.             System.Diagnostics.Process.Start(path);
  98.  
  99.             if (File.Exists("char.png"))
  100.                 File.Delete("char.png");
  101.         }
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement