Depressurizer.DlgProfile.GetDisplayName C# (CSharp) Method

GetDisplayName() public method

public GetDisplayName ( System.Int64 accountId ) : string
accountId System.Int64
return string
        public string GetDisplayName( Int64 accountId )
        {
            try {
                XmlDocument doc = new XmlDocument();
                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create( string.Format( "http://www.steamcommunity.com/profiles/{0}?xml=true", accountId ) );
                using( WebResponse resp = req.GetResponse() ) {
                    doc.Load( resp.GetResponseStream() );
                }
                XmlNode nameNode = doc.SelectSingleNode( "profile/steamID" );
                if( nameNode != null ) {
                    return nameNode.InnerText;
                }
            } catch( Exception e ) {
                Program.Logger.Write( Rallion.LoggerLevel.Warning, GlobalStrings.DlgProfile_ExceptionRaisedWhenTryingScrapeProfileName, accountId );
                Program.Logger.Write( Rallion.LoggerLevel.Warning, e.Message );
            }
            return null;
        }