Exemplo n.º 1
0
        /// <summary>
        /// Automatically Replies "Okay" to a client.
        /// </summary>
        /// <param name="clientSocket">The socket to which the "ok" message should be sent.</param>
        public static void ReplyOk(ReloadedSocket clientSocket)
        {
            // Send back empty message struct
            Message.MessageStruct messageStruct = new Message.MessageStruct();
            messageStruct.MessageType = (ushort)MessageTypes.MessageType.Okay;
            messageStruct.Data        = new byte[1];

            clientSocket.SendData(messageStruct, false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Replies the name of the assembler back to the client.
        /// </summary>
        /// <param name="clientSocket">The socket to which the "ok" message should be sent.</param>
        private static void Report(ReloadedSocket clientSocket)
        {
            // Send back empty message struct.
            Message.MessageStruct messageStruct = new Message.MessageStruct
            {
                MessageType = (ushort)MessageTypes.ReportAssembler,

                // ABSOLUTELY DO NOT CHANGE THIS STRING
                // libReloaded EXPECTS THIS STRING AND WILL IGNORE SERVER UNTIL
                // THIS STRING IS RETURNED. THIS IDENTIFIES THE ASSEMBLER.
                Data = Encoding.ASCII.GetBytes(ReloadedCheckMessage)
            };

            clientSocket.SendData(messageStruct, false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Assembles the received request and sends back information to the client.
        /// </summary>
        /// <param name="mnemonics">The assembly code to be assembled.</param>
        /// <param name="clientSocket">The socket used for communication with the client. which sent the request.</param>
        private static void Assemble(string[] mnemonics, ReloadedSocket clientSocket)
        {
            // Send back empty message struct
            Message.MessageStruct messageStruct = new Message.MessageStruct
            {
                // Client will likely ignore this anyway (but shouldn't).
                MessageType = ( ushort )MessageTypes.Assemble
            };

            // Try Assembly
            // Assemble the bytes
            try
            { messageStruct.Data = FasmNet.Assemble(mnemonics); }

            // Failed to Assemble
            // Return nop on failure.
            catch
            { messageStruct.Data = new byte[1] {
                  0x90
              }; }

            // Return back.
            clientSocket.SendData(messageStruct, false);
        }