Exemplo n.º 1
0
        internal string ReadNameEntry(UnrealNatives.Name name)
        {
            var sb = new StringBuilder();

            if (this._CachedNames.ContainsKey(name.Id) == true)
            {
                sb.Append(this._CachedNames[name.Id]);
            }
            else
            {
                var dataAddress  = this._NameAddresses[name.Id];
                var indexAddress = dataAddress + this.Configuration.NameEntryIndexOffset;
                var index        = this.Runtime.ReadValueS32(indexAddress);
                var encoding     = (index & 1) == 0
                    ? Encoding.ASCII
                    : Encoding.Unicode;
                var stringAddress = dataAddress + this.Configuration.NameEntryStringOffset;
                var value         = this.Runtime.ReadStringZ(stringAddress, encoding);
                this._CachedNames.Add(name.Id, value);
                sb.Append(value);
            }

            if (name.Index != 0)
            {
                sb.Append('_');
                sb.Append((name.Index - 1).ToString(CultureInfo.InvariantCulture));
            }

            return(sb.ToString());
        }
        internal string ReadName(UnrealNatives.Name name)
        {
            string value;

            if (this._CachedNames.ContainsKey(name.Id) == true)
            {
                value = this._CachedNames[name.Id];
            }
            else
            {
                var dataAddress = this._NameAddresses[name.Id];
                value = this.Runtime.ReadStringZ(dataAddress + 16, Encoding.ASCII);
                this._CachedNames.Add(name.Id, value);
            }

            if (name.Index != 0)
            {
                value += "_" + name.Index.ToString(CultureInfo.InvariantCulture);
            }

            return(value);
        }