void getVideoProperties(ObservableCollection <Tuple <String, String> > p, VideoMetadata video) { p.Add(new Tuple <string, string>("", "VIDEO")); p.Add(new Tuple <string, string>("Video Codec", video.VideoCodec)); foreach (Tuple <string, string> item in FormatMetaData.formatProperties(video)) { p.Add(item); } p.Add(new Tuple <string, string>("Resolution", video.Width.ToString() + " x " + video.Height.ToString())); p.Add(new Tuple <string, string>("Pixel Format", video.PixelFormat)); p.Add(new Tuple <string, string>("Bits Per Pixel", video.BitsPerPixel.ToString())); p.Add(new Tuple <string, string>("Frames Per Second", video.FramesPerSecond.ToString("0.##"))); if (video.VideoBitRate.HasValue) { p.Add(new Tuple <string, string>("Video Rate", MiscUtils.formatSizeBytes(video.VideoBitRate.Value / 8) + "/s")); } if (!String.IsNullOrEmpty(video.AudioCodec)) { p.Add(new Tuple <string, string>("", "AUDIO")); p.Add(new Tuple <string, string>("Audio Codec", video.AudioCodec)); p.Add(new Tuple <string, string>("Bits Per Sample", video.BitsPerSample.ToString())); p.Add(new Tuple <string, string>("Samples Per Second", video.SamplesPerSecond.ToString())); p.Add(new Tuple <string, string>("Nr Channels", video.NrChannels.ToString())); if (video.AudioBitRate.HasValue) { p.Add(new Tuple <string, string>("Audio Rate", MiscUtils.formatSizeBytes(video.AudioBitRate.Value / 8) + "/s")); } } p.Add(new Tuple <string, string>("", "FILE")); p.Add(new Tuple <string, string>("Container", video.VideoContainer)); p.Add(new Tuple <string, string>("Duration", MiscUtils.formatTimeSeconds(video.DurationSeconds))); }
List <MetaDataNameValue> nodeChildrenToPathValue(MetaDataTreeNode node) { List <MetaDataNameValue> items = new List <MetaDataNameValue>(); foreach (MetaDataTreeNode n in node.Child) { MetaDataNameValue item = new MetaDataNameValue(); item.Name = n.ToString(); item.Node = n; item.IconPath = "pack://application:,,,/Resources/Icons/prop.ico"; if (n.NodeType == MetaDataTreeNode.Type.NAMESPACE) { item.IconPath = "pack://application:,,,/Resources/Icons/namespace.ico"; item.NodeType = "Namespace"; } else if (n.NodeType == MetaDataTreeNode.Type.ARRAY) { item.IconPath = "pack://application:,,,/Resources/Icons/array.ico"; item.NodeType = "Array"; } else if (n.NodeType == MetaDataTreeNode.Type.PROPERTY) { MetaDataTreeProperty prop = (MetaDataTreeProperty)n; if (String.IsNullOrEmpty(prop.Value)) { continue; } item.Name = FormatMetaData.formatPropertyName(prop.ToString()); item.Value = FormatMetaData.formatPropertyValue(prop.Path, prop.Value); item.NodeType = "Property"; } else if (n.NodeType == MetaDataTreeNode.Type.VALUE) { if (n.Parent.NodeType == MetaDataTreeNode.Type.PROPERTY) { continue; } item.Name = ""; item.Value = FormatMetaData.formatPropertyValue(n.Path, n.Data); item.IconPath = "pack://application:,,,/Resources/Icons/constprop.ico"; item.NodeType = "Value"; } else if (n.NodeType == MetaDataTreeNode.Type.LANGUAGE) { item.Name = "Language"; item.Value = n.ToString(); item.NodeType = "Language"; item.IconPath = "pack://application:,,,/Resources/Icons/language.ico"; } if (n.Parent != null && n.Parent.NodeType == MetaDataTreeNode.Type.ARRAY) { MetaDataTreeArray arr = (MetaDataTreeArray)(n.Parent); item.Value = FormatMetaData.formatPropertyValue(n.Path, n.Data); item.IconPath = "pack://application:,,,/Resources/Icons/constprop.ico"; item.NodeType = "Value"; int i = arr.getChildIndex(n); item.Name = "[" + Convert.ToString(i) + "] " + item.Name; } items.Add(item); } return(items); }
private void getExifProperties(ObservableCollection <Tuple <string, string> > p, BaseMetadata media) { p.Add(new Tuple <string, string>("Size", MediaViewer.Model.Utils.MiscUtils.formatSizeBytes(media.SizeBytes))); if (media.FileDate != null) { p.Add(new Tuple <string, string>("File Date", media.FileDate.ToString())); } if (media.LastModifiedDate != null) { p.Add(new Tuple <string, string>("File Modified", media.LastModifiedDate.ToString())); } int nrProps = p.Count; if (media.Software != null) { p.Add(new Tuple <string, string>("Software", media.Software)); } if (media.MetadataDate != null) { p.Add(new Tuple <string, string>("Metadata Date", media.MetadataDate.ToString())); } if (media.MetadataModifiedDate != null) { p.Add(new Tuple <string, string>("Metadata Modified", media.MetadataModifiedDate.ToString())); } if (media is ImageMetadata) { foreach (Tuple <string, string> item in FormatMetaData.formatProperties(media as ImageMetadata)) { p.Add(item); } } else if (media is AudioMetadata) { AudioMetadata audio = media as AudioMetadata; if (audio.Genre != null) { p.Add(new Tuple <string, string>("Genre", audio.Genre)); } if (audio.Album != null) { p.Add(new Tuple <string, string>("Album", audio.Album)); } if (audio.TrackNr != null) { String value = audio.TrackNr.ToString(); if (audio.TotalTracks != null) { value += " / " + audio.TotalTracks; } p.Add(new Tuple <string, string>("Track", value)); } if (audio.DiscNr != null) { String value = audio.DiscNr.ToString(); if (audio.TotalDiscs != null) { value += " / " + audio.TotalDiscs; } p.Add(new Tuple <string, string>("Disc", value)); } } if (media.Latitude != null) { p.Add(new Tuple <string, string>("GPS Latitude", media.Latitude.Value.ToString("0.00000"))); } if (media.Longitude != null) { p.Add(new Tuple <string, string>("GPS Longitude", media.Longitude.Value.ToString("0.00000"))); } if (p.Count > nrProps) { p.Insert(nrProps, new Tuple <string, string>("", "EXIF")); } }