コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }