Пример #1
0
        public static ISet <T> FromNative(IntPtr nativeBuffer, int arrayIndex, IntPtr prop)
        {
            IntPtr           scriptSetAddress = nativeBuffer + (arrayIndex * Marshal.SizeOf(typeof(FScriptSet)));
            FScriptSetHelper helper           = new FScriptSetHelper(prop, scriptSetAddress);

            unsafe
            {
                FScriptSet *set    = (FScriptSet *)scriptSetAddress;
                HashSet <T> result = new HashSet <T>();
                int         count  = set->Count;
                for (int i = 0; i < count; ++i)
                {
                    result.Add(elementFromNative(helper.GetElementPtr(i), 0, helper.ElementPropertyAddress));
                }
                return(result);
            }
        }
Пример #2
0
        public HashSet <T> FromNative(IntPtr nativeBuffer, int arrayIndex, IntPtr prop)
        {
            IntPtr scriptSetAddress = nativeBuffer + (arrayIndex * Marshal.SizeOf(typeof(FScriptSet)));

            helper.Update(property);
            helper.Set = scriptSetAddress;

            unsafe
            {
                FScriptSet *set      = (FScriptSet *)scriptSetAddress;
                HashSet <T> result   = new HashSet <T>();
                int         maxIndex = set->GetMaxIndex();
                for (int i = 0; i < maxIndex; ++i)
                {
                    if (set->IsValidIndex(i))
                    {
                        result.Add(elementFromNative(helper.GetElementPtr(i), 0, helper.ElementPropertyAddress));
                    }
                }
                return(result);
            }
        }