CSharpTradeOffers.IdConversions.AccountIdToSteamIdText C# (CSharp) Метод

AccountIdToSteamIdText() публичный статический Метод

public static AccountIdToSteamIdText ( uint accountId ) : string
accountId uint
Результат string
        public static string AccountIdToSteamIdText(uint accountId)
        {
            ulong steamIdUlong = Convert.ToUInt64(accountId) + 76561197960265728;

            Universe universe = (Universe)Convert.ToInt32(steamIdUlong >> 56);
            if (universe == Universe.Public) universe = Universe.Invalid; //legacy, actually is valid.

            ulong accountIdHighBits = (steamIdUlong >> 1) & 0x7FFFFFF;
            ulong accountIdLowBit = steamIdUlong & 1;

            return string.Format(BaseTextId, (int)universe, accountIdLowBit, accountIdHighBits);
        }

Usage Example

Пример #1
0
 /// <summary>
 /// Initializes a new SteamId as well as automatically performing the conversions to 'AccountId' 'SteamIdUlong' 'SteamIdText'
 /// </summary>
 /// <param name="accountId"></param>
 public SteamId(uint accountId)
 {
     AccountId    = accountId;
     SteamIdUlong = IdConversions.AccountIdToUlong(accountId);
     if (SteamIdUlong < 76561197960265728)
     {
         throw new ArgumentException("SteamIdUlong cannot be less than '76561197960265728'");
     }
     SteamIdText = IdConversions.AccountIdToSteamIdText(accountId);
 }