Example #1
0
        public static HydraPbag Load(IReadable reader)
        {
            var pbag = new HydraPbag();

            pbag.GenNdx = reader.ReadUInt16LE();
            pbag.ModNdx = reader.ReadUInt16LE();
            return(pbag);
        }
Example #2
0
        public void Load(IReadable readable)
        {
            var chunkHead     = new RiffChunk();
            var chunkFastList = new RiffChunk();

            if (!RiffChunk.Load(null, chunkHead, readable) || chunkHead.Id != "sfbk")
            {
                return;
            }

            while (RiffChunk.Load(chunkHead, chunkFastList, readable))
            {
                var chunk = new RiffChunk();
                if (chunkFastList.Id == "pdta")
                {
                    while (RiffChunk.Load(chunkFastList, chunk, readable))
                    {
                        switch (chunk.Id)
                        {
                        case "phdr":
                            for (uint i = 0, count = chunk.Size / HydraPhdr.SizeInFile; i < count; i++)
                            {
                                Phdrs.Add(HydraPhdr.Load(readable));
                            }

                            break;

                        case "pbag":
                            for (uint i = 0, count = chunk.Size / HydraPbag.SizeInFile; i < count; i++)
                            {
                                Pbags.Add(HydraPbag.Load(readable));
                            }

                            break;

                        case "pmod":
                            for (uint i = 0, count = chunk.Size / HydraPmod.SizeInFile; i < count; i++)
                            {
                                Pmods.Add(HydraPmod.Load(readable));
                            }

                            break;

                        case "pgen":
                            for (uint i = 0, count = chunk.Size / HydraPgen.SizeInFile; i < count; i++)
                            {
                                Pgens.Add(HydraPgen.Load(readable));
                            }

                            break;

                        case "inst":
                            for (uint i = 0, count = chunk.Size / HydraInst.SizeInFile; i < count; i++)
                            {
                                Insts.Add(HydraInst.Load(readable));
                            }

                            break;

                        case "ibag":
                            for (uint i = 0, count = chunk.Size / HydraIbag.SizeInFile; i < count; i++)
                            {
                                Ibags.Add(HydraIbag.Load(readable));
                            }

                            break;

                        case "imod":
                            for (uint i = 0, count = chunk.Size / HydraImod.SizeInFile; i < count; i++)
                            {
                                Imods.Add(HydraImod.Load(readable));
                            }

                            break;

                        case "igen":
                            for (uint i = 0, count = chunk.Size / HydraIgen.SizeInFile; i < count; i++)
                            {
                                Igens.Add(HydraIgen.Load(readable));
                            }

                            break;

                        case "shdr":
                            for (uint i = 0, count = chunk.Size / HydraShdr.SizeInFile; i < count; i++)
                            {
                                SHdrs.Add(HydraShdr.Load(readable));
                            }

                            break;

                        default:
                            readable.Position += (int)chunk.Size;
                            break;
                        }
                    }
                }
                else if (chunkFastList.Id == "sdta")
                {
                    while (RiffChunk.Load(chunkFastList, chunk, readable))
                    {
                        switch (chunk.Id)
                        {
                        case "smpl":
                            FontSamples = LoadSamples(chunk, readable);
                            break;

                        default:
                            readable.Position += (int)chunk.Size;
                            break;
                        }
                    }
                }
                else
                {
                    readable.Position += (int)chunkFastList.Size;
                }
            }
        }