当前位置: 首页>>代码示例>>C#>>正文


C# TypedObject.GetString方法代码示例

本文整理汇总了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;
        }
开发者ID:ResQue1980,项目名称:LegendaryClient,代码行数:58,代码来源:PVPNetConnection.cs

示例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;
        }
开发者ID:honomoa,项目名称:PVPNetConnect,代码行数:91,代码来源:PVPNetConnection.cs


注:本文中的TypedObject.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。