Example #1
0
        /// <summary>
        /// Compare the simulation Data with the recived Data. With all the Fancy Placeholders and Special ASCII Chars
        /// </summary>
        /// <param name="recivedMsg"></param>
        /// <param name="simulationMsg"></param>
        /// <returns></returns>
        private bool compareRecivedAndSimMessage(MsgData recivedMsg, string simulationMsg)
        {
            // Clocking the Thread till we found what we are Searching for
            string _myData = Converty.msgDataToSpecialAsciiString(lastMsg.value);

            // Check if we got an Spacer int the String
            if (simulationMsg.IndexOf(SPACE_VALUE.ToString()) > -1)
            {
                string[] _splittedSimulationMsg = simulationMsg.Split(new Char[] { SPACE_VALUE });
                bool     dataValid = true;

                string _myString = _myData;

                foreach (string simulationMsgPart in _splittedSimulationMsg)
                {
                    if (!(_myString.IndexOf(simulationMsgPart) > -1))
                    {
                        // Cut the String that we fount out of the Buffer. So in this case we will check the Abendency in the Messages
                        _myString = _myString.Substring(_myString.IndexOf(simulationMsgPart) + simulationMsgPart.Length);
                        dataValid = false;
                    }
                }

                if (dataValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else if (_myData == simulationMsg)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        ///  Convert the given Msg to the current view Setting as a String
        /// </summary>
        /// <returns></returns>
        public string getMsgWithCurrentViewSettings(MsgData msg)
        {
            string returnMsg;

            // Only change the view to the Sended and Recived Data
            if (msg.type == MsgData.messageType.recived || msg.type == MsgData.messageType.send)
            {
                // Return the Msg with the Current View Configuration
                switch (viewSettings.dataPresentation)
                {
                case 1:
                    returnMsg = Converty.msgDataToHexData(msg);
                    break;

                case 2:
                    returnMsg = Converty.msgDataToDecData(msg);
                    break;

                case 3:
                    returnMsg = Converty.msgDataToBinData(msg);
                    break;

                // Default View String with ASCII Chars
                default:
                    returnMsg = Converty.msgDataToSpecialAsciiString(msg.value);
                    break;
                }
            }
            else
            {
                returnMsg = Converty.msgDataToAsciiChar(msg);
            }


            return(returnMsg);
        }
Example #3
0
        /// <summary>
        /// Compare the simulation Data with the recived Data. With all the Fancy Placeholders and Special ASCII Chars
        /// </summary>
        /// <param name="recivedMsg"></param>
        /// <param name="simulationMsg"></param>
        /// <returns></returns>
        private bool compareRecivedAndSimMessage(MsgData recivedMsg, string simulationMsg)
        {
            // Clocking the Thread till we found what we are Searching for
            string myData = Converty.msgDataToSpecialAsciiString(lastMsg.value);

            // Check if we got an Spacer int the String
            if (simulationMsg.IndexOf(spaceValue.ToString()) > -1)
            {
                string[] splittedSimulationMsg = simulationMsg.Split(new Char[] { spaceValue });
                bool     dataValid             = true;

                string myString = myData;

                foreach (string simulationMsgPart in splittedSimulationMsg)
                {
                    if (!(myString.IndexOf(simulationMsgPart) > -1))
                    {
                        // Cut the String that we fount out of the Buffer. So in this case we will check the Abendency in the Messages
                        myString  = myString.Substring(myString.IndexOf(simulationMsgPart) + simulationMsgPart.Length);
                        dataValid = false;
                    }
                }



                if (dataValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else if (myData == simulationMsg)
            {
                return(true);
            }
            else
            {
                return(false);
            }

            /*
             *
             * int idx = 0;
             * int helper = 0;
             *
             * bool dataValid = false;
             *
             * foreach (string value in splittedData)
             * {
             *
             *  if (simulationMsg.IndexOf(value) == idx && helper == 0)
             *  {
             *      dataValid = true;
             *  }
             *  else if ()
             *  {
             *
             *  }
             *
             *  helper++;
             * }
             */
        }