コード例 #1
0
        /// <summary>
        /// Executes the command and sends response.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="i">The package info.</param>
        public override void ExecuteCommand(Session s, Package p)
        {
            PacketBRequestRetrieveOptions Request = new PacketBRequestRetrieveOptions(p.Content);

            if (s.Logger.IsDebugEnabled)
            {
                s.Logger.Debug($"Execute command: {Request}");
            }

            string Xml = File.ReadAllText($"{PathingHelper.tmpDir}BResponseRetrieveOptions.xml");

            PacketBResponseRetrieveOptions ResponseContent = new PacketBResponseRetrieveOptions(1, Xml);

            if (s.Logger.IsDebugEnabled)
            {
                s.Logger.Debug($"Command response: {ResponseContent}");
            }

            byte[] Response = ResponseContent.ToByteArray();

            Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, (byte)PacketTypes.BResponseRetrieveOptions, p.HeaderRequestId, Response);

            byte[] ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }
コード例 #2
0
        /// <summary>
        /// Executes the command and sends response.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">The package info.</param>
        public override void ExecuteCommand(Session s, Package p)
        {
            PacketBRequestRetrieveOptions Request = new PacketBRequestRetrieveOptions(p.Content);

            Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {Request}");

            Player ObjPlayer = s.Player;

            PacketBResponseRetrieveOptions ResponseContent = new PacketBResponseRetrieveOptions(1, ObjPlayer.Settings.ToXml);

            Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {ResponseContent}");

            byte[] Response = ResponseContent.ToByteArray();

            Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BResponseRetrieveOptions, p.HeaderRequestId, Response);

            byte[] ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }