示例#1
0
        protected RecordGroup ReadGRUP(Header header, bool loadAll, ProxySink.DataInfo info)
        {
            var headerBytes  = _r.ReadAbsoluteBytes(header.HeaderPosition, (int)(header.Position - header.HeaderPosition));
            var nextPosition = _r.Position + header.DataSize;
            var label        = header.Label;

            info?.AddGroup(label, headerBytes);
            if (GroupByLabel == null)
            {
                GroupByLabel = new Dictionary <string, RecordGroup>();
            }
            if (!GroupByLabel.TryGetValue(label, out var group))
            {
                GroupByLabel.Add(label, group = new RecordGroup(_proxySink, _r, FilePath, Format, RecordLevel, Depth + 1));
            }
            else
            {
                group = new RecordGroup(_proxySink, _r, FilePath, Format, RecordLevel, Depth + 1)
                {
                    Next = group
                }
            };
            group.AddHeader(header, info);
            _r.Position = nextPosition;
            if (loadAll || info != null)
            {
                group.Load(loadAll, info);
            }
            //Log($"Grup: {string.Join("/", GetHeaderPath(new List<string>(), parentHeader).ToArray())} {parentHeader.GroupType}");
            return(group);
        }
示例#2
0
 void ReadTES3Transform(RecordGroup group, ProxySink.DataInfo info) => GroupByLabel = group.Records.GroupBy(x => x.Header.Type)
                                                                                      .ToDictionary(x => x.Key, x =>
 {
     var s = new RecordGroup(_proxySink, _r, FilePath, Format, RecordLevel, Depth + 1)
     {
         Records = x.ToList()
     };
     s.AddHeader(new Header {
         Label = x.Key
     }, info);
     return(s);
 });