コード例 #1
0
        public override void Prepare(bool resume)
        {
            try
            {
                // Create the process start information.
                Process process = new Process();
                if (Config.Instance.DaemonToolsLocation.ToLower().EndsWith("vcdmount.exe"))
                    process.StartInfo.Arguments = "-mount \"" + path + "\"";
                else
                    process.StartInfo.Arguments = "-mount 0,\"" + path + "\"";
                process.StartInfo.FileName = Config.Instance.DaemonToolsLocation;
                process.StartInfo.ErrorDialog = false;
                process.StartInfo.CreateNoWindow = true;

                // We wait for exit to ensure the iso is completely loaded.
                process.Start();
                process.WaitForExit();

                // Play the DVD video that was mounted.
                this.mountedFilename = Config.Instance.DaemonToolsDrive + ":\\";
                if (!Config.Instance.UseAutoPlayForIso)
                    if (PlayableExternal.CanPlay(this.mountedFilename))
                        this.playableExternal = new PlayableExternal(this.mountedFilename);
            }
            catch (Exception)
            {
                // Display the error in this case, they might wonder why it didn't work.
                Application.DisplayDialog("DaemonTools is not correctly configured.", "Could not load ISO");
                throw (new Exception("Daemon tools is not configured correctly"));
            }
        }
コード例 #2
0
        public override void Prepare(bool resume)
        {
            videoFiles = video.VideoFiles.ToList();
            if (videoFiles.Count == 1)
            {
                playListFile = videoFiles[0];
                if (PlayableExternal.CanPlay(playListFile))
                {
                    this.playableExternal = new PlayableExternal(playListFile);
                }
            }
            else
            {
                videoFiles.Sort();
                int pos = 0;
                if (resume)
                {
                    pos = PlayState.PlaylistPosition;
                }

                if (PlayableExternal.CanPlay(videoFiles[0]))
                {
                    playListFile = Path.Combine(ApplicationPaths.AutoPlaylistPath, video.Name + ".pls");
                    StringBuilder contents = new StringBuilder("[playlist]\n");
                    int           x        = 1;
                    foreach (string file in videoFiles)
                    {
                        if (pos > 0)
                        {
                            pos--;
                        }
                        else
                        {
                            contents.Append("File" + x + "=" + file + "\n");
                            contents.Append("Title" + x + "=Part " + x + "\n\n");
                        }
                        x++;
                    }
                    contents.Append("Version=2\n");

                    System.IO.File.WriteAllText(playListFile, contents.ToString());
                    this.playableExternal = new PlayableExternal(playListFile);
                }
                else
                {
                    playListFile = CreateWPLPlaylist(video.Name, videoFiles.Skip(pos));
                }
            }
        }
コード例 #3
0
        public override void Prepare(bool resume)
        {
            try
            {
                // Create the process start information.
                Process process = new Process();
                //virtualclonedrive
                if (Config.Instance.DaemonToolsLocation.ToLower().EndsWith("vcdmount.exe"))
                {
                    process.StartInfo.Arguments = "-mount \"" + path + "\"";
                }
                //alcohol120 or alcohol52
                else if (Config.Instance.DaemonToolsLocation.ToLower().EndsWith("axcmd.exe"))
                {
                    process.StartInfo.Arguments = Config.Instance.DaemonToolsDrive + ":\\ /M:\"" + path + "\"";
                }
                //deamontools
                else
                {
                    process.StartInfo.Arguments = "-mount 0,\"" + path + "\"";
                }
                process.StartInfo.FileName       = Config.Instance.DaemonToolsLocation;
                process.StartInfo.ErrorDialog    = false;
                process.StartInfo.CreateNoWindow = true;

                // We wait for exit to ensure the iso is completely loaded.
                process.Start();
                process.WaitForExit();

                // Play the DVD video that was mounted.
                this.mountedFilename = Config.Instance.DaemonToolsDrive + ":\\";
                if (!Config.Instance.UseAutoPlayForIso)
                {
                    if (PlayableExternal.CanPlay(this.mountedFilename))
                    {
                        this.playableExternal = new PlayableExternal(this.mountedFilename);
                    }
                }
            }
            catch (Exception)
            {
                // Display the error in this case, they might wonder why it didn't work.
                Application.DisplayDialog("ISO Mounter is not correctly configured.", "Could not load ISO");
                throw (new Exception("ISO Mounter is not configured correctly"));
            }
        }
        public override void Prepare(bool resume)
        {
            musicFiles = music.MusicFiles.ToList();
            if (musicFiles.Count == 1)
            {
                playListFile = musicFiles[0];
                if (PlayableExternal.CanPlay(playListFile))
                    this.playableExternal = new PlayableExternal(playListFile);
            }
            else
            {
                musicFiles.Sort();
                int pos = 0;
                if (resume)
                    pos = PlayState.PlaylistPosition;

                if (PlayableExternal.CanPlay(musicFiles[0]))
                {
                    playListFile = Path.Combine(ApplicationPaths.AutoPlaylistPath, music.Name + ".pls");
                    StringBuilder contents = new StringBuilder("[playlist]\n");
                    int x = 1;
                    foreach (string file in musicFiles)
                    {
                        if (pos > 0)
                            pos--;
                        else
                        {
                            contents.Append("File" + x + "=" + file + "\n");
                            contents.Append("Title" + x + "=Part " + x + "\n\n");
                        }
                        x++;
                    }
                    contents.Append("Version=2\n");

                    System.IO.File.WriteAllText(playListFile, contents.ToString());
                    this.playableExternal = new PlayableExternal(playListFile);
                }
                else
                {
                    playListFile = CreateWPLPlaylist(music.Name, musicFiles.Skip(pos));
                }
            }
        }
コード例 #5
0
        public PlayableItem Create(Video video)
        {
            PlayableItem playable = null;

            if (PlayableExternal.CanPlay(video.Path))
                playable = new PlayableExternal(video.Path);
            else if (PlayableVideoFile.CanPlay(video))
                playable = new PlayableVideoFile(video);
            else if (PlayableIso.CanPlay(video))
                playable = new PlayableIso(video);
            else if (PlayableMultiFileVideo.CanPlay(video))
                playable = new PlayableMultiFileVideo(video);
            else if (PlayableDvd.CanPlay(video))
                playable = new PlayableDvd(video);

            foreach (var controller in Kernel.Instance.PlaybackControllers) {
                if (controller.CanPlay(playable.Filename)) {
                    playable.PlaybackController = controller;
                }
            }

            return playable;
        }