Modified to support char type.
authorOwen Fraser-Green <owen@discobabe.net>
Wed, 24 Mar 2004 17:02:08 +0000 (17:02 +0000)
committerOwen Fraser-Green <owen@discobabe.net>
Wed, 24 Mar 2004 17:02:08 +0000 (17:02 +0000)
mono/DBusType/Byte.cs

index 1e083a9..d5068f2 100644 (file)
@@ -23,6 +23,11 @@ namespace DBus.DBusType
       this.val = val;
     }
 
+    public Byte(System.Char val, Service service) 
+    {
+      this.val = (byte) val;
+    }
+
     public Byte(IntPtr iter, Service service)
     {
       this.val = dbus_message_iter_get_byte(iter);
@@ -39,6 +44,8 @@ namespace DBus.DBusType
       switch (type.ToString()) {
       case "System.Byte":
       case "System.Byte&":
+      case "System.Char":
+      case "System.Char&":
        return true;
       }
       
@@ -72,6 +79,10 @@ namespace DBus.DBusType
       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() + "'");
       }