public ScriptTable LoadScripts(IReader reader) { StructureValueCollection values = LoadScriptTag(reader, _scnrTag); ulong strSize = values.GetInteger("script string table size"); var result = new ScriptTable(); var stringReader = new StringTableReader(); result.Scripts = LoadScripts(reader, values); result.Globals = LoadGlobals(reader, values); if (values.HasInteger("script syntax table size")) { result.Expressions = LoadSyntax(reader, values, stringReader); } else { result.Expressions = LoadExpressions(reader, values, stringReader); } CachedStringTable strings = LoadStrings(reader, values, stringReader); foreach (ScriptExpression expr in result.Expressions.Where(e => (e != null))) { expr.ResolveStrings(strings); } return(result); }
public void ReadRequestedStrings(IReader reader, int tableOffset, CachedStringTable output) { int lastEnd = -1; foreach (int offset in _requestedStrings) { if (offset <= lastEnd) continue; reader.SeekTo(tableOffset + offset); string str = reader.ReadAscii(); output.CacheString(offset, str); lastEnd = offset + str.Length; } }
public void ReadRequestedStrings(IReader reader, int tableOffset, CachedStringTable output) { int lastEnd = -1; foreach (int offset in _requestedStrings) { if (offset <= lastEnd) { continue; } reader.SeekTo(tableOffset + offset); string str = reader.ReadAscii(); output.CacheString(offset, str); lastEnd = offset + str.Length; } }
public void ReadRequestedStrings(IReader reader, int tableOffset, CachedStringTable output) { uint lastEnd = 0; foreach (uint offset in _requestedStrings) { if (offset < lastEnd) { continue; } reader.SeekTo(tableOffset + offset); string str = reader.ReadWin1252(); output.CacheString(offset, str); lastEnd = offset + (uint)str.Length; } }
private CachedStringTable LoadStrings(IReader reader, StructureValueCollection values, StringTableReader stringReader) { int stringsSize = (int)values.GetInteger("script string table size"); if (stringsSize == 0) { return(new CachedStringTable()); } uint tableAddr = (uint)values.GetInteger("script string table address"); long expand = _expander.Expand(tableAddr); int tableOffset = _metaArea.PointerToOffset(expand); var result = new CachedStringTable(); stringReader.ReadRequestedStrings(reader, tableOffset, result); return(result); }
internal void ResolveStrings(CachedStringTable requestedStrings) { StringValue = requestedStrings.GetString(_stringTableOffset); }
/// <summary> /// Resolves the string value. /// </summary> /// <param name="requestedStrings">The table containing the expression strings.</param> internal void ResolveStrings(CachedStringTable requestedStrings) { StringValue = requestedStrings.GetString(StringOffset); }
private CachedStringTable LoadStrings(IReader reader, StructureValueCollection values, StringTableReader stringReader) { var stringsSize = (int) values.GetInteger("script string table size"); if (stringsSize == 0) return new CachedStringTable(); var result = new CachedStringTable(); int tableOffset = _metaArea.PointerToOffset(values.GetInteger("script string table address")); stringReader.ReadRequestedStrings(reader, tableOffset, result); return result; }