From f33453896716e69cacd0d065b7cc633258678946 Mon Sep 17 00:00:00 2001 From: Owen Fraser-Green Date: Wed, 24 Mar 2004 13:15:20 +0000 Subject: Made all DBusTypes take Service in the constructor because Array also needed it in the case of an array of OBJECT_PATH objects. --- mono/DBusType/Array.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mono/DBusType/Array.cs') diff --git a/mono/DBusType/Array.cs b/mono/DBusType/Array.cs index 3bce3afa..34a842c7 100644 --- a/mono/DBusType/Array.cs +++ b/mono/DBusType/Array.cs @@ -16,19 +16,23 @@ namespace DBus.DBusType private System.Array val; private ArrayList elements; private Type elementType; + private Service service = null; private Array() { } - public Array(System.Array val) + public Array(System.Array val, Service service) { this.val = val; this.elementType = Arguments.MatchType(val.GetType().UnderlyingSystemType); + this.service = service; } - public Array(IntPtr iter) + public Array(IntPtr iter, Service service) { + this.service = service; + IntPtr arrayIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize); int elementTypeCode; @@ -38,8 +42,9 @@ namespace DBus.DBusType elements = new ArrayList(); do { - object [] pars = new Object[1]; + object [] pars = new Object[2]; pars[0] = arrayIter; + pars[1] = service; DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars); elements.Add(dbusType); } while (dbus_message_iter_next(arrayIter)); @@ -58,8 +63,9 @@ namespace DBus.DBusType } foreach (object element in this.val) { - object [] pars = new Object[1]; + object [] pars = new Object[2]; pars[0] = element; + pars[1] = this.service; DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars); dbusType.Append(arrayIter); } -- cgit