예제 #1
0
        private void ParseWithChapters(string line)
        {
            var    splitLine    = line.Split('|');
            string title        = "";
            bool   isActive     = false;
            var    skipChapters = new List <int>();

            if (splitLine[0].StartsWith(ActiveIndicator))
            {
                title    = splitLine[0].Substring(ActiveIndicator.Length).Trim();
                isActive = true;
            }
            else if (line.StartsWith(InactiveIndicator))
            {
                title    = splitLine[0].Substring(InactiveIndicator.Length).Trim();
                isActive = false;
            }
            else
            {
                throw new FileLoadException();
            }

            if (splitLine[1].Length > 0)
            {
                splitLine[1] = splitLine[1].Substring(splitLine[1].IndexOf(':') + 1).Trim();
                skipChapters = new List <int>(splitLine[1].Split(',').Select(int.Parse));
            }

            var endChapter = int.Parse(splitLine[2].Substring(splitLine[2].IndexOf(':') + 1).Trim());

            Playlist.Add(new PlaylistItem(title, skipChapters, endChapter, isActive));
        }
예제 #2
0
        public void ActiveFile(string fileName)
        {
            ResetActive();
            var item = new PlaylistItem(fileName, true);

            ClearPlaylist();
            Playlist.Add(item);
            CurrentItem = item;
            PopulatePlaylist();

            Text = PlayerControl.PlayerState + " ─ " + CurrentItem.FilePath;
        }
예제 #3
0
        private void ParseWithoutChapters(string line)
        {
            string title    = "";
            bool   isActive = false;

            if (line.StartsWith(ActiveIndicator))
            {
                title    = line.Substring(ActiveIndicator.Length).Trim();
                isActive = true;
            }
            else if (line.StartsWith(InactiveIndicator))
            {
                title = line.Substring(InactiveIndicator.Length).Trim();
            }
            else
            {
                throw new FileLoadException();
            }
            Playlist.Add(new PlaylistItem(title, isActive));
        }
예제 #4
0
        public void AddActiveFile(string fileName)
        {
            var foundFile = Playlist.Find(i => i.FilePath == fileName);

            if (foundFile != null)
            {
                return;
            }

            ResetActive();
            var item = new PlaylistItem(fileName, true)
            {
                EndChapter = -1
            };

            Playlist.Add(item);
            CurrentItem = item;
            PopulatePlaylist();

            Text = PlayerControl.PlayerState + " ─ " + CurrentItem.FilePath;
        }
예제 #5
0
        public void AddFiles(string[] fileNames)
        {
            foreach (var item in fileNames.Select(s => new PlaylistItem(s, false)
            {
                EndChapter = -1
            }))
            {
                Playlist.Add(item);
            }

            if (dgv_PlayList.CurrentRow != null)
            {
                selectedRowIndex = dgv_PlayList.CurrentRow.Index;
            }

            PopulatePlaylist();

            if (selectedRowIndex < 0)
            {
                selectedRowIndex = 0;
            }
            else if (selectedRowIndex > Playlist.Count - 1)
            {
                selectedRowIndex = Playlist.Count - 1;
            }

            dgv_PlayList.CurrentCell = dgv_PlayList.Rows[selectedRowIndex].Cells[titleCellIndex];

            if (!AutomaticallyPlayFileOnStartup)
            {
                return;
            }

            currentPlayIndex = Playlist.Count > 0 ? Playlist.Count - 1 : 0;
            OpenMedia();
        }