当前位置: 首页>>代码示例>>C#>>正文


C# DataDictionary.GetMapForMessage方法代码示例

本文整理汇总了C#中DataDictionary.GetMapForMessage方法的典型用法代码示例。如果您正苦于以下问题:C# DataDictionary.GetMapForMessage方法的具体用法?C# DataDictionary.GetMapForMessage怎么用?C# DataDictionary.GetMapForMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataDictionary的用法示例。


在下文中一共展示了DataDictionary.GetMapForMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromString

        /// <summary>
        /// Creates a Message from a FIX string
        /// </summary>
        /// <param name="msgstr"></param>
        /// <param name="validate"></param>
        /// <param name="sessionDD"></param>
        /// <param name="appDD"></param>
        /// <param name="msgFactory">If null, any groups will be constructed as generic Group objects</param>
        public void FromString(string msgstr, bool validate,
            DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory)
        {
            Clear();

            string msgType = "";
            bool expectingHeader = true;
            bool expectingBody = true;
            int count = 0;
            int pos = 0;
            DataDictionary.IFieldMapSpec msgMap = null;

            while (pos < msgstr.Length)
            {
                StringField f = ExtractField(msgstr, ref pos, sessionDD, appDD);

                if (validate && (count < 3) && (Header.HEADER_FIELD_ORDER[count++] != f.Tag))
                    throw new InvalidMessage("Header fields out of order");

                if (IsHeaderField(f.Tag, sessionDD))
                {
                    if (!expectingHeader)
                    {
                        if (0 == field_)
                            field_ = f.Tag;
                        validStructure_ = false;
                    }

                    if (Tags.MsgType.Equals(f.Tag))
                    {
                        msgType = string.Copy(f.Obj);
                        if (appDD != null)
                        {
                            msgMap = appDD.GetMapForMessage(msgType);
                        }
                    }

                    if (!this.Header.SetField(f, false))
                        this.Header.RepeatedTags.Add(f);

                    if ((null != sessionDD) && sessionDD.Header.IsGroup(f.Tag))
                    {
                        pos = SetGroup(f, msgstr, pos, this.Header, sessionDD.Header.GetGroupSpec(f.Tag), sessionDD, appDD, msgFactory);
                    }
                }
                else if (IsTrailerField(f.Tag, sessionDD))
                {
                    expectingHeader = false;
                    expectingBody = false;
                    if (!this.Trailer.SetField(f, false))
                        this.Trailer.RepeatedTags.Add(f);

                    if ((null != sessionDD) && sessionDD.Trailer.IsGroup(f.Tag))
                    {
                        pos = SetGroup(f, msgstr, pos, this.Trailer, sessionDD.Trailer.GetGroup(f.Tag), sessionDD, appDD, msgFactory);
                    }
                }
                else
                {
                    if (!expectingBody)
                    {
                        if (0 == field_)
                            field_ = f.Tag;
                        validStructure_ = false;
                    }

                    expectingHeader = false;
                    if (!SetField(f, false))
                    {
                        this.RepeatedTags.Add(f);
                    }

                    if((null != msgMap) && (msgMap.IsGroup(f.Tag)))
                    {
                        pos = SetGroup(f, msgstr, pos, this, msgMap.GetGroupSpec(f.Tag), sessionDD, appDD, msgFactory);
                    }
                }
            }

            if (validate)
            {
                Validate();
            }
        }
开发者ID:BuddyWork,项目名称:quickfixn,代码行数:92,代码来源:Message.cs

示例2: FromString

        /// <summary>
        /// Creates a Message from a FIX string
        /// </summary>
        /// <param name="msgstr"></param>
        /// <param name="validate"></param>
        /// <param name="sessionDD"></param>
        /// <param name="appDD"></param>
        /// <param name="msgFactory">If null, any groups will be constructed as generic Group objects</param>
        public void FromString(string msgstr, bool validate,
            DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory)
        {
            Clear();

            string msgType = "";
            bool expectingHeader = true;
            bool expectingBody = true;
            int count = 0;
            int pos = 0;
            DataDictionary.IFieldMapSpec msgMap = null;

            if (FixMessageDescriptorEnabled)
            {
                _descriptor = new FixMessageDescriptor();

                if (appDD != null)
                    _descriptor.FixVersion = appDD.Version;

            }
            while (pos < msgstr.Length)
            {
                StringField f = ExtractField(msgstr, ref pos, sessionDD, appDD);

                if (validate && (count < 3) && (Header.HEADER_FIELD_ORDER[count++] != f.Tag))
                    throw new InvalidMessage("Header fields out of order");

                if (IsHeaderField(f.Tag, sessionDD))
                {
                    if (!expectingHeader)
                    {
                        if (0 == field_)
                            field_ = f.Tag;
                        validStructure_ = false;
                    }

                    if (Tags.MsgType.Equals(f.Tag))
                    {
                        msgType = string.Copy(f.Obj);
                        if (appDD != null)
                        {
                            msgMap = appDD.GetMapForMessage(msgType);

                            if (FixMessageDescriptorEnabled)
                            {
                                QuickFix.DataDictionary.DDMap map = null;

                                if (appDD != null && appDD.Messages.TryGetValue(f.Obj, out map))
                                {
                                    _descriptor.MessageType = map.MessageName;

                                }
                            }
                        }
                    }

                    if (!this.Header.SetField(f, false))
                        this.Header.RepeatedTags.Add(f);

                    if ((null != sessionDD) && sessionDD.Header.IsGroup(f.Tag))
                    {
                        if (FixMessageDescriptorEnabled)
                        {
                            _currentGroupField = new GroupFixFieldInfo();

                            _currentGroupField.Tag = f.Tag;

                            DataDictionary.DDField field = null;

                            if (sessionDD != null && sessionDD.FieldsByTag.TryGetValue(f.Tag, out field))
                            {
                                _currentGroupField.Name = field.Name;
                            }

                            _currentGroupField.Value = f.getValue();

                            _currentGroupField.EnumValue = GetEnumValueFromField(f, field);

                            _descriptor.Fields.Add(_currentGroupField);
                        }

                        pos = SetGroup(f, msgstr, pos, this.Header, sessionDD.Header.GetGroupSpec(f.Tag), sessionDD, appDD, msgFactory);

                    }
                    else
                    {
                        if (FixMessageDescriptorEnabled)
                        {
                            AddFixFieldInfo(f, sessionDD);

                        }
                    }
//.........这里部分代码省略.........
开发者ID:unclepaul84,项目名称:quickfixn,代码行数:101,代码来源:Message.cs


注:本文中的DataDictionary.GetMapForMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。