public Strip(byte[] file, int address, ChunkType type, byte userFlags) { Indexes = new ushort[Math.Abs(ByteConverter.ToInt16(file, address))]; Reversed = (ByteConverter.ToUInt16(file, address) & 0x8000) == 0x8000; address += 2; switch (type) { case ChunkType.Strip_StripUVN: case ChunkType.Strip_StripUVH: case ChunkType.Strip_StripUVN2: case ChunkType.Strip_StripUVH2: UVs = new UV[Indexes.Length]; break; case ChunkType.Strip_StripColor: VColors = new Color[Indexes.Length]; break; case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVHColor: UVs = new UV[Indexes.Length]; VColors = new Color[Indexes.Length]; break; } if (userFlags > 0) { UserFlags1 = new ushort[Indexes.Length - 2]; } if (userFlags > 1) { UserFlags2 = new ushort[Indexes.Length - 2]; } if (userFlags > 2) { UserFlags3 = new ushort[Indexes.Length - 2]; } for (int i = 0; i < Indexes.Length; i++) { Indexes[i] = ByteConverter.ToUInt16(file, address); address += 2; switch (type) { case ChunkType.Strip_StripUVN: case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVN2: UVs[i] = new UV(file, address, false); address += UV.Size; break; case ChunkType.Strip_StripUVH: case ChunkType.Strip_StripUVHColor: case ChunkType.Strip_StripUVH2: UVs[i] = new UV(file, address, true); address += UV.Size; break; } switch (type) { case ChunkType.Strip_StripColor: case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVHColor: VColors[i] = VColor.FromBytes(file, address, ColorType.ARGB8888_16); address += VColor.Size(ColorType.ARGB8888_16); break; } if (i > 1) { if (userFlags > 0) { UserFlags1[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; if (userFlags > 1) { UserFlags2[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; if (userFlags > 2) { UserFlags3[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; } } } } } }