private List <PropertyItem> AppendXMPData(XmpPacketWrapper xmpMetadata, List <PropertyItem> values) { if (xmpMetadata != null) { PropertyItem propertyItem; foreach (XmpPackage package in xmpMetadata.Packages) { foreach (KeyValuePair <string, XmpValueBase> pair in package) { XmpArray xmpArray = pair.Value as XmpArray; LangAlt langAlt = pair.Value as LangAlt; XmpComplexType xmpComplex = pair.Value as XmpComplexType; if (xmpArray != null) { propertyItem = new PropertyItem(pair.Key, pair.Key, false); if (!values.Contains(propertyItem)) { values.Add(propertyItem); } foreach (string arrayItem in xmpArray.Values) { propertyItem = new PropertyItem(arrayItem, arrayItem, false); if (!values.Contains(propertyItem)) { values.Add(propertyItem); } } } else if (langAlt != null) { propertyItem = new PropertyItem(pair.Key + langAlt.ToString(), langAlt.ToString(), false); if (!values.Contains(propertyItem)) { values.Add(propertyItem); } } else { propertyItem = new PropertyItem(pair.Key, pair.Value.ToString(), false); if (!values.Contains(propertyItem)) { values.Add(propertyItem); } } } } } return(values); }
public void LoadControl(XmpPacketWrapper xmpMetadata) { treeView1.Nodes.Clear(); if (xmpMetadata != null) { foreach (XmpPackage package in xmpMetadata.Packages) { treeView1.Nodes.Add(package.NamespaceUri, package.NamespaceUri); TreeNode treePackage = treeView1.Nodes[package.NamespaceUri]; foreach (KeyValuePair <string, XmpValueBase> pair in package) { XmpArray xmpArray = pair.Value as XmpArray; LangAlt langAlt = pair.Value as LangAlt; XmpComplexType xmpComplex = pair.Value as XmpComplexType; if (xmpArray != null) { treePackage.Nodes.Add(pair.Key, pair.Key); foreach (string arrayItem in xmpArray.Values) { treePackage.Nodes[pair.Key].Nodes.Add(arrayItem, arrayItem); } } else if (langAlt != null) { treePackage.Nodes.Add(pair.Key, pair.Key); treePackage.Nodes[pair.Key].Nodes.Add(pair.Key + langAlt.ToString(), langAlt.ToString()); } else { string xmpProperty = string.Format("{0} - {1}", pair.Key, pair.Value.ToString()); treePackage.Nodes.Add(pair.Key, xmpProperty); } } } } treeView1.ExpandAll(); }