File: Introspect.cs

package info (click to toggle)
dbus-sharp 0.8.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 868 kB
  • sloc: cs: 7,690; sh: 494; makefile: 181
file content (35 lines) | stat: -rw-r--r-- 864 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using DBus;
using Schemas;

public class test
{
	public static void Main (string[] args)
	{
		string fname = args[0];
		StreamReader sr = new StreamReader (fname);
		XmlSerializer sz = new XmlSerializer (typeof (Node));
		Node node = (Node)sz.Deserialize (sr);

		Interface iface = node.Interfaces[1];

		foreach (Method meth in iface.Methods) {
			Console.Write (meth.Name);
			Console.Write (" (");

			if (meth.Arguments != null)
			foreach (Argument arg in meth.Arguments)
				Console.Write ("[" + arg.Direction + "] " + arg.Type + " " + arg.Name + ", ");
			Console.Write (");");
			Console.WriteLine ();
		}
	}
}