summaryrefslogtreecommitdiffstats
path: root/mono/DBusType
diff options
context:
space:
mode:
Diffstat (limited to 'mono/DBusType')
-rw-r--r--mono/DBusType/Array.cs172
-rw-r--r--mono/DBusType/Boolean.cs86
-rw-r--r--mono/DBusType/Byte.cs105
-rw-r--r--mono/DBusType/Dict.cs148
-rw-r--r--mono/DBusType/Double.cs86
-rw-r--r--mono/DBusType/IDBusType.cs16
-rw-r--r--mono/DBusType/Int16.cs93
-rw-r--r--mono/DBusType/Int32.cs93
-rw-r--r--mono/DBusType/Int64.cs94
-rw-r--r--mono/DBusType/ObjectPath.cs107
-rw-r--r--mono/DBusType/String.cs95
-rw-r--r--mono/DBusType/UInt16.cs93
-rw-r--r--mono/DBusType/UInt32.cs95
-rw-r--r--mono/DBusType/UInt64.cs95
14 files changed, 0 insertions, 1378 deletions
diff --git a/mono/DBusType/Array.cs b/mono/DBusType/Array.cs
deleted file mode 100644
index 3279b5aa..00000000
--- a/mono/DBusType/Array.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// Array.
- /// </summary>
- public class Array : IDBusType
- {
- public const char Code = 'a';
- private System.Array val;
- private ArrayList elements;
- private Type elementType;
- private Service service = null;
-
- private Array()
- {
- }
-
- public Array(System.Array val, Service service)
- {
- this.val = val;
- this.elementType = Arguments.MatchType(val.GetType().GetElementType());
- this.service = service;
- }
-
- public Array(IntPtr iter, Service service)
- {
- this.service = service;
-
- IntPtr arrayIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize);
-
- int elementTypeCode = dbus_message_iter_get_element_type (iter);
- dbus_message_iter_recurse (iter, arrayIter);
- this.elementType = (Type) Arguments.DBusTypes [(char) elementTypeCode];
-
- elements = new ArrayList ();
-
- if (dbus_message_iter_get_arg_type (arrayIter) != 0) {
- do {
- 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));
- }
-
- Marshal.FreeCoTaskMem(arrayIter);
- }
-
- public string GetElementCodeAsString ()
- {
- string ret = System.String.Empty;
- Type t = val.GetType ().GetElementType ();
-
- while (true) {
- ret += Arguments.GetCodeAsString (Arguments.MatchType(t));
-
- if (t.IsArray)
- t = t.GetElementType ();
- else
- break;
- }
-
- return ret;
- }
-
- public void Append(IntPtr iter)
- {
- IntPtr arrayIter = Marshal.AllocCoTaskMem (Arguments.DBusMessageIterSize);
-
- if (!dbus_message_iter_open_container (iter,
- (int) Code, GetElementCodeAsString(),
- arrayIter)) {
- throw new ApplicationException("Failed to append array argument: " + val);
- }
-
- foreach (object element in this.val) {
- object [] pars = new Object[2];
- pars[0] = element;
- pars[1] = this.service;
- DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars);
- dbusType.Append(arrayIter);
- }
-
- if (!dbus_message_iter_close_container (iter, arrayIter)) {
- throw new ApplicationException ("Failed to append array argument: " + val);
- }
-
- Marshal.FreeCoTaskMem (arrayIter);
- }
-
- public static bool Suits(System.Type type)
- {
- Type type2 = type.GetElementType ();
- if (type.IsArray || (type2 != null && type2.IsArray)) {
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_Ref);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Castclass, type);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_Ref);
- }
- }
-
- public object Get()
- {
- throw new ArgumentException("Cannot call Get on an Array without specifying type.");
- }
-
- public object Get(System.Type type)
- {
- if (type.IsArray)
- type = type.GetElementType ();
-
- if (Arguments.Suits(elementType, type.UnderlyingSystemType)) {
- this.val = System.Array.CreateInstance(type.UnderlyingSystemType, elements.Count);
- int i = 0;
- foreach (DBusType.IDBusType element in elements) {
- this.val.SetValue(element.Get(type.UnderlyingSystemType), i++);
- }
- } else {
- throw new ArgumentException("Cannot cast DBus.Type.Array to type '" + type.ToString() + "'");
- }
-
- return this.val;
- }
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_open_container (IntPtr iter,
- int containerType,
- string elementType,
- IntPtr subIter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_close_container (IntPtr iter,
- IntPtr subIter);
-
- [DllImport("dbus-1")]
- private extern static int dbus_message_iter_get_element_type(IntPtr iter);
-
- [DllImport("dbus-1")]
- private extern static int dbus_message_iter_get_arg_type(IntPtr iter);
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_recurse(IntPtr iter, IntPtr subIter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_next(IntPtr iter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_has_next (IntPtr iter);
- }
-}
diff --git a/mono/DBusType/Boolean.cs b/mono/DBusType/Boolean.cs
deleted file mode 100644
index c561f0c5..00000000
--- a/mono/DBusType/Boolean.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// Boolean
- /// </summary>
- public class Boolean : IDBusType
- {
- public const char Code = 'b';
- private System.Boolean val;
-
- private Boolean()
- {
- }
-
- public Boolean(System.Boolean val, Service service)
- {
- this.val = val;
- }
-
- public Boolean(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append BOOLEAN argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- switch (type.ToString()) {
- case "System.Boolean":
- case "System.Boolean&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_I1);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_I1);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I1);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- switch (type.ToString()) {
- case "System.Boolean":
- case "System.Boolean&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Boolean to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out bool value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref bool value);
- }
-}
diff --git a/mono/DBusType/Byte.cs b/mono/DBusType/Byte.cs
deleted file mode 100644
index 958f6832..00000000
--- a/mono/DBusType/Byte.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// Byte
- /// </summary>
- public class Byte : IDBusType
- {
- public const char Code = 'y';
- private System.Byte val;
-
- private Byte()
- {
- }
-
- public Byte(System.Byte val, Service service)
- {
- this.val = val;
- }
-
- public Byte(System.Char val, Service service)
- {
- this.val = (byte) val;
- }
-
- public Byte(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append BYTE argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.Byte)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.Byte":
- case "System.Byte&":
- case "System.Char":
- case "System.Char&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_U1);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_U1);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I1);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString()) {
- case "System.Byte":
- case "System.Byte&":
- return this.val;
- case "System.Char":
- case "System.Char&":
- char charVal = (char) this.val;
- return charVal;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Byte to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out byte value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref byte value);
- }
-}
diff --git a/mono/DBusType/Dict.cs b/mono/DBusType/Dict.cs
deleted file mode 100644
index 660cac57..00000000
--- a/mono/DBusType/Dict.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// Dict.
- /// </summary>
- public class Dict : IDBusType
- {
- public const char Code = 'm';
- private Hashtable val;
-
- private Dict()
- {
- }
-
- public Dict(IDictionary val, Service service)
- {
- this.val = new Hashtable();
- foreach (DictionaryEntry entry in val) {
- this.val.Add(entry.Key, entry.Value);
- }
- }
-
- public Dict(IntPtr iter, Service service)
- {
- IntPtr dictIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize);
-
- bool notEmpty = dbus_message_iter_init_dict_iterator(iter, dictIter);
-
- this.val = new Hashtable();
-
- if (notEmpty) {
- do {
- string key = dbus_message_iter_get_dict_key(dictIter);
-
- // Get the argument type and get the value
- Type elementType = (Type) DBus.Arguments.DBusTypes[(char) dbus_message_iter_get_arg_type(dictIter)];
- object [] pars = new Object[2];
- pars[0] = dictIter;
- pars[1] = service;
- DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars);
- this.val.Add(key, dbusType);
- } while (dbus_message_iter_next(dictIter));
- }
-
- Marshal.FreeCoTaskMem(dictIter);
- }
-
- public void Append(IntPtr iter)
- {
- IntPtr dictIter = Marshal.AllocCoTaskMem(Arguments.DBusMessageIterSize);
-
- if (!dbus_message_iter_append_dict(iter,
- dictIter)) {
- throw new ApplicationException("Failed to append DICT argument:" + val);
- }
-
- foreach (DictionaryEntry entry in this.val) {
- if (!dbus_message_iter_append_dict_key(dictIter, (string) entry.Key)) {
- throw new ApplicationException("Failed to append DICT key:" + entry.Key);
- }
-
- // Get the element type
- Type elementType = Arguments.MatchType(entry.Value.GetType());
- object [] pars = new Object[1];
- pars[0] = entry.Value;
- DBusType.IDBusType dbusType = (DBusType.IDBusType) Activator.CreateInstance(elementType, pars);
- dbusType.Append(dictIter);
- }
-
- Marshal.FreeCoTaskMem(dictIter);
- }
-
- public static bool Suits(System.Type type)
- {
- if (typeof(IDictionary).IsAssignableFrom(type)) {
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_Ref);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Castclass, type);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_Ref);
- }
- }
-
- public object Get()
- {
- return Get(typeof(Hashtable));
- }
-
- public object Get(System.Type type)
- {
- IDictionary retVal;
-
- if (Suits(type)) {
- retVal = (IDictionary) Activator.CreateInstance(type, new object[0]);
- foreach (DictionaryEntry entry in this.val) {
- retVal.Add(entry.Key, ((IDBusType) entry.Value).Get());
- }
- } else {
- throw new ArgumentException("Cannot cast DBus.Type.Dict to type '" + type.ToString() + "'");
- }
-
- return retVal;
- }
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_init_dict_iterator(IntPtr iter,
- IntPtr dictIter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_dict(IntPtr iter,
- IntPtr dictIter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_has_next(IntPtr iter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_next(IntPtr iter);
-
- [DllImport("dbus-1")]
- private extern static string dbus_message_iter_get_dict_key (IntPtr dictIter);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_dict_key (IntPtr dictIter,
- string value);
- [DllImport("dbus-1")]
- private extern static int dbus_message_iter_get_arg_type(IntPtr iter);
- }
-}
diff --git a/mono/DBusType/Double.cs b/mono/DBusType/Double.cs
deleted file mode 100644
index c8975cdc..00000000
--- a/mono/DBusType/Double.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// IEEE 754 double
- /// </summary>
- public class Double : IDBusType
- {
- public const char Code = 'd';
- private System.Double val;
-
- private Double()
- {
- }
-
- public Double(System.Double val, Service service)
- {
- this.val = val;
- }
-
- public Double(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append DOUBLE argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- switch (type.ToString()) {
- case "System.Double":
- case "System.Double&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_R8);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_R8);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_R8);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- switch (type.ToString()) {
- case "System.Double":
- case "System.Double&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Double to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out double value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref double value);
- }
-}
diff --git a/mono/DBusType/IDBusType.cs b/mono/DBusType/IDBusType.cs
deleted file mode 100644
index 447c8208..00000000
--- a/mono/DBusType/IDBusType.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// Base class for DBusTypes
- /// </summary>
- public interface IDBusType
- {
- object Get();
-
- object Get(System.Type type);
-
- void Append(IntPtr iter);
- }
-}
diff --git a/mono/DBusType/Int16.cs b/mono/DBusType/Int16.cs
deleted file mode 100644
index cd99e19e..00000000
--- a/mono/DBusType/Int16.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 16-bit integer.
- /// </summary>
- public class Int16 : IDBusType
- {
- public const char Code = 'n';
- private System.Int16 val;
-
- private Int16()
- {
- }
-
- public Int16(System.Int16 val, Service service)
- {
- this.val = val;
- }
-
- public Int16(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append INT16 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.Int16)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.Int16":
- case "System.Int16&":
- return true; }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_I2);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_I2);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I2);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString()) {
- case "System.Int16":
- case "System.Int16&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Int16 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.Int16 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.Int16 value);
- }
-}
diff --git a/mono/DBusType/Int32.cs b/mono/DBusType/Int32.cs
deleted file mode 100644
index 868d4335..00000000
--- a/mono/DBusType/Int32.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 32-bit integer.
- /// </summary>
- public class Int32 : IDBusType
- {
- public const char Code = 'i';
- private System.Int32 val;
-
- private Int32()
- {
- }
-
- public Int32(System.Int32 val, Service service)
- {
- this.val = val;
- }
-
- public Int32(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append INT32 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.Int32)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.Int32":
- case "System.Int32&":
- return true; }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_I4);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_I4);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I4);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString()) {
- case "System.Int32":
- case "System.Int32&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Int32 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.Int32 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.Int32 value);
- }
-}
diff --git a/mono/DBusType/Int64.cs b/mono/DBusType/Int64.cs
deleted file mode 100644
index 47c066bc..00000000
--- a/mono/DBusType/Int64.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 64-bit integer.
- /// </summary>
- public class Int64 : IDBusType
- {
- public const char Code = 'x';
- private System.Int64 val;
-
- private Int64()
- {
- }
-
- public Int64(System.Int64 val, Service service)
- {
- this.val = val;
- }
-
- public Int64(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append INT64 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.Int64)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.Int64":
- case "System.Int64&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_I8);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_I8);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I8);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString()) {
- case "System.Int64":
- case "System.Int64&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.Int64 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.Int64 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.Int64 value);
- }
-}
diff --git a/mono/DBusType/ObjectPath.cs b/mono/DBusType/ObjectPath.cs
deleted file mode 100644
index 4f064d59..00000000
--- a/mono/DBusType/ObjectPath.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// An object path.
- /// </summary>
- public class ObjectPath : IDBusType
- {
- public const char Code = 'o';
- private string path = null;
- private object val = null;
- private Service service = null;
-
- private ObjectPath()
- {
- }
-
- public ObjectPath(object val, Service service)
- {
- this.val = val;
- this.service = service;
- }
-
- public ObjectPath(IntPtr iter, Service service)
- {
- IntPtr raw;
-
- dbus_message_iter_get_basic (iter, out raw);
-
- this.path = Marshal.PtrToStringAnsi (raw);
- this.service = service;
- }
-
- private string Path
- {
- get {
- if (this.path == null && this.val != null) {
- Handler handler = this.service.GetHandler(this.val);
- this.path = handler.Path;
- }
-
- return this.path;
- }
- }
-
- public void Append(IntPtr iter)
- {
- IntPtr marshalVal = Marshal.StringToHGlobalAnsi (Path);
-
- bool success = dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal);
- Marshal.FreeHGlobal (marshalVal);
-
- if (!success)
- throw new ApplicationException("Failed to append OBJECT_PATH argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- object[] attributes = type.GetCustomAttributes(typeof(InterfaceAttribute), false);
- if (attributes.Length == 1) {
- return true;
- } else {
- return false;
- }
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_Ref);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Castclass, type);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_Ref);
- }
- }
-
- public object Get()
- {
- throw new ArgumentException("Cannot call Get on an ObjectPath without specifying type.");
- }
-
- public object Get(System.Type type)
- {
- try {
- return this.service.GetObject(type, Path);
- } catch(Exception ex) {
- throw new ArgumentException("Cannot cast object pointed to by Object Path to type '" + type.ToString() + "': " + ex);
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out IntPtr path);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref IntPtr path);
- }
-}
diff --git a/mono/DBusType/String.cs b/mono/DBusType/String.cs
deleted file mode 100644
index 3b619cfb..00000000
--- a/mono/DBusType/String.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// A string.
- /// </summary>
- public class String : IDBusType
- {
- public const char Code = 's';
- private string val;
-
- private String()
- {
- }
-
- public String(string val, Service service)
- {
- this.val = val;
- }
-
- public String(IntPtr iter, Service service)
- {
- IntPtr raw;
-
- dbus_message_iter_get_basic (iter, out raw);
-
- this.val = Marshal.PtrToStringAnsi (raw);
- }
-
- public void Append(IntPtr iter)
- {
- IntPtr marshalVal = Marshal.StringToHGlobalAnsi (val);
-
- bool success = dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal);
- Marshal.FreeHGlobal (marshalVal);
-
- if (!success)
- throw new ApplicationException("Failed to append STRING argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- switch (type.ToString()) {
- case "System.String":
- case "System.String&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_Ref);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Castclass, type);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_Ref);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- switch (type.ToString())
- {
- case "System.String":
- case "System.String&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.String to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out IntPtr value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref IntPtr value);
- }
-}
diff --git a/mono/DBusType/UInt16.cs b/mono/DBusType/UInt16.cs
deleted file mode 100644
index 73132875..00000000
--- a/mono/DBusType/UInt16.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 16-bit integer.
- /// </summary>
- public class UInt16 : IDBusType
- {
- public const char Code = 'q';
- private System.UInt16 val;
-
- private UInt16()
- {
- }
-
- public UInt16(System.UInt16 val, Service service)
- {
- this.val = val;
- }
-
- public UInt16(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append INT16 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.UInt16)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.UInt16":
- case "System.UInt16&":
- return true; }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_U2);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_U2);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I2);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString()) {
- case "System.UInt16":
- case "System.UInt16&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.UInt16 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.UInt16 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.UInt16 value);
- }
-}
diff --git a/mono/DBusType/UInt32.cs b/mono/DBusType/UInt32.cs
deleted file mode 100644
index 5bb31217..00000000
--- a/mono/DBusType/UInt32.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 32-bit unsigned integer.
- /// </summary>
- public class UInt32 : IDBusType
- {
- public const char Code = 'u';
- private System.UInt32 val;
-
- private UInt32()
- {
- }
-
- public UInt32(System.UInt32 val, Service service)
- {
- this.val = val;
- }
-
- public UInt32(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append UINT32 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.UInt32)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.UInt32":
- case "System.UInt32&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_U4);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_U4);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I4);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString())
- {
- case "System.UInt32":
- case "System.UInt32&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.UInt32 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.UInt32 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.UInt32 value);
- }
-}
diff --git a/mono/DBusType/UInt64.cs b/mono/DBusType/UInt64.cs
deleted file mode 100644
index ef689f2a..00000000
--- a/mono/DBusType/UInt64.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Reflection.Emit;
-
-using DBus;
-
-namespace DBus.DBusType
-{
- /// <summary>
- /// 64-bit unsigned integer.
- /// </summary>
- public class UInt64 : IDBusType
- {
- public const char Code = 't';
- private System.UInt64 val;
-
- private UInt64()
- {
- }
-
- public UInt64(System.UInt64 val, Service service)
- {
- this.val = val;
- }
-
- public UInt64(IntPtr iter, Service service)
- {
- dbus_message_iter_get_basic (iter, out this.val);
- }
-
- public void Append(IntPtr iter)
- {
- if (!dbus_message_iter_append_basic (iter, (int) Code, ref val))
- throw new ApplicationException("Failed to append UINT64 argument:" + val);
- }
-
- public static bool Suits(System.Type type)
- {
- if (type.IsEnum && Enum.GetUnderlyingType (type) == typeof(System.UInt64)) {
- return true;
- }
-
- switch (type.ToString()) {
- case "System.UInt64":
- case "System.UInt64&":
- return true;
- }
-
- return false;
- }
-
- public static void EmitMarshalIn(ILGenerator generator, Type type)
- {
- if (type.IsByRef) {
- generator.Emit(OpCodes.Ldind_I8);
- }
- }
-
- public static void EmitMarshalOut(ILGenerator generator, Type type, bool isReturn)
- {
- generator.Emit(OpCodes.Unbox, type);
- generator.Emit(OpCodes.Ldind_I8);
- if (!isReturn) {
- generator.Emit(OpCodes.Stind_I8);
- }
- }
-
- public object Get()
- {
- return this.val;
- }
-
- public object Get(System.Type type)
- {
- if (type.IsEnum) {
- return Enum.ToObject(type, this.val);
- }
-
- switch (type.ToString())
- {
- case "System.UInt64":
- case "System.UInt64&":
- return this.val;
- default:
- throw new ArgumentException("Cannot cast DBus.Type.UInt64 to type '" + type.ToString() + "'");
- }
- }
-
- [DllImport("dbus-1")]
- private extern static void dbus_message_iter_get_basic (IntPtr iter, out System.UInt64 value);
-
- [DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_basic (IntPtr iter, int type, ref System.UInt64 value);
- }
-}