Example #1
0
        public void SetAutoplayHandler(IMediaPlayer mediaPlayer)
        {
            string handlerKeyName = mediaPlayer.GetHandlerName();
            string exePath = mediaPlayer.GetPath();
            string exeArgs = mediaPlayer.GetExeAutoplayArgs();
            string progId = mediaPlayer.GetProgId();
            string initCmdLine = mediaPlayer.GetInitCmdLine();
            string progName = mediaPlayer.GetName();

            WriteAutoplayHandler(DEFAULT_HANDLER_KEY_NAME, handlerKeyName);
            WriteAutoplayHandler(USER_HANDLER_KEY_NAME, handlerKeyName);

            string mpcHandlerKeyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\" + handlerKeyName;

            Write(Registry.ClassesRoot, progId + @"\Shell\PlayVideoFiles\Command", "\"" + exePath + "\" " + exeArgs);
            Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayBluRayOnArrival", handlerKeyName, "");
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "Action", "Play Blu-ray Video");
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "Provider", progName);
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "InvokeProgID", progId);
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "InvokeVerb", "PlayVideoFiles");
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "DefaultIcon", exePath + ",0");
            Write(Registry.LocalMachine, mpcHandlerKeyPath, "InitCmdLine", initCmdLine);
        }