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


C# RecordReader.ReadField方法代码示例

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


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

示例1: UnknownRecord

 internal UnknownRecord(Module module, RecordReader reader)
     : base(module, reader)
 {
     while (reader.ReadField()) {
         new UnknownRecordField(this, ref reader);
     }
 }
开发者ID:Burton-Radons,项目名称:Alexandria,代码行数:7,代码来源:UnknownRecord.cs

示例2: ReadRecord

        internal void ReadRecord(RecordReader reader, bool lazyLoading)
        {
            var compinfo = InfoProvider.GetCompoundInfo(GetType());
            var recinfo = InfoProvider.GetRecordInfo(GetType());

            BeforeRead(reader);

            reader.BeginReadFields(0);

            HashSet<string> remainingPropertiesToLoad = lazyLoading ? new HashSet<string>(compinfo.Members.Values.Where(m => m.IsLazy).SelectMany(m => m.FieldNames)) : null;

            foreach (string propertyName in reader.FindFields())
            {
                MemberInfo meminf = compinfo.FindMember(propertyName);
                if (meminf != null)
                {
                    reader.ReadField(this, propertyName, meminf, 0);

                    if (remainingPropertiesToLoad != null)
                    {
                        if (!meminf.IsListType && !meminf.IsDynamic)
                            remainingPropertiesToLoad.Remove(propertyName);

                        if (!remainingPropertiesToLoad.Any())
                        {
                            // Loaded all properties that were supposed to
                            reader.CancelFindFields();
                            break;
                        }
                    }
                }
                else if (lazyLoading || recinfo.IsDummyRecord)
                {
                    // Prevent segment errors when not all properties were expected to be consumed
                    reader.SeekEndOfSegment();
                }
                else
                {
                    Log.Warning("Unexpected record property: {0}", propertyName);
                }
            }

            reader.EndReadFields(0);

            //// Make sure list properties that were supposed to be loaded are not null
            //foreach (MemberInfo meminfo in members.Where(m => m.Value.IsListType && (fieldsToLoad == null || fieldsToLoad.Contains(m.Key))).Select(m => m.Value))
            //{
            //    meminfo.EnsureListCreated(this);
            //}

            AfterRead(reader);
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:52,代码来源:Record.cs

示例3: ReadCompoundField

        internal virtual void ReadCompoundField(RecordReader reader, string fieldName, int depth)
        {
            var members = InfoProvider.GetCompoundInfo(GetType()).Members;
            if (!members.ContainsKey(fieldName))
                throw new InvalidProgramException("Unexpected field name while reading a compound field: " + fieldName);

            var meminf = members[fieldName];
            reader.ReadField(this, fieldName, meminf, depth);
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:9,代码来源:Compound.cs


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