Exemple #1
0
        public HexResponse ProccessRequest(HexRequest request)
        {
            string original = request.stringToModify;

            char[] chars    = original.ToCharArray();
            string finalOut = "";

            foreach (char conversion in chars)
            {
                finalOut = finalOut + (Convert.ToInt32(conversion)).ToString("X") + " ";
            }

            HexResponse response = new HexResponse();

            response.originalString = original;
            response.modifiedString = finalOut;

            return(response);
        }
Exemple #2
0
        public IActionResult HexControl([FromBody] HexRequest request)
        {
            HexResponse hexResonse;

            try
            {
                //_bin.ValidateRequest(request);
                string[] words = request.stringToModify.Split(' ');

                Thread thread1 = new Thread(() => ControllerHelperFunctions.databaseWordTransaction(words, _DB));
                thread1.Start();

                hexResonse = _hex.ProccessRequest(request);
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }

            return(StatusCode(200, hexResonse));
        }
 public void Setup()
 {
     request  = new HexRequest();
     response = new HexResponse();
     hex      = new Hex();
 }