]> git.meshlink.io Git - catta/blob - avahi-sharp/ClientException.cs
f38f43803b6a4af1521f1eefef3c4312ff4500d3
[catta] / avahi-sharp / ClientException.cs
1
2 using System;
3 using System.Runtime.InteropServices;
4
5 namespace Avahi
6 {
7     public class ClientException : ApplicationException
8     {
9         private int code;
10
11         [DllImport ("avahi-common")]
12         private static extern IntPtr avahi_strerror (int code);
13         
14         public int ErrorCode
15         {
16             get { return code; }
17         }
18         
19         internal ClientException (int code) : base (GetErrorString (code))
20         {
21             this.code = code;
22         }
23
24         private static string GetErrorString (int code)
25         {
26             IntPtr str = avahi_strerror (code);
27             return Utility.PtrToString (str);
28         }
29     }
30 }