Ejemplo n.º 1
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);

            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);
        }
Ejemplo n.º 2
0
		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;
			}
		}
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 internal void ResolveStrings(CachedStringTable requestedStrings)
 {
     StringValue = requestedStrings.GetString(_stringTableOffset);
 }
Ejemplo n.º 7
0
 /// <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);
 }
Ejemplo n.º 8
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;
        }