// Return a line of script at the location specified by index. public ScriptEntry Read(int index) { // TODO check possible corruption of files if (index >= count) { return(null); } readerScript.BaseStream.Seek(index * ENTRY_SIZE, 0); ScriptEntry entry = new ScriptEntry(); entry.command = readerScript.ReadUInt16(); entry.arg = new ushort[3]; // WARNING: fixing # args = 3 entry.arg[0] = readerScript.ReadUInt16(); entry.arg[1] = readerScript.ReadUInt16(); entry.arg[2] = readerScript.ReadUInt16(); return(entry); }
public static void Main(string[] args) { Script script = new Script("sss4.bin"); for (int index = 0; index < 20; index++) { ScriptEntry entry = script.Read(0x966e + index); ScriptEntryDescription entryDesc = (ScriptEntryDescription)ScriptEntryDescription.SCRIPT_COMMAND[entry.command]; if (entryDesc == null) { Console.WriteLine(entry); } else { Console.WriteLine(entryDesc); string s = String.Format("{0}", entryDesc.commandName); for (int i = 0; i < entry.arg.Length; i++) { s += " " + ScriptEntryDescription.FormatArg(entryDesc.argType[i], entry.arg[i]); } Console.WriteLine(s); } } }