本文整理汇总了C#中TypedObject.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# TypedObject.GetString方法的具体用法?C# TypedObject.GetString怎么用?C# TypedObject.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypedObject
的用法示例。
在下文中一共展示了TypedObject.GetString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login
private bool Login()
{
TypedObject result, body;
// Login 1
body = new TypedObject("com.riotgames.platform.login.AuthenticationCredentials");
body.Add("password", password);
body.Add("clientVersion", clientVersion);
body.Add("ipAddress", ipAddress);
body.Add("securityAnswer", null);
body.Add("locale", locale);
body.Add("domain", "lolclient.lol.riotgames.com");
body.Add("oldPassword", null);
body.Add("authToken", authToken);
if (useGarena)
{
body.Add("partnerCredentials", "8393 " + garenaToken);
body.Add("username", userID);
}
else
{
body.Add("partnerCredentials", null);
body.Add("username", user);
}
int id = Invoke("loginService", "login", new object[] { body });
result = GetResult(id);
if (result["result"].Equals("_error"))
{
Error(GetErrorMessage(result), ErrorType.Login);
Disconnect();
return false;
}
body = result.GetTO("data").GetTO("body");
sessionToken = body.GetString("token");
accountID = (int)body.GetTO("accountSummary").GetInt("accountId");
// Login 2
if (useGarena)
body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
else
body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user.ToLower() + ":" + sessionToken)),
"auth", 8);
body.type = "flex.messaging.messages.CommandMessage";
id = Invoke(body);
result = GetResult(id); // Read result (and discard)
isLoggedIn = true;
if (OnLogin != null)
OnLogin(this, user, ipAddress);
return true;
}
示例2: Login
/// <summary>
/// Begins login process to server.
/// </summary>
/// <returns>Returns true if successful, false if not.</returns>
private bool Login()
{
TypedObject result, body;
// Login 1
body = new TypedObject("com.riotgames.platform.login.AuthenticationCredentials");
body.Add("password", password);
body.Add("clientVersion", clientVersion);
body.Add("ipAddress", ipAddress);
body.Add("securityAnswer", null);
body.Add("locale", locale);
body.Add("domain", "lolclient.lol.riotgames.com");
body.Add("oldPassword", null);
body.Add("authToken", authToken);
if (useGarena)
{
body.Add("partnerCredentials", "8393 " + garenaToken);
body.Add("username", userID);
}
else
{
body.Add("partnerCredentials", null);
body.Add("username", user);
}
int id = Invoke("loginService", "login", new object[] { body });
result = GetResult(id);
if (result["result"].Equals("_error"))
{
Error(GetErrorMessage(result), ErrorType.Login);
Disconnect();
return false;
}
body = result.GetTO("data").GetTO("body");
sessionToken = body.GetString("token");
accountID = (int)body.GetTO("accountSummary").GetInt("accountId");
// Login 2
if (useGarena)
body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(userID + ":" + sessionToken)), "auth", 8);
else
body = WrapBody(Convert.ToBase64String(Encoding.UTF8.GetBytes(user + ":" + sessionToken)), "auth", 8);
body.type = "flex.messaging.messages.CommandMessage";
id = Invoke(body);
result = GetResult(id); // Read result (and discard)
// Subscribe to the necessary items
// bc
body = WrapBody(new object[] { new TypedObject() }, "messagingDestination", 0);
body.type = "flex.messaging.messages.CommandMessage";
TypedObject headers = body.GetTO("headers");
headers.Add("DSSubtopic", "bc");
headers.Remove("DSRequestTimeout");
body["clientID"] = "bc-" + accountID;
id = Invoke(body);
result = GetResult(id); // Read result and discard
// cn
body = WrapBody(new object[] { new TypedObject() }, "messagingDestination", 0);
body.type = "flex.messaging.messages.CommandMessage";
headers = body.GetTO("headers");
headers.Add("DSSubtopic", "cn-" + accountID);
headers.Remove("DSRequestTimeout");
body["clientID"] = "cn-" + accountID;
id = Invoke(body);
result = GetResult(id); // Read result and discard
// gn
body = WrapBody(new object[] { new TypedObject() }, "messagingDestination", 0);
body.type = "flex.messaging.messages.CommandMessage";
headers = body.GetTO("headers");
headers.Add("DSSubtopic", "gn-" + accountID);
headers.Remove("DSRequestTimeout");
body["clientID"] = "gn-" + accountID;
id = Invoke(body);
result = GetResult(id); // Read result and discard
if (OnLogin != null)
OnLogin(this, user, ipAddress);
return true;
}