All pastes #777475 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-16 20:50 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;

using Injections = Project2Q.SDK.Injections;

using Project2Q.SDK;
using Project2Q.SDK.UserSystem;
using Project2Q.SDK.ChannelSystem;
using Project2Q.SDK.ModuleSupport;
namespace SteamID {

    public class Main : IModuleCreator {

        public override void Initialize() {
            mp.RegisterParse( Configuration.ModuleConfig.ModulePrefix + "steamid", new CrossAppDomainDelegate( SteamID ),
               IRCEvents.ParseTypes.ChannelMessage );
        }

        public IRCEvents.ParseReturns parseReturns;

        public void BoldReply( string boldtxt, string txt ) {
            returns = new string[] {
                "PRIVMSG " + parseReturns.Channel.Name + " :" + (char)2 + boldtxt + (char)2 + txt,
            };
        }

        public void BoldSteamID( LinkedList<string> ll ) {
            returns = new string[ll.Count];
            ll.CopyTo( returns, 0 );
        }

        public void Parse( string steamid ) {
            LinkedList<string> ll = new LinkedList<string>();
            XmlDocument doc = new XmlDocument();
            doc.Load( "http://steamid.esportsea.com/index.php?action=search&type=single&key=steam_id&query=" + steamid + "&output=xml" );
            XmlNodeList steamidxml = doc.GetElementsByTagName( "result" );

            foreach ( XmlNode node in steamidxml ) {
                XmlElement sid = (XmlElement)node;
                string first = sid.GetElementsByTagName( "player_name_first" )[0].InnerText;
                string last = sid.GetElementsByTagName( "player_name_last" )[0].InnerText;
                string game = sid.GetElementsByTagName( "team_game" )[0].InnerText;
                string league = sid.GetElementsByTagName( "team_league" )[0].InnerText;
                string div = sid.GetElementsByTagName( "team_division" )[0].InnerText;
                string location = sid.GetElementsByTagName( "team_location" )[0].InnerText;
                string team = sid.GetElementsByTagName( "team_name" )[0].InnerText;
                string alias = sid.GetElementsByTagName( "player_alias" )[0].InnerText;
                string wins = sid.GetElementsByTagName( "wins" )[0].InnerText;
                string loss = sid.GetElementsByTagName( "losses" )[0].InnerText;
                string ties = sid.GetElementsByTagName( "ties" )[0].InnerText;

                ll.AddLast( "PRIVMSG " +
                    parseReturns.Channel.Name +
                    " :" +
                    (char)2 +
                    steamid +
                    (char)2 +
                    ": " +
                    first + " \"" +
                    alias + "\" " +
                    last + ", " +
                    team + " (" +
                    wins + "-" +
                    loss + "-" +
                    ties + ") " +
                    league.ToUpper() +
                    div
                );
            }
            BoldSteamID( ll );
        }

        public void SteamID() {
                string text = parseReturns.Text;
                string[] splits = text.Split( ' ' );
                if ( splits.Length != 2 ) {
                    BoldReply( splits[1] + ": ", "Invalid Input!" );
                    return;
                }
                if ( splits[1].StartsWith( "0:0:" ) || splits[1].StartsWith( "0:1:" ) ) {
                    Parse( splits[1].ToString() );
                }
                else if ( splits[1].ToLower().StartsWith( "steam_0:0:" ) || splits[1].ToLower().StartsWith( "steam_0:1:" ) ) {
                    Parse( splits[1].Remove( 0, 6 ).ToString() );
                }
                else {
                    BoldReply( splits[1] + ": ", "is not a valid steamid!" );
                }
        }

    }
}