3 * @brief LibVLC exceptions
7 /**********************************************************************
8 * Copyright (C) 2007-2009 RĂ©mi Denis-Courmont. *
9 * This program is free software; you can redistribute and/or modify *
10 * it under the terms of the GNU General Public License as published *
11 * by the Free Software Foundation; version 2 of the license, or (at *
12 * your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
17 * See the GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, you can get it from: *
21 * http://www.gnu.org/copyleft/gpl.html *
22 **********************************************************************/
25 using System.Runtime.InteropServices;
27 namespace VideoLAN.LibVLC
30 * @brief VLCException: base class for LibVLC exceptions
33 public class VLCException : Exception
36 * Creates a managed VLC exception.
38 public VLCException ()
43 * Creates a managed VLC exception.
44 * @param message exception error message
46 public VLCException (string message)
52 * Creates a managed VLC exception wrapping another exception.
53 * @param message exception error message
54 * @param inner inner wrapped exception
56 public VLCException (string message, Exception inner)
57 : base (message, inner)
67 * libvlc_exception_t: structure for unmanaged LibVLC exceptions
69 [StructLayout (LayoutKind.Sequential)]
70 public sealed class NativeException : IDisposable
76 [DllImport ("libvlc.dll", EntryPoint="libvlc_exception_init")]
77 private static extern void Init (NativeException e);
78 [DllImport ("libvlc.dll", EntryPoint="libvlc_exception_clear")]
79 private static extern void Clear (NativeException e);
80 /*[DllImport ("libvlc.dll",
81 EntryPoint="libvlc_exception_raised")]
82 private static extern int Raised (NativeException e);*/
83 [DllImport ("libvlc.dll",
84 EntryPoint="libvlc_exception_get_message")]
85 private static extern IntPtr GetMessage (NativeException e);
87 public NativeException ()
93 * Throws a managed exception if LibVLC has returned a native
94 * unmanaged exception. Clears the native exception.
100 string msg = U8String.FromNative (GetMessage (this));
102 throw new VLCException (msg);
110 /** IDisposable implementation. */
111 public void Dispose ()