コード例 #1
0
        public void Dispose()
        {
            if (myLibVlcDllHandle != IntPtr.Zero)
            {
                Win32Interop.FreeLibrary(myLibVlcDllHandle);
                myLibVlcDllHandle = IntPtr.Zero;
            }
            if (myLibVlcCoreDllHandle != IntPtr.Zero)
            {
                Win32Interop.FreeLibrary(myLibVlcCoreDllHandle);
                myLibVlcCoreDllHandle = IntPtr.Zero;
            }
            NewInstance = null;
            ReleaseInstance = null;
            RetainInstance = null;
            AddInterface = null;
            SetExitCallback = null;
            Wait = null;
            SetUserAgent = null;
            GetVersion = null;
            GetCompiler = null;
            GetChangeSet = null;
            FreeMemory = null;
            //GetModuleDescriptionList = null;
            //ReleaseModule = null;

            if (EventInterops != null)
                EventInterops.Dispose();
            EventInterops = null;
            if (MediaPlayerInterops != null)
                MediaPlayerInterops.Dispose();
            MediaPlayerInterops = null;
            if (MediaInterops != null)
                MediaInterops.Dispose();
            MediaInterops = null;
            if (MediaListInterops != null)
                MediaListInterops.Dispose();
            MediaListInterops = null;
            if (AudioInterops != null)
                AudioInterops.Dispose();
            AudioInterops = null;
            if (VideoInterops != null)
                VideoInterops.Dispose();
            VideoInterops = null;
            if (LoggingInterops != null)
                LoggingInterops.Dispose();
            LoggingInterops = null;
            if (MediaListPlayerInterops != null)
                MediaListPlayerInterops.Dispose();
            MediaListPlayerInterops = null;
        }
コード例 #2
0
        public void Dispose()
        {
            if (myLibVlcDllHandle != IntPtr.Zero)
            {
                Win32Interop.FreeLibrary(myLibVlcDllHandle);
                myLibVlcDllHandle = IntPtr.Zero;
            }
            if (myLibVlcCoreDllHandle != IntPtr.Zero)
            {
                Win32Interop.FreeLibrary(myLibVlcCoreDllHandle);
                myLibVlcCoreDllHandle = IntPtr.Zero;
            }
            NewInstance     = null;
            ReleaseInstance = null;
            RetainInstance  = null;
            AddInterface    = null;
            SetExitCallback = null;
            Wait            = null;
            SetUserAgent    = null;
            GetVersion      = null;
            GetCompiler     = null;
            GetChangeSet    = null;
            FreeMemory      = null;
            //GetModuleDescriptionList = null;
            //ReleaseModule = null;

            if (EventInterops != null)
            {
                EventInterops.Dispose();
            }
            EventInterops = null;
            if (MediaPlayerInterops != null)
            {
                MediaPlayerInterops.Dispose();
            }
            MediaPlayerInterops = null;
            if (MediaInterops != null)
            {
                MediaInterops.Dispose();
            }
            MediaInterops = null;
            if (MediaListInterops != null)
            {
                MediaListInterops.Dispose();
            }
            MediaListInterops = null;
            if (AudioInterops != null)
            {
                AudioInterops.Dispose();
            }
            AudioInterops = null;
            if (VideoInterops != null)
            {
                VideoInterops.Dispose();
            }
            VideoInterops = null;
            if (LoggingInterops != null)
            {
                LoggingInterops.Dispose();
            }
            LoggingInterops = null;
            if (MediaListPlayerInterops != null)
            {
                MediaListPlayerInterops.Dispose();
            }
            MediaListPlayerInterops = null;

#if !SILVERLIGHT
            bool contains;
            do
            {
                foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
                {
                    if (
                        !(module.FileName.StartsWith(myLibVlcDllsDirectory, StringComparison.CurrentCultureIgnoreCase) &&
                          module.FileName.EndsWith("_plugin.dll")))
                    {
                        continue;
                    }
                    Win32Interop.FreeLibrary(module.BaseAddress);
                }
                contains = false;
                foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
                {
                    if (!module.FileName.StartsWith(myLibVlcDllsDirectory, StringComparison.CurrentCultureIgnoreCase) ||
                        !module.FileName.EndsWith("_plugin.dll"))
                    {
                        continue;
                    }

                    contains = true;
                    break;
                }
            }while (contains);
            foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
            {
                if (!module.FileName.StartsWith(myLibVlcDllsDirectory, StringComparison.CurrentCultureIgnoreCase))
                {
                    continue;
                }
                Win32Interop.FreeLibrary(module.BaseAddress);
            }
#endif
        }