コード例 #1
0
        public void SetFile(string filepath)
        {
            originalTag = MatroskaLoader.ReadTag(filepath);
            if (ReferenceEquals(originalTag, null))
            {
                //clear textboxes
                txtXmlFilename.Text = string.Empty;
                dockXml.Visibility  = Visibility.Collapsed;
                txtFilename.Text    = filepath;

                textEditorOriginal.Text = string.Empty;
                ClearGUI();
            }
            else
            {
                txtXmlFilename.Text = string.Empty;
                dockXml.Visibility  = Visibility.Collapsed;
                txtFilename.Text    = filepath;

                textEditorOriginal.Text = MatroskaLoader.GetXML(originalTag);
                ClearGUI();
                UpdateGUI(originalTag);
            }
            saveButton.IsEnabled = false;
            UpdatePreview(null, null);
        }
コード例 #2
0
        private void UpdatePreview(object sender, TextChangedEventArgs e)
        {
            MatroskaTags tag = MatroskaLoader.Clone(originalTag);

            tag.Movie = UpdateTagFromGUI(tag.Movie);
            tag.Cleanup();

            textEditorNew.Text   = MatroskaLoader.GetXML(tag);
            saveButton.IsEnabled = true;
        }
コード例 #3
0
        private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lb = sender as ListBox;

            if (ReferenceEquals(lb, null))
            {
                return;
            }

            if (lb.SelectedItems.Count != 1)
            {
                return;
            }

            FileBasedLogEntry item = lb.SelectedItems[0] as FileBasedLogEntry;

            if (ReferenceEquals(item, null))
            {
                return;
            }

            string extension = Path.GetExtension(item.Filepath);

            if (extension == null)
            {
                return;
            }

            switch (extension.ToLower())
            {
            case ".xml":
            case ".mkv":
                //todo: make it async
                MatroskaTags tags = MatroskaLoader.ReadTag(item.Filepath);
                textEditor.Text = MatroskaLoader.GetXML(tags);
                break;
            }
        }
コード例 #4
0
        private void UpdatePreview(object sender, TextChangedEventArgs e)
        {
            textEditorNew.Text = string.Empty;

            MatroskaTags tag;

            if (!ReferenceEquals(originalTag, null))
            {
                string xmlString = MatroskaLoader.GetXML(originalTag);
                tag = MatroskaLoader.ReadTagFromXML(xmlString);
            }
            else
            {
                tag = new MatroskaTags();
            }

            #region Album

            if (!string.IsNullOrEmpty(albumArtist.Value))
            {
                tag.MusicVideo.AlbumArtist = albumArtist.Value;
            }

            if (!string.IsNullOrEmpty(albumTitle.Value))
            {
                tag.MusicVideo.AlbumTitle = albumTitle.Value;
            }

            if (!string.IsNullOrEmpty(albumReleaseDate.Value))
            {
                tag.MusicVideo.AlbumReleaseDate = albumReleaseDate.Value;
            }

            //if (albumReleaseDate.Value.HasValue)
            //{
            //  tag.MusicVideo.AlbumReleaseDate = albumReleaseDate.Value.Value;
            //}

            #endregion Album

            #region Track

            if (!string.IsNullOrEmpty(trackArtist.Value))
            {
                tag.MusicVideo.TrackArtist = trackArtist.Value;
            }

            if (!string.IsNullOrEmpty(trackTitle.Value))
            {
                tag.MusicVideo.TrackTitle = trackTitle.Value;
            }

            if (!string.IsNullOrEmpty(trackNumber.Value))
            {
                int index;
                if (int.TryParse(trackNumber.Value, out index))
                {
                    tag.MusicVideo.TrackNumber = index;
                }
            }

            if (!string.IsNullOrEmpty(trackReleaseDate.Value))
            {
                tag.MusicVideo.TrackReleaseDate = trackReleaseDate.Value;
            }

            if (trackGenre.Value.Count > 0)
            {
                tag.MusicVideo.GenreList = trackGenre.Value;
            }

            #endregion Track

            textEditorNew.Text   = MatroskaLoader.GetXML(tag);
            saveButton.IsEnabled = true;
        }