Example #1
0
        public List <BRLYT> GetLayouts()
        {
            List <BRLYT> animations = new List <BRLYT>();

            if (IFileInfo.ArchiveParent != null)
            {
                foreach (var file in IFileInfo.ArchiveParent.Files)
                {
                    if (Utils.GetExtension(file.FileName) == ".brlyt")
                    {
                        BRLYT brlyt = (BRLYT)file.OpenFile();
                        animations.Add(brlyt);
                    }
                }
            }
            return(animations);
        }
Example #2
0
            public void Read(FileReader reader, BRLYT brlyt)
            {
                IsBigEndian = reader.ByteOrder == Syroot.BinaryData.ByteOrder.BigEndian;

                LayoutInfo   = new LYT1();
                TextureList  = new TXL1();
                MaterialList = new MAT1();
                FontList     = new FNL1();
                RootPane     = new PAN1();
                RootGroup    = new GRP1();

                FileInfo = brlyt;

                reader.SetByteOrder(true);
                reader.ReadSignature(4, Magic);
                ByteOrderMark = reader.ReadUInt16();
                reader.CheckByteOrderMark(ByteOrderMark);
                Version = reader.ReadUInt16();
                uint FileSize = reader.ReadUInt32();

                HeaderSize = reader.ReadUInt16();
                ushort sectionCount = reader.ReadUInt16();

                reader.ReadUInt16(); //Padding

                bool setRoot      = false;
                bool setGroupRoot = false;

                BasePane currentPane = null;
                BasePane parentPane  = null;

                BasePane currentGroupPane = null;
                BasePane parentGroupPane  = null;

                reader.SeekBegin(HeaderSize);
                for (int i = 0; i < sectionCount; i++)
                {
                    long pos = reader.Position;

                    string Signature   = reader.ReadString(4, Encoding.ASCII);
                    uint   SectionSize = reader.ReadUInt32();

                    SectionCommon section = new SectionCommon();
                    switch (Signature)
                    {
                    case "lyt1":
                        LayoutInfo = new LYT1(reader);
                        break;

                    case "txl1":
                        TextureList = new TXL1(reader);
                        break;

                    case "fnl1":
                        FontList = new FNL1(reader);
                        break;

                    case "mat1":
                        MaterialList = new MAT1(reader, this);
                        break;

                    case "pan1":
                        var panel = new PAN1(reader);
                        if (!setRoot)
                        {
                            RootPane = panel;
                            setRoot  = true;
                        }

                        SetPane(panel, parentPane);
                        currentPane = panel;
                        break;

                    case "pic1":
                        var picturePanel = new PIC1(reader, this);

                        SetPane(picturePanel, parentPane);
                        currentPane = picturePanel;
                        break;

                    case "txt1":
                        var textPanel = new TXT1(reader);

                        SetPane(textPanel, parentPane);
                        currentPane = textPanel;
                        break;

                    case "bnd1":
                        var boundsPanel = new BND1(reader);

                        SetPane(boundsPanel, parentPane);
                        currentPane = boundsPanel;
                        break;

                    case "prt1":
                        var partsPanel = new PRT1(reader);

                        SetPane(partsPanel, parentPane);
                        currentPane = partsPanel;
                        break;

                    case "wnd1":
                        var windowPanel = new WND1(reader);
                        SetPane(windowPanel, parentPane);
                        currentPane = windowPanel;
                        break;

                    case "cnt1":
                        break;

                    case "pas1":
                        if (currentPane != null)
                        {
                            parentPane = currentPane;
                        }
                        break;

                    case "pae1":
                        currentPane = parentPane;
                        parentPane  = currentPane.Parent;
                        break;

                    case "grp1":
                        var groupPanel = new GRP1(reader, this);

                        if (!setGroupRoot)
                        {
                            RootGroup    = groupPanel;
                            setGroupRoot = true;
                        }

                        SetPane(groupPanel, parentGroupPane);
                        currentGroupPane = groupPanel;
                        break;

                    case "grs1":
                        if (currentGroupPane != null)
                        {
                            parentGroupPane = currentGroupPane;
                        }
                        break;

                    case "gre1":
                        currentGroupPane = parentGroupPane;
                        parentGroupPane  = currentGroupPane.Parent;
                        break;

                    case "usd1":
                        break;

                    //If the section is not supported store the raw bytes
                    default:
                        section.Data = reader.ReadBytes((int)SectionSize);
                        break;
                    }

                    section.SectionSize = SectionSize;

                    reader.SeekBegin(pos + SectionSize);
                }
            }