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


C# XmlData.WriteElement方法代码示例

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


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

示例1: HandleGameAccountListMyAccounts

        public static void HandleGameAccountListMyAccounts(StsPacket packet, StsSession session)
        {
            var userId = uint.Parse(packet["UserId"].ToString());

            if (userId == session.Account.Id)
            {
                var reply = new StsPacket(StsReason.OK, packet.Header.Sequence);
                var xmlData = new XmlData();

                // Only 1 GameAccount supported for now.
                xmlData.WriteElementRoot("Reply");
                xmlData.WriteCustom("<GameAccount>\n");
                xmlData.WriteElement("Alias", $"{session.Account.GameAccounts[0].Alias}");
                xmlData.WriteElement("Created", "");
                xmlData.WriteCustom("</GameAccount>\n");

                reply.WriteXmlData(xmlData);

                session.Send(reply);
            }
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:21,代码来源:GameAccountHandler.cs

示例2: HandleAuthKeyData

        public static void HandleAuthKeyData(StsPacket packet, StsSession session)
        {
            var keyData = new BinaryReader(new MemoryStream(Convert.FromBase64String(packet["KeyData"].ToString())));
            var a = keyData.ReadBytes(keyData.ReadInt32());
            var m = keyData.ReadBytes(keyData.ReadInt32());

            session.SecureRemotePassword.CalculateU(a);
            session.SecureRemotePassword.CalculateClientM(a);

            if (session.SecureRemotePassword.ClientM.Compare(m))
            {
                session.SecureRemotePassword.CalculateServerM(m, a);

                session.ClientCrypt = new SARC4();
                session.ClientCrypt.PrepareKey(session.SecureRemotePassword.SessionKey);

                session.State = 1;

                var SKeyData = new BinaryWriter(new MemoryStream());

                SKeyData.Write(session.SecureRemotePassword.ServerM.Length);
                SKeyData.Write(session.SecureRemotePassword.ServerM);

                var reply = new StsPacket(StsReason.OK, packet.Header.Sequence);
                var xmlData = new XmlData();

                xmlData.WriteElementRoot("Reply");
                xmlData.WriteElement("KeyData", Convert.ToBase64String(SKeyData.ToArray()));

                reply.WriteXmlData(xmlData);

                session.Send(reply);
            }
            else
            {
                session.Account = null;

                var reply = new StsPacket(StsReason.ErrBadPasswd, packet.Header.Sequence);

                reply.WriteString("<Error code=\"11\" server=\"0\" module=\"0\" line=\"0\"/>\n");

                session.Send(reply);
            }
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:44,代码来源:StsHandler.cs

示例3: HandleAuthLoginFinish

        public static void HandleAuthLoginFinish(StsPacket packet, StsSession session)
        {
            // Server packets are encrypted now.
            session.ServerCrypt = new SARC4();
            session.ServerCrypt.PrepareKey(session.SecureRemotePassword.SessionKey);

            var reply = new StsPacket(StsReason.OK, packet.Header.Sequence);
            var xmlData = new XmlData();

            xmlData.WriteElementRoot("Reply");

            xmlData.WriteElement("LocationId", "");
            xmlData.WriteElement("UserId", session.Account.Id.ToString());
            xmlData.WriteElement("UserCenter", "");
            xmlData.WriteElement("UserName", session.Account.LoginName);
            xmlData.WriteElement("AccessMask", "");
            xmlData.WriteElement("Roles", "");
            xmlData.WriteElement("Status", "");

            reply.WriteXmlData(xmlData);

            session.Send(reply);
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:23,代码来源:StsHandler.cs

示例4: HandleAuthLoginStart

        public static void HandleAuthLoginStart(StsPacket packet, StsSession session)
        {
            // Can be an email or user name.
            var loginName = packet["LoginName"].ToString();

            session.Account = DB.Auth.Single<Account>(a => a.Email == loginName);

            // Support for email only.
            if (loginName != null && session.Account != null)
            {
                session.SecureRemotePassword = new SRP6a(session.Account.Salt, loginName, session.Account.PasswordVerifier);
                session.SecureRemotePassword.CalculateB();

                var keyData = new BinaryWriter(new MemoryStream());

                keyData.Write(session.SecureRemotePassword.S.Length);
                keyData.Write(session.SecureRemotePassword.S);
                keyData.Write(session.SecureRemotePassword.B.Length);
                keyData.Write(session.SecureRemotePassword.B);

                var reply = new StsPacket(StsReason.OK, packet.Header.Sequence);
                var xmlData = new XmlData();

                xmlData.WriteElementRoot("Reply");
                xmlData.WriteElement("KeyData", Convert.ToBase64String(keyData.ToArray()));

                reply.WriteXmlData(xmlData);

                session.Send(reply);
            }
            else
            {
                // Let's use ErrBadPasswd instead of ErrAccountNotFound.
                var reply = new StsPacket(StsReason.ErrBadPasswd, packet.Header.Sequence);

                reply.WriteString("<Error code=\"11\" server=\"0\" module=\"0\" line=\"0\"/>\n");

                session.Send(reply);
            }
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:40,代码来源:StsHandler.cs

示例5: HandleAuthRequestGameToken

        public static void HandleAuthRequestGameToken(StsPacket packet, StsSession session)
        {
            if (DB.Auth.Update<Account>(a => a.Id == session.Account.Id, a => a.Online.Set(true)))
            {
                var reply = new StsPacket(StsReason.OK, packet.Header.Sequence);
                var xmlData = new XmlData();

                xmlData.WriteElementRoot("Reply");

                xmlData.WriteElement("Token", "");

                reply.WriteXmlData(xmlData);

                session.Send(reply);
            }
            else
                session.Dispose();
        }
开发者ID:Captain-Ice,项目名称:Project-WildStar,代码行数:18,代码来源:StsHandler.cs


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