本文整理汇总了C#中SteamKit2.SteamID.SetFromSteam3String方法的典型用法代码示例。如果您正苦于以下问题:C# SteamID.SetFromSteam3String方法的具体用法?C# SteamID.SetFromSteam3String怎么用?C# SteamID.SetFromSteam3String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SteamKit2.SteamID
的用法示例。
在下文中一共展示了SteamID.SetFromSteam3String方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFromSteam3StringCorrectParse
public void SetFromSteam3StringCorrectParse()
{
SteamID sidUser = new SteamID();
sidUser.SetFromSteam3String( "[U:1:123]" );
Assert.Equal( 123u, sidUser.AccountID );
Assert.Equal( EUniverse.Public, sidUser.AccountUniverse );
Assert.Equal( 1u, sidUser.AccountInstance );
Assert.Equal( EAccountType.Individual, sidUser.AccountType );
SteamID sidAnonGSUser = new SteamID();
sidAnonGSUser.SetFromSteam3String( "[A:1:123:456]" );
Assert.Equal (123u, sidAnonGSUser.AccountID );
Assert.Equal( EUniverse.Public, sidAnonGSUser.AccountUniverse );
Assert.Equal( 456u, sidAnonGSUser.AccountInstance );
Assert.Equal( EAccountType.AnonGameServer, sidAnonGSUser.AccountType );
SteamID sidLobby = new SteamID();
sidLobby.SetFromSteam3String( "[L:1:123]" );
Assert.Equal( 123u, sidLobby.AccountID );
Assert.Equal( EUniverse.Public, sidLobby.AccountUniverse );
Assert.True( ( ( SteamID.ChatInstanceFlags )sidLobby.AccountInstance ).HasFlag( SteamID.ChatInstanceFlags.Lobby ) );
Assert.Equal( EAccountType.Chat, sidLobby.AccountType );
SteamID sidClanChat = new SteamID();
sidClanChat.SetFromSteam3String( "[c:1:123]" );
Assert.Equal( 123u, sidClanChat.AccountID );
Assert.Equal(EUniverse.Public, sidClanChat.AccountUniverse);
Assert.True( ( ( SteamID.ChatInstanceFlags )sidClanChat.AccountInstance ).HasFlag( SteamID.ChatInstanceFlags.Clan ) );
Assert.Equal( EAccountType.Chat, sidClanChat.AccountType );
}
示例2: 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;
}
示例3: InitializesInstancesCorrectly
public void InitializesInstancesCorrectly()
{
SteamID sid = new SteamID();
sid.SetFromSteam3String( "[g:1:1234]" );
Assert.Equal( EUniverse.Public, sid.AccountUniverse );
Assert.Equal( EAccountType.Clan, sid.AccountType );
Assert.Equal( 0u, sid.AccountInstance );
Assert.Equal( 1234u, sid.AccountID );
sid.SetFromSteam3String( "[T:1:1234]" );
Assert.Equal( EUniverse.Public, sid.AccountUniverse );
Assert.Equal( EAccountType.Chat, sid.AccountType );
Assert.Equal( 0u, sid.AccountInstance );
Assert.Equal( 1234u, sid.AccountID );
sid.SetFromSteam3String( "[c:1:1234]" );
Assert.Equal( EUniverse.Public, sid.AccountUniverse );
Assert.Equal( EAccountType.Chat, sid.AccountType );
Assert.Equal( (uint)SteamID.ChatInstanceFlags.Clan, sid.AccountInstance );
Assert.Equal( 1234u, sid.AccountID);
sid.SetFromSteam3String( "[L:1:1234]" );
Assert.Equal( EUniverse.Public, sid.AccountUniverse );
Assert.Equal( EAccountType.Chat, sid.AccountType );
Assert.Equal( ( uint ) SteamID.ChatInstanceFlags.Lobby, sid.AccountInstance );
Assert.Equal( 1234u, sid.AccountID );
}
示例4: SetFromSteam3StringHandlesInvalid
public void SetFromSteam3StringHandlesInvalid()
{
SteamID sid = new SteamID();
bool setFromNullString = sid.SetFromSteam3String( null );
Assert.False( setFromNullString );
bool setFromEmptyString = sid.SetFromSteam3String("");
Assert.False( setFromEmptyString );
bool setFromInvalidString = sid.SetFromSteam3String( "NOT A STEAMID!" );
Assert.False( setFromInvalidString );
bool setFromInvalidAccountId = sid.SetFromSteam3String( "STEAM_0:1:999999999999999999999999999999" );
Assert.False( setFromInvalidAccountId );
bool setFromSteam2String = sid.SetFromSteam3String( "STEAM_0:1:4491990" );
Assert.False(setFromSteam2String);
bool mixingBracketsAndColons1 = sid.SetFromSteam3String( "[A:1:2:345)]" );
Assert.False( mixingBracketsAndColons1 );
bool mixingBracketsAndColons2 = sid.SetFromSteam3String( "[A:1:2(345]" );
Assert.False( mixingBracketsAndColons2 );
bool universeOutOfRange = sid.SetFromSteam3String( "[U:5:123]" );
Assert.False( universeOutOfRange );
}
示例5: 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 );
bool universeOutOfRange = sid.SetFromSteam3String( "STEAM_5:0:123" );
Assert.False( universeOutOfRange );
}
示例6: Steam3StringSymmetric
public void Steam3StringSymmetric()
{
var steamIds = new[]
{
"[U:1:123]",
"[U:1:123:2]",
"[G:1:626]",
"[A:2:165:1234]",
};
foreach ( var steamId in steamIds )
{
SteamID sid = new SteamID();
bool parsed = sid.SetFromSteam3String( steamId );
Assert.True( parsed );
Assert.Equal( steamId, sid.Render( steam3: true ) );
}
}
示例7: SetFromOldStyleSteam3StringCorrectParse
public void SetFromOldStyleSteam3StringCorrectParse()
{
SteamID sidMultiseat = new SteamID();
sidMultiseat.SetFromSteam3String( "[M:1:123(456)]" );
Assert.Equal( 123u, sidMultiseat.AccountID);
Assert.Equal( EUniverse.Public, sidMultiseat.AccountUniverse );
Assert.Equal( 456u, sidMultiseat.AccountInstance );
Assert.Equal( EAccountType.Multiseat, sidMultiseat.AccountType );
SteamID sidAnonGSUser = new SteamID();
sidAnonGSUser.SetFromSteam3String( "[A:1:123(456)]" );
Assert.Equal( 123u, sidAnonGSUser.AccountID );
Assert.Equal( EUniverse.Public, sidAnonGSUser.AccountUniverse );
Assert.Equal( 456u, sidAnonGSUser.AccountInstance );
Assert.Equal( EAccountType.AnonGameServer, sidAnonGSUser.AccountType );
}
示例8: LoadSteamUserName
private void LoadSteamUserName(string steamId3)
{
try
{
SteamKit2.SteamID steamId = new SteamID();
string id3 = "[U:1:" + steamId3 + "]";
Console.WriteLine(id3);
steamId.SetFromSteam3String(id3);
this.Invoke((MethodInvoker)delegate {
Debug("Attempting to load steam profile " + id3);
});
RestSharp.RestClient client = new RestSharp.RestClient(ConfigurationManager.AppSettings["apiUrl"]);
RestSharp.RestRequest request = new RestSharp.RestRequest("get_steam_profile/" + steamId.ConvertToUInt64());
RestSharp.IRestResponse<SteamProfile> response = client.Execute<SteamProfile>(request);
if (response.Data != null && response.Data.response != null && response.Data.response.players != null && response.Data.response.players.Count > 0)
{
this.Invoke((MethodInvoker)delegate {
Debug(id3 + " is " + response.Data.response.players[0].personaname);
foreach(SteamPlayer s in steamUsers)
{
if(s.id3 == steamId3)
{
s.personaname = response.Data.response.players[0].personaname;
steamUsers.ResetBindings();
}
}
});
}
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
//Debug("Unable to lookup steam profile " + steamId3 + ": " + ex.Message);
}
}
示例9: SetFromSteam3StringHandlesInvalid
public void SetFromSteam3StringHandlesInvalid()
{
SteamID sid = new SteamID();
bool setFromNullString = sid.SetFromSteam3String( null );
Assert.False( setFromNullString );
bool setFromEmptyString = sid.SetFromSteam3String("");
Assert.False( setFromEmptyString );
bool setFromInvalidString = sid.SetFromSteam3String( "NOT A STEAMID!" );
Assert.False( setFromInvalidString );
bool setFromInvalidAccountId = sid.SetFromSteam3String( "STEAM_0:1:999999999999999999999999999999" );
Assert.False( setFromInvalidAccountId );
bool setFromSteam2String = sid.SetFromSteam3String( "STEAM_0:1:4491990" );
Assert.False( setFromSteam2String );
}