summaryrefslogtreecommitdiff
path: root/modules/mono/glue/cs_files/MarshalUtils.cs
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-03 00:13:40 +0200
committerGitHub <noreply@github.com>2017-10-03 00:13:40 +0200
commitb0194a33f65970948ef66819913bf3034a3a22e8 (patch)
tree35e21b53b10bbd525506bb5b72b7f89214e1234f /modules/mono/glue/cs_files/MarshalUtils.cs
parent5cd68abf8896fd86a33c048d6fece61c3cd3f8e5 (diff)
parentd5caf71c3fcdeb422d1b0ea97a836fcdb57a8713 (diff)
Merge pull request #11739 from neikeq/tengo-el-mono
Moved mono module here
Diffstat (limited to 'modules/mono/glue/cs_files/MarshalUtils.cs')
-rw-r--r--modules/mono/glue/cs_files/MarshalUtils.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs
new file mode 100644
index 0000000000..5d40111339
--- /dev/null
+++ b/modules/mono/glue/cs_files/MarshalUtils.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+
+namespace Godot
+{
+ internal static class MarshalUtils
+ {
+ private static Dictionary<object, object> ArraysToDictionary(object[] keys, object[] values)
+ {
+ Dictionary<object, object> ret = new Dictionary<object, object>();
+
+ for (int i = 0; i < keys.Length; i++)
+ {
+ ret.Add(keys[i], values[i]);
+ }
+
+ return ret;
+ }
+
+ private static void DictionaryToArrays(Dictionary<object, object> from, out object[] keysTo, out object[] valuesTo)
+ {
+ Dictionary<object, object>.KeyCollection keys = from.Keys;
+ keysTo = new object[keys.Count];
+ keys.CopyTo(keysTo, 0);
+
+ Dictionary<object, object>.ValueCollection values = from.Values;
+ valuesTo = new object[values.Count];
+ values.CopyTo(valuesTo, 0);
+ }
+
+ private static Type GetDictionaryType()
+ {
+ return typeof(Dictionary<object, object>);
+ }
+ }
+}