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


C# IAuthClient.Send方法代码示例

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


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

示例1: SendAuthChallengeErrorReply

		/// <summary>
		/// Sends an authentication challenge error to the client.
		/// </summary>
		/// <param name="client">the client</param>
		/// <param name="error">the authentication challenge error to send</param>
		public static void SendAuthChallengeErrorReply(IAuthClient client, AccountStatus error)
		{
			using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_CHALLENGE))
			{
				packet.Write((byte)0x00);
				packet.Write((byte)error);

				client.Send(packet);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:15,代码来源:AuthenticationHandler.cs

示例2: SendAuthChallengeSuccessReply

		/// <summary>
		/// Sends an authentication challenge success reply to the client.
		/// </summary>
		/// <param name="client">the client</param>
		public static void SendAuthChallengeSuccessReply(IAuthClient client)
		{
			using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_CHALLENGE))
			{
				packet.Write((byte)AccountStatus.Success);
				// Grunt command
				packet.Write((byte)0x00);

				client.Authenticator.WriteServerChallenge(packet);

                //var rand = new BigInteger(new Random(Environment.TickCount), 128);
                //packet.WriteBigInt(rand, 16);
                Random rand = new Random(Environment.TickCount);
                byte[] randbytes = new byte[16];              
                rand.NextBytes(randbytes);           
                packet.Write(randbytes);            
                
                const byte securityFlag = 0x0;
				packet.Write(securityFlag);

				// Require PIN input
                //if ((securityFlag & 0x1) == 0x1)
                //{
                //    packet.WriteInt(0);
                //    packet.Write(new byte[16]);
                //}

                // Matrix input
                //if ((securityFlag & 0x2) == 0x2)
                //{
                //    packet.Write((byte)0);
                //    packet.Write((byte)0);
                //    packet.Write((byte)0);
                //    packet.Write((byte)0);
                //    packet.Write(0UL);
                //}
				// Require Security Token input
                //if ((securityFlag & 0x4) == 0x4)
                //{
                //    packet.Write((byte)1);
                //}

				client.Send(packet);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:49,代码来源:AuthenticationHandler.cs

示例3: SendAuthProofSuccessReply

		/// <summary>
		/// Sends an authentication proof success reply to the client.
		/// </summary>
		/// <param name="client">the client</param>
		public static void SendAuthProofSuccessReply(IAuthClient client)
		{
			using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_PROOF))
			{
				packet.Write((byte)AccountStatus.Success);
				client.Authenticator.WriteServerProof(packet);

				packet.WriteInt(0);
				packet.WriteInt(0);
				packet.WriteShort(0);

				client.Send(packet);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:18,代码来源:AuthenticationHandler.cs

示例4: SendAuthReconnectProof

		public static void SendAuthReconnectProof(IAuthClient client)
		{
			using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_RECONNECT_PROOF))
			{
				packet.Write((byte)0);// error
				packet.Write((short)0);
                client.Send(packet);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:9,代码来源:AuthenticationHandler.cs

示例5: SendRealmList

        /// <summary>
        /// Sends the realm list to the client.
        /// </summary>
        /// <param name="client">the Session the incoming packet belongs to</param>
        public static void SendRealmList(IAuthClient client)
        {
			if (client.Account == null)
			{
				AuthenticationHandler.OnLoginError(client, AccountStatus.Failure);
				return;
			}
            using (var packet = new AuthPacketOut(AuthServerOpCode.REALM_LIST))
            {
            	packet.Position += 2;							// Packet length
                packet.Write(0);								// Unknown Value (0x0000)
            	//var cpos = packet.Position;
            	//packet.Position = cpos + 2;

            	packet.Write((short)AuthenticationServer.RealmCount);

            	//var count = 0;
                foreach (var realm in AuthenticationServer.Realms)
                {
                	// check for client version
                	//if (realm.ClientVersion.IsSupported(client.Info.Version))
                	realm.WriteRealm(client, packet);
                }

            	//packet.Write((byte)0x15);
                packet.Write((byte)0x10);
				packet.Write((byte)0x00);

				//packet.Position = cpos;
				//packet.WriteShort(count);

                packet.Position = 1;
                packet.Write((short)packet.TotalLength - 3);

                client.Send(packet);
            }
        }
开发者ID:remixod,项目名称:netServer,代码行数:41,代码来源:RealmEntry.cs


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