Mono.Zeroconf – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | // Copyright 2006 Alp Toker <alp@atoker.com> |
2 | // This software is made available under the MIT License |
||
3 | // See COPYING for details |
||
4 | |||
5 | using System; |
||
6 | |||
7 | namespace NDesk.DBus |
||
8 | { |
||
9 | class MessageFilter |
||
10 | { |
||
11 | //this should probably be made to use HeaderField or similar |
||
12 | //this class is not generalized yet |
||
13 | |||
14 | public static string MessageTypeToString (MessageType mtype) |
||
15 | { |
||
16 | switch (mtype) |
||
17 | { |
||
18 | case MessageType.MethodCall: |
||
19 | return "method_call"; |
||
20 | case MessageType.MethodReturn: |
||
21 | return "method_return"; |
||
22 | case MessageType.Error: |
||
23 | return "error"; |
||
24 | case MessageType.Signal: |
||
25 | return "signal"; |
||
26 | case MessageType.Invalid: |
||
27 | return "invalid"; |
||
28 | default: |
||
29 | throw new Exception ("Bad MessageType: " + mtype); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | public static MessageType StringToMessageType (string text) |
||
34 | { |
||
35 | switch (text) |
||
36 | { |
||
37 | case "method_call": |
||
38 | return MessageType.MethodCall; |
||
39 | case "method_return": |
||
40 | return MessageType.MethodReturn; |
||
41 | case "error": |
||
42 | return MessageType.Error; |
||
43 | case "signal": |
||
44 | return MessageType.Signal; |
||
45 | case "invalid": |
||
46 | return MessageType.Invalid; |
||
47 | default: |
||
48 | throw new Exception ("Bad MessageType: " + text); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | //TODO: remove this -- left here for the benefit of the monitor tool for now |
||
53 | public static string CreateMatchRule (MessageType mtype) |
||
54 | { |
||
55 | return "type='" + MessageTypeToString (mtype) + "'"; |
||
56 | } |
||
57 | } |
||
58 | } |