Example #1
0
        public void Load(Stream stream)
        {
            var header = LfdHeader.Read(stream);

            HasTableOfContents = (header.Type == "RMAP");

            Entries.Clear();

            ResourceEntry entry = new ResourceEntry();

            if (HasTableOfContents)
            {
                var count   = header.Length / 16;
                var headers = new List <LfdHeader>(count);
                for (var i = 0; i < count; i++)
                {
                    headers.Add(LfdHeader.Read(stream));
                }
                entry = ResourceEntry.Load(stream);
            }
            else
            {
                entry.Header = header;
                entry.LoadData(stream);
            }

            while (entry.IsValid)
            {
                Entries.Add(entry);
                entry = ResourceEntry.Load(stream);
            }
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Entries)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HasTableOfContents)));
        }
Example #2
0
        public static ResourceEntry Load(Stream stream)
        {
            var entry = new ResourceEntry();

            entry.Header = stream.ReadStruct <LfdHeader>();
            entry.LoadData(stream);
            return(entry);
        }