public ScriptTable LoadScripts(IReader reader)
        {
            StructureValueCollection values;

            if (_scriptTag != null)
            {
                values = LoadScriptTag(reader);
            }
            else
            {
                values = LoadTag(reader);
            }

            var result       = new ScriptTable();
            var stringReader = new StringTableReader();

            result.Scripts     = LoadScripts(reader, values);
            result.Globals     = LoadGlobals(reader, values);
            result.Variables   = LoadVariables(reader, values);
            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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
            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);
        }
Ejemplo n.º 4
0
        private CachedStringTable LoadStrings(StructureValueCollection values, IReader reader, StringTableReader stringReader, FileSegmentGroup metaArea)
        {
            int stringsSize = (int)values.GetInteger("script string table size");
            if (stringsSize == 0)
                return new CachedStringTable();

            SegmentPointer stringsLocation = SegmentPointer.FromPointer(values.GetInteger("script string table address"), metaArea);

            CachedStringTable result = new CachedStringTable();
            stringReader.ReadRequestedStrings(reader, stringsLocation, result);
            return result;
        }
Ejemplo n.º 5
0
 internal void ResolveStrings(CachedStringTable requestedStrings)
 {
     StringValue = requestedStrings.GetString(_stringTableOffset);
 }