2017-11-05 10:37:59 +00:00
|
|
|
using System;
|
2017-10-02 21:24:00 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace Godot
|
|
|
|
{
|
|
|
|
internal static class MarshalUtils
|
|
|
|
{
|
|
|
|
private static Dictionary<object, object> ArraysToDictionary(object[] keys, object[] values)
|
|
|
|
{
|
2018-04-08 03:30:43 +00:00
|
|
|
var ret = new Dictionary<object, object>();
|
2017-10-02 21:24:00 +00:00
|
|
|
|
2018-04-08 03:30:43 +00:00
|
|
|
for (var i = 0; i < keys.Length; i++)
|
2017-10-02 21:24:00 +00:00
|
|
|
{
|
|
|
|
ret.Add(keys[i], values[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void DictionaryToArrays(Dictionary<object, object> from, out object[] keysTo, out object[] valuesTo)
|
|
|
|
{
|
2018-04-08 03:30:43 +00:00
|
|
|
var keys = from.Keys;
|
2017-10-02 21:24:00 +00:00
|
|
|
keysTo = new object[keys.Count];
|
|
|
|
keys.CopyTo(keysTo, 0);
|
|
|
|
|
2018-04-08 03:30:43 +00:00
|
|
|
var values = from.Values;
|
2017-10-02 21:24:00 +00:00
|
|
|
valuesTo = new object[values.Count];
|
|
|
|
values.CopyTo(valuesTo, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Type GetDictionaryType()
|
|
|
|
{
|
|
|
|
return typeof(Dictionary<object, object>);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|