예제 #1
0
        private EntryBase AddEntry(XdbfEntry entry, byte[] content)
        {
            switch (entry.Type)
            {
            case EntryType.Achievement:
                return(Achievements.AddEntry(entry, content));

            case EntryType.Image:
                return(Images.AddEntry(entry, content));

            case EntryType.Setting:
                return(Settings.AddEntry(entry, content));

            case EntryType.Title:
                return(TitlesPlayed.AddEntry(entry, content));

            case EntryType.String:
                return(Strings.AddEntry(entry, content));

            case EntryType.AvatarAward:
                return(AvatarAwards.AddEntry(entry, content));

            case EntryType.MysteriousSeven:
                return(TheUnknowns.AddEntry(entry, content));

            default:
                throw new NotSupportedException("Invalid entry type: " + entry.Type);
            }
        }
예제 #2
0
        public byte[] GetEntryContent(XdbfEntry entry)
        {
            var contentAddress = GetRealAddress(entry.AddressSpecifier);

            BinMap.Add(contentAddress, entry.Length,
                       entry.IsSyncData ? "SyncData" : entry.IsSyncList ? "SyncList" : String.Empty,
                       entry.Type.ToString());
            return(Binary.ReadBytes(contentAddress, entry.Length));
        }
예제 #3
0
        private void RewriteEntry(XdbfEntry entry, byte[] content)
        {
            var length = content.Length;

            entry.AddressSpecifier = _rebuildAddress;
            entry.Length           = length;

            var offset = HeaderSize + (_rebuildIndex * EntrySize);

            Binary.WriteBytes(offset, entry.Binary.ReadAll(), 0, EntrySize);

            offset = GetRealAddress(_rebuildAddress);
            Binary.WriteBytes(offset, content, 0, length);

            _rebuildAddress += length;
            _rebuildIndex++;
        }