Exemplo n.º 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);
        }
Exemplo n.º 2
0
 protected RecordGroup ReadTES3(Header header, bool loadAll, ProxySink.DataInfo info)
 {
     using (var ms = new MemoryStream())
         using (var w = new BinaryFileWriter(ms))
         {
             header.Write(w, Format);
             ms.Position = 0;
             var headerBytes = ms.ToArray();
             info?.AddGroup(header.Label, headerBytes);
         }
     //var group = new RecordGroup(_proxySink, _r, FilePath, Format, RecordLevel, Depth + 1);
     AddHeader(header, info);
     if (loadAll || info != null)
     {
         Load(loadAll, info);
     }
     ReadTES3Transform(this, info);
     return(this);
 }