Esempio n. 1
0
        /// <summary>
        /// Checks if a key in the map matches the specified key
        /// </summary>
        /// <param name="inBaseAddress">The base address of the map</param>
        /// <param name="inKeyValue">The key to find within the map</param>
        /// <returns>True if the key is found, false otherwise</returns>
        public bool HasKey(IntPtr inBaseAddress, string inKeyValue)
        {
            for (int index = 0, itemsLeft = Num(); itemsLeft > 0; ++index)
            {
                if (IsValidIndex(index))
                {
                    --itemsLeft;

                    IntPtr pairPtr = GetPairPtr(index);
                    IntPtr keyPtr  = Native_UProperty.ContainerVoidPtrToValuePtr(keyProp, pairPtr, 0);

                    using (FStringUnsafe keyValueUnsafe = new FStringUnsafe())
                    {
                        if (keyPtr != inBaseAddress && Native_UProperty.ExportText_Direct(keyProp, ref keyValueUnsafe.Array,
                                                                                          keyPtr, keyPtr, IntPtr.Zero, 0, IntPtr.Zero))
                        {
                            // Should this be case insensitive? (FString by default is case insensitive)
                            if ((Native_UObjectBaseUtility.IsA(keyProp, Classes.UObjectProperty) &&
                                 keyValueUnsafe.Value.Contains(inKeyValue)) || inKeyValue == keyValueUnsafe.Value)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Get the pointer to property value in a supplied 'container'.
 /// You can _only_ call this function on a UObject* or a uint8*. If the property you want is a 'top level' UObject property, you _must_
 /// call the function passing in a UObject* and not a uint8*. There are checks inside the function to vertify this.
 /// </summary>
 /// <param name="container">UObject* or uint8* to container of property value</param>
 /// <param name="arrayIndex">In array case, index of array element we want</param>
 /// <returns></returns>
 public IntPtr ContainerPtrToValuePtr(IntPtr container, int arrayIndex = 0)
 {
     return(Native_UProperty.ContainerVoidPtrToValuePtr(Address, container, arrayIndex));
 }