QuickFix.Message.IdentifyType C# (CSharp) Method

IdentifyType() public static method

Parse the MsgType from a FIX string
public static IdentifyType ( string msgstr ) : MsgType
msgstr string string of a FIX message
return QuickFix.Fields.MsgType
        public static MsgType IdentifyType(string msgstr)
        {
            int valbeg = msgstr.IndexOf("\u000135=") + 4;
            if (valbeg.Equals(-1))
                throw new MessageParseError("no tag 35 found in msg: " + msgstr);
            int valend = msgstr.IndexOf("\u0001", valbeg);
            if (valend.Equals(-1))
                throw new MessageParseError("no SOH after tag 35 in msg: " + msgstr);

            return (new MsgType(msgstr.Substring(valbeg, (valend - valbeg))));
        }

Usage Example

コード例 #1
0
        public void Next(string msgStr)
        {
            try
            {
                this.Log.OnIncoming(msgStr);

                MsgType msgType     = Message.IdentifyType(msgStr);
                string  beginString = Message.ExtractBeginString(msgStr);

                Message message = msgFactory_.Create(beginString, msgType.Obj);
                message.FromString(
                    msgStr,
                    this.ValidateLengthAndChecksum,
                    this.SessionDataDictionary,
                    this.ApplicationDataDictionary);

                Next(message);
            }
            catch (InvalidMessage e)
            {
                this.Log.OnEvent(e.Message);

                try
                {
                    if (MsgType.LOGON.Equals(Message.IdentifyType(msgStr)))
                    {
                        Disconnect("Logon message is not valid");
                    }
                }
                catch (MessageParseError)
                { }

                throw e;
            }
        }
All Usage Examples Of QuickFix.Message::IdentifyType