コード例 #1
0
 private void StagingArea_PromotePlayer(object sender, ServerPlayer e)
 {
     // they are ready to join the game, they have BZDB
     ReleasePlayer?.Invoke(this, e);
 }
コード例 #2
0
ファイル: VlcPlayer.cs プロジェクト: deccer/SpyUO
        /// <summary>
        /// Initializes VLC.
        /// </summary>
        /// <param name="vlcInstallationFolder">VLC installation folder.</param>
        public static void Initialize(string vlcInstallationFolder)
        {
            if (_Inititalized)
            {
                return;
            }

            // Load dynamic dll
            string dllPath = Path.Combine(vlcInstallationFolder, "libvlccore.dll");

            if (!File.Exists(dllPath))
            {
                throw new Exception("Cannot find '" + dllPath + "'");
            }

            _CoreLibraryAddress = LoadLibrary(dllPath);

            if (_CoreLibraryAddress == IntPtr.Zero)
            {
                throw new Exception("Cannot load '" + dllPath + "'");
            }

            dllPath = Path.Combine(vlcInstallationFolder, "libvlc.dll");

            if (!File.Exists(dllPath))
            {
                throw new Exception("Cannot find '" + dllPath + "'");
            }

            _LibraryAddress = LoadLibrary(dllPath);

            if (_LibraryAddress == IntPtr.Zero)
            {
                throw new Exception("Cannot load '" + dllPath + "'");
            }

            if (GetVersion(vlcInstallationFolder) < RequiredVersion)
            {
                throw new Exception(String.Format("Invalid VLC version. Minimum version required is {0}", RequiredVersion));
            }

            // Get plugin folder
            _PluginsFolder = Path.Combine(vlcInstallationFolder, "plugins");

            if (!Directory.Exists(_PluginsFolder))
            {
                throw new Exception("Cannot find plugins folder '" + _PluginsFolder + "'");
            }

            _New                        = GetDelegate <New>("libvlc_new");
            _Release                    = GetDelegate <Release>("libvlc_release");
            _CreateMediaFromPath        = GetDelegate <CreateMediaFromPath>("libvlc_media_new_path");
            _ReleaseMedia               = GetDelegate <ReleaseMedia>("libvlc_media_release");
            _CreateMediaPlayerFromMedia = GetDelegate <CreateMediaPlayerFromMedia>("libvlc_media_player_new_from_media");
            _ReleasePlayer              = GetDelegate <ReleasePlayer>("libvlc_media_player_release");
            _IsPlayingMedia             = GetDelegate <IsPlayingMedia>("libvlc_media_player_play");
            _PlayMedia                  = GetDelegate <PlayMedia>("libvlc_media_player_play");
            _PauseMedia                 = GetDelegate <PauseMedia>("libvlc_media_player_pause");
            _StopMedia                  = GetDelegate <StopMedia>("libvlc_media_player_play");
            _GetMediaLength             = GetDelegate <GetMediaLength>("libvlc_media_player_get_length");
            _GetPlayerTime              = GetDelegate <GetPlayerTime>("libvlc_media_player_get_time");
            _SetPlayerTime              = GetDelegate <SetPlayerTime>("libvlc_media_player_set_time");
            _GetEventManager            = GetDelegate <GetEventManager>("libvlc_media_player_event_manager");
            _EventAttach                = GetDelegate <EventAttach>("libvlc_event_attach");

            _Inititalized = true;
        }