public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); this.id = reader.ReadUInt32(); this.startBlocks = new string[4]; for (int i = 0; i < this.startBlocks.Length; i++) { ushort textSize = reader.ReadUInt16(); this.startBlocks[i] = reader.ReadString(textSize).ApplyTable("replace", false); } this.unknown = reader.ReadBytes(0x0D); byte numEndBlocks = reader.ReadByte(); this.endBlocks = new string[numEndBlocks]; for (int i = 0; i < this.endBlocks.Length; i++) { ushort size = reader.ReadUInt16(); this.endBlocks[i] = reader.ReadString(size).ApplyTable("replace", false); } byte numUnknown = reader.ReadByte(); this.unknown2 = new byte[numUnknown][]; for (int i = 0; i < this.unknown2.Length; i++) { byte dataSize = reader.ReadByte(); this.unknown2[i] = reader.ReadBytes(dataSize + 4); } }
public override void Read(DataStream strIn) { this.entries = new List<SubtitleEntry>(); // Gets all the lines DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); string[] lines = reader.ReadString().Split(ExtraSplit); for (int i = 0; i < lines.Length; i++) { SubtitleEntry entry = new SubtitleEntry(); if (string.IsNullOrEmpty(lines[i]) || lines[i] == "\n") continue; string line = lines[i].Substring(1); if (line[0] == '#') { entry.Type = SubtitleType.Comment; entry.Data = line.Substring(1).ApplyTable("replace", false); } else if (line.StartsWith("/stream", StringComparison.Ordinal)) { entry.Type = SubtitleType.Voice; entry.Data = line.Substring(8); } else if (line.StartsWith("/sync", StringComparison.Ordinal)) { entry.Type = SubtitleType.SyncTime; entry.Data = line.Substring(6); } else if (line.StartsWith("/clear", StringComparison.Ordinal)) { entry.Type = SubtitleType.Clear; } else { entry.Type = SubtitleType.Text; entry.Data = line.ApplyTable("replace", false); } this.entries.Add(entry); } }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); ushort numBlocks = reader.ReadUInt16(); reader.ReadUInt16(); // Total number of subblocks this.entries = new Entry[numBlocks]; for (int i = 0; i < numBlocks; i++) { this.entries[i] = new Entry(); this.entries[i].Title = reader.ReadString(0x40).ApplyTable("replace", false); ushort subBlocks = reader.ReadUInt16(); this.entries[i].Dungeons = new Dungeon[subBlocks]; for (int j = 0; j < subBlocks; j++) this.entries[i].Dungeons[j] = new Dungeon() { Text = reader.ReadString(0x40).ApplyTable("replace", false), ScriptName = reader.ReadString(0x08) }; } }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); ushort numEntries = reader.ReadUInt16(); this.entries = new Entry[numEntries]; for (int i = 0; i < numEntries; i++) { this.entries[i] = new Entry(); this.entries[i].Id = reader.ReadUInt32(); this.entries[i].Text = reader.ReadString(typeof(ushort), "replace", false); } }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); uint numBlocks = reader.ReadUInt32(); this.entries = new Entry[numBlocks]; for (int i = 0; i < numBlocks; i++) { uint idx = reader.ReadUInt32(); int textSize = reader.ReadInt32(); string text = reader.ReadString(textSize); this.entries[i] = new Entry(idx, text.ApplyTable("replace", false)); } }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); ushort numBlock = reader.ReadUInt16(); this.entries = new Entry[numBlock]; for (int i = 0; i < numBlock; i++) this.entries[i] = new Entry( reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadString(0x30).ApplyTable("replace", false) ); }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); ushort num_block = reader.ReadUInt16(); this.text = new string[num_block]; for (int i = 0; i < num_block; i++) { this.text[i] = reader.ReadString(0x80); this.text[i] = this.text[i].Replace("\\n", "\n"); this.text[i] = this.text[i].ApplyTable("replace", false); } }
/// <summary> /// Read a banner from a stream. /// </summary> /// <param name="str">Stream to read from.</param> public override void Read(DataStream str) { DataReader dr = new DataReader(str, EndiannessMode.LittleEndian, Encoding.Unicode); this.version = dr.ReadUInt16(); this.crc16 = dr.ReadUInt16(); this.crc16v2 = dr.ReadUInt16(); this.reserved = dr.ReadBytes(0x1A); this.tileData = dr.ReadBytes(0x200); this.palette = dr.ReadBytes(0x20); this.japaneseTitle = dr.ReadString(0x100); this.englishTitle = dr.ReadString(0x100); this.frenchTitle = dr.ReadString(0x100); this.germanTitle = dr.ReadString(0x100); this.italianTitle = dr.ReadString(0x100); this.spanishTitle = dr.ReadString(0x100); }
public override void Read(DataStream strIn) { DataReader reader = new DataReader(strIn, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); ushort numBlocks = reader.ReadUInt16(); this.blocks = new Block[numBlocks]; for (int i = 0; i < numBlocks; i++) { reader.ReadUInt16(); // Block size this.blocks[i] = new Block(); this.blocks[i].Id = reader.ReadUInt32(); this.blocks[i].Elements = new string[3]; for (int j = 0; j < 3; j++) this.blocks[i].Elements[j] = reader.ReadString(typeof(ushort), "replace", false); reader.ReadByte(); // 0x00 } }
public override void Read(DataStream strIn) { DataStream data; // Simple NOT encoding if (isEncoded) { data = new DataStream(new System.IO.MemoryStream(), 0, 0); Codec(strIn, data); // Decode strIn to data } else { data = strIn; } data.Seek(0, SeekMode.Origin); var reader = new DataReader(data, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); int blockSize = textSize + dataSize; int numBlocks = hasNumBlock ? reader.ReadUInt16() : (int)(data.Length / blockSize); blocks = new Block[numBlocks]; for (int i = 0; i < numBlocks; i++) blocks[i] = new Block( reader.ReadString(textSize).ApplyTable("replace", false), reader.ReadBytes(dataSize) ); // Free the decoded data if (isEncoded) data.Dispose(); }
public override void Read(DataStream stream) { base.Read(stream); DataReader reader = new DataReader( stream, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); reader.ReadByte(); // Entry length int numSubEntries = reader.ReadByte(); this.SubEntries = new SubEntry[numSubEntries]; for (int i = 0; i < numSubEntries; i++) { this.SubEntries[i] = new SubEntry(); byte len = reader.ReadByte(); this.SubEntries[i].ScriptName = reader.ReadString(len); this.SubEntries[i].Unknown = reader.ReadUInt16(); } }
public override void Read(DataStream stream) { base.Read(stream); DataReader reader = new DataReader( stream, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); byte textSize = reader.ReadByte(); this.Text = reader.ReadString(textSize); this.Unknown = reader.ReadUInt16(); }
public override void Read(DataStream stream) { base.Read(stream); DataReader reader = new DataReader( stream, EndiannessMode.LittleEndian, Encoding.GetEncoding("shift_jis")); byte textSize = reader.ReadByte(); this.Text = reader.ReadString(textSize).ApplyTable("replace", false); this.Text = GetFurigana(this.Text); }
public void Read(DataStream str) { DataReader dr = new DataReader(str, EndiannessMode.LittleEndian, DefaultEncoding); byte nodeType = dr.ReadByte(); ushort fileId = this.IdFirstFile; int nameLength; string name; // Read until the end of the subtable (reachs 0x00) while (nodeType != 0x0) { // If the node is a file. if (nodeType < 0x80) { nameLength = nodeType; name = dr.ReadString(nameLength); this.AddFileInfo(name, fileId++); } else { nameLength = nodeType - 0x80; name = dr.ReadString(nameLength); ushort folderId = dr.ReadUInt16(); this.AddFolderInfo(name, folderId); } nodeType = dr.ReadByte(); } }