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/Arguments.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'mono/Arguments.cs') diff --git a/mono/Arguments.cs b/mono/Arguments.cs index 0df205c3..d5407a5d 100644 --- a/mono/Arguments.cs +++ b/mono/Arguments.cs @@ -74,17 +74,15 @@ namespace DBus // Append an argument public void Append(DBusType.IDBusType dbusType) { - if (dbusType.GetType() == typeof(DBusType.ObjectPath)) { - ((DBusType.ObjectPath) dbusType).SetService(message.Service); - } dbusType.Append(appenderIter); } // Append an argument of the specified type private void AppendType(Type type, object val) { - object [] pars = new Object[1]; + object [] pars = new Object[2]; pars[0] = val; + pars[1] = message.Service; DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(MatchType(type), pars); Append(dbusType); } @@ -163,7 +161,7 @@ namespace DBus // Get the appropriate constructor for a D-BUS type public static ConstructorInfo GetDBusTypeConstructor(Type dbusType, Type type) { - ConstructorInfo constructor = dbusType.GetConstructor(new Type[] {type.UnderlyingSystemType}); + ConstructorInfo constructor = dbusType.GetConstructor(new Type[] {type.UnderlyingSystemType, typeof(Service)}); if (constructor == null) throw new ArgumentException("There is no valid constructor for '" + dbusType + "' from type '" + type + "'"); @@ -254,17 +252,13 @@ namespace DBus { get { - object [] pars = new Object[1]; + object [] pars = new Object[2]; pars[0] = iter; + pars[1] = arguments.message.Service; Type type = (Type) DBusTypes[(char) dbus_message_iter_get_arg_type(iter)]; DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(type, pars); - // Special case for ObjectPath - if (type == typeof(DBusType.ObjectPath)) { - ((DBusType.ObjectPath) dbusType).SetService(arguments.message.Service); - } - return dbusType; } } -- cgit