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


C# TypedObject.GetTO方法代码示例

本文整理汇总了C#中TypedObject.GetTO方法的典型用法代码示例。如果您正苦于以下问题:C# TypedObject.GetTO方法的具体用法?C# TypedObject.GetTO怎么用?C# TypedObject.GetTO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypedObject的用法示例。


在下文中一共展示了TypedObject.GetTO方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteObject

        private void WriteObject(List<byte> ret, TypedObject val)
        {
            if (val.type == null || val.type.Equals(""))
            {
                ret.Add((byte)0x0B); // Dynamic class

                ret.Add((byte)0x01); // No class name
                foreach (string key in val.Keys)
                {
                    WriteString(ret, key);
                    Encode(ret, val[key]);
                }
                ret.Add((byte)0x01); // End of dynamic
            }
            else if (val.type.Equals("flex.messaging.io.ArrayCollection"))
            {
                ret.Add((byte)0x07); // Externalizable
                WriteString(ret, val.type);

                Encode(ret, val["array"]);
            }
            else if (val.type.Equals("DSK"))
            {
                WriteInt(ret, (val.Count << 4) | 3); // Inline + member count
                WriteString(ret, val.type);
                byte[] flag1 = new byte[8];
                byte[] flag2 = new byte[8];
                if (val["body"] != null)
                    flag1[0] = 1;
                if (val["clientId"] != null)
                    flag1[1] = 1;
                if (val["destination"] != null)
                    flag1[2] = 1;
                if (val["headers"] != null)
                    flag1[3] = 1;
                if (val["messageId"] != null && val["clientId"] != null)
                    flag1[4] = 1;
                if (val["timestamp"] != null && val["destination"] != null)
                    flag1[5] = 1;
                if (val["timeToLive"] != null && val["headers"] != null)
                    flag1[6] = 1;

                if (val["clientIdBytes"] != null)
                    flag2[0] = 1;
                if (val["messageIdBytes"] != null)
                    flag2[1] = 1;

                WriteObject(ret, val.GetTO("data"));
            }
            else
            {
                WriteInt(ret, (val.Count << 4) | 3); // Inline + member count
                WriteString(ret, val.type);

                List<String> keyOrder = new List<String>();
                foreach (string key in val.Keys)
                {
                    WriteString(ret, key);
                    keyOrder.Add(key);
                }

                foreach (string key in keyOrder)
                    Encode(ret, val[key]);
            }
        }
开发者ID:phanminh22,项目名称:ChallengerBot_WebControl,代码行数:65,代码来源:RTMPSEncoder.cs

示例2: GetErrorCode

 private string GetErrorCode(TypedObject message)
 {
     return message.GetTO("data").GetTO("rootCause").GetString("errorCode");
 }
开发者ID:ResQue1980,项目名称:LegendaryClient,代码行数:4,代码来源:PVPNetConnection.cs

示例3: 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

示例4: GetErrorMessage

 private string GetErrorMessage(TypedObject message)
 {
     // Works for clientVersion
     return message.GetTO("data").GetTO("rootCause").GetString("message");
 }
开发者ID:ResQue1980,项目名称:LegendaryClient,代码行数:5,代码来源:PVPNetConnection.cs

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