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


C# RecordReader.ReadRecordAt方法代码示例

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


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

示例1: PluginInspector

        public PluginInspector(DataContext context, DataFile file)
        {
            Log.Info("Inspecting records in plugin {0}", file.Name);
            using (var reader = new RecordReader(file.Open(), context))
            {
                var header = reader.ReadHeader();
                int masters = header.GetMasterFiles().Count();
                byte newRecordPluginNumber = (byte)masters;

                foreach (var entry in reader.FindRecordsAsync())
                {
                    index.Add(entry.FilePosition, entry.FormId);
                }

                long newForms = 0;
                long done = 0;

                using (var progress = Display.StartProgress("Inspecting records"))
                {
                    foreach (var item in index)
                    {
                        if (item.Value >> 24 == newRecordPluginNumber)
                        {
                            // Read only the bare minimum of form data (such as EditorID)
                            var record = new DummyRecord();
                            reader.ReadRecordAt(item.Key, record, true);

                            if (!string.IsNullOrEmpty(record.EditorId))
                            {
                                var formId = item.Value & 0xFFFFFF;

                                Log.Fine("Found new record {0:X8} '{1}'", formId, record.EditorId);

                                newRecords.Add(new RecordInfo()
                                {
                                    FormId = formId,
                                    EditorId = record.EditorId
                                });
                            }
                            newForms++;
                        }
                        done++;
                        progress.Update(done, index.Count, file.Name);
                    }
                }

                Log.Info("Found {0} records out of which {1} are new records.", index.Count, newForms);
            }
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:49,代码来源:PluginInspector.cs

示例2: LoadSingleForm

        private static void LoadSingleForm(Form form, RecordReader reader, SharedData sharedData)
        {
            // Skip if record has been already loaded
            // unless it has been loaded lazily and current loading scheme is lazy again
            if (form.Record != null && (!form.IsLazyLoaded || sharedData.LazyLoading))
            {
                Interlocked.Increment(ref sharedData.Skipped);
            }
            else
            {
                if (sharedData.LazyLoading)
                {
                    form.Flags |= FormFlags.LazyLoaded;
                }
                else
                {
                    form.Flags &= ~FormFlags.LazyLoaded;
                }

                form.Record = sharedData.Plugin.Context.CreateGenericFormRecord(form.FormKind);

                reader.ReadRecordAt(form.FilePosition, form.Record, sharedData.LazyLoading);

                sharedData.LastFormLoaded = form;

                if (form.IsDummyRecord)
                    Interlocked.Increment(ref sharedData.Unsupported);

                Interlocked.Increment(ref sharedData.Loaded);
            }
        }
开发者ID:unforbidable,项目名称:patcher,代码行数:31,代码来源:FormLoader.cs


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