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
48 * Creates a managed VLC exception.
50 public VLCException ()
55 * Creates a managed VLC exception.
56 * @param message exception error message
58 public VLCException (string message)
64 * Creates a managed VLC exception wrapping another exception.
65 * @param message exception error message
66 * @param inner inner wrapped exception
68 public VLCException (string message, Exception inner)
69 : base (message, inner)
74 * Creates a VLC exception
75 * @param code VLC exception code
76 * @param message VLC exception message
78 public VLCException (int code, string message) : base (message)
84 * Creates a VLC exception
85 * @param code VLC exception code
87 public VLCException (int code) : base ()
94 * @brief NativeException: CIL representation for libvlc_exception_t.
97 [StructLayout (LayoutKind.Sequential)]
98 public sealed class NativeException : IDisposable
104 public NativeException ()
106 LibVLC.ExceptionInit (this);
110 * Throws a managed exception if LibVLC has returned a native
111 * unmanaged exception. Clears the native exception.
118 string msg = U8String.FromNative (message);
122 throw new VLCException (code, msg);
124 throw new VLCException (code);
128 LibVLC.ExceptionClear (this);
132 /** IDisposable implementation. */
133 public void Dispose ()
136 GC.SuppressFinalize (this);
144 private void Dispose (bool disposing)
146 LibVLC.ExceptionClear (this);