本文整理匯總了C#中SteamKit2.SteamID.SetFromString方法的典型用法代碼示例。如果您正苦於以下問題:C# SteamID.SetFromString方法的具體用法?C# SteamID.SetFromString怎麽用?C# SteamID.SetFromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SteamKit2.SteamID
的用法示例。
在下文中一共展示了SteamID.SetFromString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetFromStringHandlesInvalid
public void SetFromStringHandlesInvalid()
{
SteamID sid = new SteamID();
bool setFromNullString = sid.SetFromString( null, EUniverse.Public );
Assert.False( setFromNullString );
bool setFromEmptyString = sid.SetFromString( "", EUniverse.Public );
Assert.False( setFromEmptyString );
bool setFromInvalidString = sid.SetFromString( "NOT A STEAMID!", EUniverse.Public );
Assert.False( setFromInvalidString );
bool setFromInvalidAccountId = sid.SetFromString( "STEAM_0:1:999999999999999999999999999999", EUniverse.Public );
Assert.False( setFromInvalidAccountId );
}
示例2: btnOK_Click
private void btnOK_Click( object sender, EventArgs e )
{
SteamID steamId = new SteamID();
steamId.SetFromString( txtFriend.Text, Steam3.SteamClient.ConnectedUniverse );
if ( steamId.IsValid )
{
Steam3.SteamFriends.AddFriend( steamId );
}
else
{
Steam3.SteamFriends.AddFriend( txtFriend.Text );
}
this.Close();
}
示例3: TrySetSteamID
private static bool TrySetSteamID(string input, out SteamID steamID)
{
steamID = new SteamID();
if (steamID.SetFromString(input, EUniverse.Public)
|| steamID.SetFromSteam3String(input))
{
return true;
}
ulong numericInput;
if (ulong.TryParse(input, out numericInput))
{
steamID.SetFromUInt64(numericInput);
return true;
}
return false;
}