本文整理汇总了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;
}