예제 #1
0
        /// <summary>
        /// Returns the address for the given field according to the given struct index in the array
        /// </summary>
        public Pointer GetAddress(int entryIndex, string entryField = "")
        {
            Pointer address = Address + entryIndex * EntryLength;

            if (entryField == "")
            {
                return(address);
            }
            else
            {
                StructField field = GetField(entryField);
                return(address + field.Offset);
            }
        }
예제 #2
0
        public dynamic this[string entryField]
        {
            get
            {
                StructField field = GetField(entryField);

                byte[] data = Core.ReadData(Address + EntryIndex * EntryLength + field.Offset, field.Length);

                if (field.Type == typeof(Pointer))
                {
                    return(new Pointer((uint)Util.BytesToNumber(data, true), false, true));
                }
                else if (field.Type == typeof(string))
                {
                    return(data.GetASCII(0, data.Length));
                }
                else
                {
                    return(Convert.ChangeType(Util.BytesToNumber(data, true), field.Type));
                }
            }
        }