Esempio n. 1
0
        internal static void ToNativeInternal(IntPtr nativeBuffer, int arrayIndex, IDictionary <TKey, TValue> value,
                                              ref FScriptMapHelper helper, MarshalingDelegates <TKey> .ToNative keyToNative, MarshalingDelegates <TValue> .ToNative valueToNative)
        {
            IntPtr scriptMapAddress = nativeBuffer + (arrayIndex * Marshal.SizeOf(typeof(FScriptMap)));

            helper.Map = scriptMapAddress;

            // Make sure any existing elements are properly destroyed
            helper.EmptyValues();

            if (value == null)
            {
                return;
            }

            unsafe
            {
                FScriptMap *map = (FScriptMap *)scriptMapAddress;

                Dictionary <TKey, TValue> dictionary = value as Dictionary <TKey, TValue>;
                if (dictionary != null)
                {
                    foreach (KeyValuePair <TKey, TValue> pair in dictionary)
                    {
                        helper.AddPair(pair.Key, pair.Value, keyToNative, valueToNative);
                    }
                    return;
                }

                TMapBase <TKey, TValue> mapBase = value as TMapBase <TKey, TValue>;
                if (mapBase != null)
                {
                    foreach (KeyValuePair <TKey, TValue> pair in mapBase)
                    {
                        helper.AddPair(pair.Key, pair.Value, keyToNative, valueToNative);
                    }
                    return;
                }

                foreach (KeyValuePair <TKey, TValue> pair in value)
                {
                    helper.AddPair(pair.Key, pair.Value, keyToNative, valueToNative);
                }
            }
        }
Esempio n. 2
0
 public ValueCollection(TMapBase <TKey, TValue> map)
 {
     this.map = map;
 }
Esempio n. 3
0
 public Enumerator(TMapBase <TKey, TValue> map)
 {
     this.map = map;
     index    = -1;
 }
Esempio n. 4
0
 public KeyEnumerator(TMapBase <TKey, TValue> map)
 {
     this.map = map;
 }