Beispiel #1
0
        public void PostProcessChanges()
        {
            DataFile.CalculateBlockSize();
            DataFile.CalculateOffsets();

            RoomOffsetTable  LOFF       = DataFile.GetLOFF();
            List <DiskBlock> diskBlocks = DataFile.GetLFLFs();

            if (diskBlocks.Count != LOFF.Rooms.Count)
            {
                throw new InvalidFileFormatException("Número de rooms não bate com o de LFLFs");
            }

            //Update ROOM positions offset.
            var orderedDisks = OrderDiskBlocks();

            foreach (RoomOffsetTableItem offsetTableItem in LOFF.Rooms)
            {
                offsetTableItem.OffSet = (uint)orderedDisks[offsetTableItem.Id].Childrens.Single(b => b.GetType() == typeof(RoomBlock)).BlockOffSet;
            }

            foreach (DiskBlock diskBlock in diskBlocks)
            {
                long roomOffset = diskBlock.GetROOM().BlockOffSet;

                List <BlockBase> scripts = diskBlock.Childrens.Where(s => s.BlockType == "SCRP").ToList();
                foreach (var script in scripts)
                {
                    List <DirectoryItem> matchScripts = IndexFile.DSCR.Rooms.Where(x => x.ItemId == script.UniqueId).ToList();
                    matchScripts.ForEach(r => r.Offset = (uint)(script.BlockOffSet - roomOffset));
                }

                List <BlockBase> sounds = diskBlock.Childrens.Where(s => s.BlockType == "SOUN").ToList();
                foreach (var sound in sounds)
                {
                    List <DirectoryItem> matchSounds = IndexFile.DSOU.Rooms.Where(x => x.ItemId == sound.UniqueId).ToList();
                    matchSounds.ForEach(r => r.Offset = (uint)(sound.BlockOffSet - roomOffset));
                }

                List <BlockBase> costumes = diskBlock.Childrens.Where(s => s.BlockType == "COST").ToList();
                foreach (var costume in costumes)
                {
                    List <DirectoryItem> matchCostumes = IndexFile.DCOS.Rooms.Where(x => x.ItemId == costume.UniqueId).ToList();
                    matchCostumes.ForEach(r => r.Offset = (uint)(costume.BlockOffSet - roomOffset));
                }

                List <BlockBase> characters = diskBlock.Childrens.Where(s => s.BlockType == "CHAR").ToList();
                foreach (var character in characters)
                {
                    List <DirectoryItem> matchChars = IndexFile.DCHR.Rooms.Where(x => x.ItemId == character.UniqueId).ToList();
                    matchChars.ForEach(r => r.Offset = (uint)(character.BlockOffSet - roomOffset));
                }
            }
        }
Beispiel #2
0
        public override void SetAndRefreshData(Structures.BlockBase blockBase)
        {
            base.SetAndRefreshData(blockBase);

            _directoryItem = (RoomOffsetTable)blockBase;

            NumberOfItems.Text = _directoryItem.NumOfRooms.ToString();

            RoomsInfo.Items.Clear();
            foreach (RoomOffsetTableItem colorCycle in _directoryItem.Rooms)
            {
                var item = RoomsInfo.Items.Add(colorCycle.Id.ToString());
                item.SubItems.Add(colorCycle.OffSet.ToString());
            }
            RoomsInfo.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }