public override void Read(Iff iff, Stream stream) { using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)) { var formatCode = io.ReadInt16(); if (!io.HasMore) { return; } if (formatCode == 0) { var numStrings = io.ReadUInt16(); Strings = new STRItem[numStrings]; for (var i = 0; i < numStrings; i++) { Strings[i] = new STRItem { Value = io.ReadPascalString() }; } } else if (formatCode == -1) { var numStrings = io.ReadUInt16(); Strings = new STRItem[numStrings]; for (var i = 0; i < numStrings; i++) { Strings[i] = new STRItem { Value = io.ReadNullTerminatedString() }; } } else if (formatCode == -2) { var numStrings = io.ReadUInt16(); Strings = new STRItem[numStrings]; for (var i = 0; i < numStrings; i++) { Strings[i] = new STRItem { Value = io.ReadNullTerminatedString(), Comment = io.ReadNullTerminatedString() }; } } else if (formatCode == -3) { var numStrings = io.ReadUInt16(); Strings = new STRItem[numStrings]; for (var i = 0; i < numStrings; i++) { Strings[i] = new STRItem { LanguageCode = (byte)(io.ReadByte() + 1), Value = io.ReadNullTerminatedString(), Comment = io.ReadNullTerminatedString() }; } } else if (formatCode == -4) { var numLanguageSets = io.ReadByte(); this.LanguageSets = new STRLanguageSet[numLanguageSets]; for (var i = 0; i < numLanguageSets; i++) { var item = new STRLanguageSet(); var numStringPairs = io.ReadUInt16(); item.Strings = new STRItem[numStringPairs]; for (var x = 0; x < numStringPairs; x++) { item.Strings[x] = new STRItem { LanguageCode = (byte)(io.ReadByte() + 1), Value = io.ReadVariableLengthPascalString(), Comment = io.ReadVariableLengthPascalString() }; } this.LanguageSets[i] = item; } } } }