You are viewing our Forum Archives. To view or take place in current topics click here.
Gamercard(Source/Executable)
Posted:

Gamercard(Source/Executable)Posted:

Cez
  • Prospect
Status: Offline
Joined: Apr 11, 200915Year Member
Posts: 614
Reputation Power: 36
Status: Offline
Joined: Apr 11, 200915Year Member
Posts: 614
Reputation Power: 36
Hey, here is a program I created using C#. It simply gets yours/someone elses gamercard using their XboxMB username, or their gamertag(your choice). There are also 4 different types of gamercard styles. The gamercard's are taken from [ Register or Signin to view external links. ] .

[ Register or Signin to view external links. ]

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]

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.Xml;

namespace Gamercard
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            string gt = GetGamertag("");
            if (gt != "")
                pictureBox1.ImageLocation = "http://www.xboxgamertag.com/gamercard/" + gt + "/newnxe/card.png";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox1.Text == "XboxMB Username")
                {
                    string gt = GetGamertag(textBox1.Text);
                    if (gt != "")
                        pictureBox1.ImageLocation = "http://www.xboxgamertag.com/gamercard/" + gt + "/" + comboBox2.Text.ToLower().Replace(" ", "") + "/card.png";
                }
                else
                    pictureBox1.ImageLocation = "http://www.xboxgamertag.com/gamercard/" + textBox1.Text + "/" + comboBox2.Text.ToLower().Replace(" ", "") + "/card.png";
            }
            catch
            {
                pictureBox1.Image = null;
                MessageBox.Show("An error has occured...Are you connected to the internet?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

        public static string GetGamertag(string UserName)
        {
            XmlDocument xDoc = new XmlDocument();
            if (UserName != "")
                xDoc.Load(String.Format("http://api.xboxmb.com/?u={0}&xml=1", UserName));
            else
                xDoc.Load("http://api.xboxmb.com/?xml=1");
            for (int i = 0; i < xDoc.ChildNodes[1].ChildNodes.Count; i++)
            {
                System.Xml.XmlNode Current = xDoc.ChildNodes[1].ChildNodes[i];
                if(Current.Name == "Gamertag")
                    return Current.InnerText;
            }
            return "";
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "PNG|*.png|All Files|*.*";
            if (pictureBox1.Image != pictureBox1.ErrorImage && pictureBox1.Image != pictureBox1.InitialImage && pictureBox1.Image != null)
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        pictureBox1.Image.Save(sfd.FileName);
                        MessageBox.Show("Image saved successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    catch
                    {
                        MessageBox.Show("An unknown error has occured! Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
        }
    }
}
#2. Posted:
TTG_MOJO_M3DIA
  • Junior Member
Status: Offline
Joined: Feb 22, 201113Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Feb 22, 201113Year Member
Posts: 95
Reputation Power: 3
thats pretty cool there was one before being funded by microsoft but the stop funding it so the creaters stoped improving it.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.