コード例 #1
0
        public DZSFormat(byte[] data, ref int srcOffset)
        {
            Header       = new DZSHeader(data, ref srcOffset);
            ChunkHeaders = new List <DZSChunkHeader>();
            Data         = data;

            for (int i = 0; i < Header.ChunkCount; i++)
            {
                DZSChunkHeader chunkHeader = new DZSChunkHeader(data, ref srcOffset);
                ChunkHeaders.Add(chunkHeader);

                for (int k = 0; k < chunkHeader.ElementCount; k++)
                {
                    IChunkType chunk;

                    switch (chunkHeader.Tag)
                    {
                    case "EnvR": chunk = new EnvRChunk(); break;

                    case "Colo": chunk = new ColoChunk(); break;

                    case "Pale": chunk = new PaleChunk(); break;

                    case "Virt": chunk = new VirtChunk(); break;

                    case "SCLS": chunk = new SclsChunk(); break;

                    case "PLYR": chunk = new PlyrChunk(); break;

                    default:
                        chunk = new DefaultChunk();
                        break;
                    }

                    chunk.LoadData(data, ref chunkHeader.ChunkOffset);
                    chunkHeader.ChunkElements.Add(chunk);
                }
            }
        }
コード例 #2
0
ファイル: FileFormat.cs プロジェクト: pho/WindViewer
        public DZSFormat(byte[] data, ref int srcOffset)
        {
            Header = new DZSHeader(data, ref srcOffset);
            ChunkHeaders = new List<DZSChunkHeader>();
            Data = data;

            for (int i = 0; i < Header.ChunkCount; i++)
            {
                DZSChunkHeader chunkHeader = new DZSChunkHeader(data, ref srcOffset);
                ChunkHeaders.Add(chunkHeader);

                for (int k = 0; k < chunkHeader.ElementCount; k++)
                {
                    IChunkType chunk;

                    switch (chunkHeader.Tag)
                    {
                        case "EnvR": chunk = new EnvRChunk(); break;
                        case "Colo": chunk = new ColoChunk(); break;
                        case "Pale": chunk = new PaleChunk(); break;
                        case "Virt": chunk = new VirtChunk(); break;
                        case "SCLS": chunk = new SclsChunk(); break;
                        case "PLYR": chunk = new PlyrChunk(); break;
                        default:
                            chunk = new DefaultChunk();
                            break;
                    }

                    chunk.LoadData(data, ref chunkHeader.ChunkOffset);
                    chunkHeader.ChunkElements.Add(chunk);
                }
            }
        }