/** * Test doesPropertyExist, deleteProperty, and related methods. * @param meta a predefined <code>XmpMeta</code> object. */ private static void CoverExistingProperties(IXmpMeta meta) { writeMajorLabel("Test doesPropertyExist, deleteProperty, and related methods"); printXmpMeta(meta, "XMP object"); log.WriteLine("doesPropertyExist ns1:Prop = " + meta.DoesPropertyExist(TestData.NS1, "Prop")); log.WriteLine("doesPropertyExist ns1:Struct = " + meta.DoesPropertyExist(TestData.NS1, "ns1:Struct")); log.WriteLine("doesArrayItemExist ns1:Bag[2] = " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 2)); log.WriteLine("doesArrayItemExist ns1:Seq[last()] = " + meta.DoesArrayItemExist(TestData.NS1, "ns1:Seq", XmpConstants.ArrayLastItem)); log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Field1 = " + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Field1")); log.WriteLine("doesQualifierExist ns1:QualProp1/?ns2:Qual1 = " + meta.DoesQualifierExist(TestData.NS1, "QualProp1", TestData.NS2, "Qual1")); log.WriteLine("doesQualifierExist ns1:QualProp2/?xml:lang = " + meta.DoesQualifierExist(TestData.NS1, "QualProp2", XmpConstants.NsXml, "lang")); log.WriteLine(); log.WriteLine("doesPropertyExist (namespace is null) = " + meta.DoesPropertyExist(null, "ns1:Bag")); log.WriteLine("doesArrayItemExist (namespace is null) = " + meta.DoesArrayItemExist(null, "ns1:Bag", XmpConstants.ArrayLastItem)); log.WriteLine("doesQualifierExist ns:Bogus (namespace not existing) = " + meta.DoesPropertyExist("ns:bogus/", "Bogus")); log.WriteLine("doesPropertyExist ns1:Bogus = " + meta.DoesPropertyExist(TestData.NS1, "Bogus")); log.WriteLine("doesArrayItemExist ns1:Bag[99] = " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 99)); log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Bogus = " + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Bogus")); log.WriteLine("doesQualifierExist ns1:Prop/?ns2:Bogus = " + meta.DoesQualifierExist(TestData.NS1, "Prop", TestData.NS2, "Bogus")); }
private void ParseExtendedDirectory(IXmpMeta meta) { try { if (ImageMime != null && meta.DoesPropertyExist(nsImage, "GImage:Data")) { ImageData = GetPropertyBase64(meta, nsImage, "GImage:Data"); } if (AudioMime != null && meta.DoesPropertyExist(nsAudio, "GAudio:Data")) { AudioData = GetPropertyBase64(meta, nsAudio, "GAudio:Data"); } } catch { } }
private void ParseDirectory(IXmpMeta meta) { try { PanoCroppedAreaLeftPixels = meta.GetPropertyInteger(nsPano, "GPano:CroppedAreaLeftPixels"); PanoCroppedAreaTopPixels = meta.GetPropertyInteger(nsPano, "GPano:CroppedAreaTopPixels"); PanoCroppedAreaImageWidthPixels = meta.GetPropertyInteger(nsPano, "GPano:CroppedAreaImageWidthPixels"); PanoCroppedAreaImageHeightPixels = meta.GetPropertyInteger(nsPano, "GPano:CroppedAreaImageHeightPixels"); PanoFullPanoWidthPixels = meta.GetPropertyInteger(nsPano, "GPano:FullPanoWidthPixels"); PanoFullPanoHeightPixels = meta.GetPropertyInteger(nsPano, "GPano:FullPanoHeightPixels"); PanoInitialViewHeadingDegrees = meta.GetPropertyInteger(nsPano, "GPano:InitialViewHeadingDegrees"); ImageMime = meta.GetPropertyString(nsImage, "GImage:Mime"); if (meta.DoesPropertyExist(nsAudio, "GAudio:Mime")) { AudioMime = meta.GetPropertyString(nsAudio, "GAudio:Mime"); } } catch { // Silent catch. Not sure what to do. } }
/** * Test doesPropertyExist, deleteProperty, and related methods. * @param meta a predefined <code>XmpMeta</code> object. */ private static void CoverExistingProperties(IXmpMeta meta) { writeMajorLabel ("Test doesPropertyExist, deleteProperty, and related methods"); printXmpMeta (meta, "XMP object"); log.WriteLine("doesPropertyExist ns1:Prop = " + meta.DoesPropertyExist(TestData.NS1, "Prop")); log.WriteLine("doesPropertyExist ns1:Struct = " + meta.DoesPropertyExist(TestData.NS1, "ns1:Struct")); log.WriteLine("doesArrayItemExist ns1:Bag[2] = " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 2)); log.WriteLine("doesArrayItemExist ns1:Seq[last()] = " + meta.DoesArrayItemExist(TestData.NS1, "ns1:Seq", XmpConstants.ArrayLastItem)); log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Field1 = " + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Field1")); log.WriteLine("doesQualifierExist ns1:QualProp1/?ns2:Qual1 = " + meta.DoesQualifierExist(TestData.NS1, "QualProp1", TestData.NS2, "Qual1")); log.WriteLine("doesQualifierExist ns1:QualProp2/?xml:lang = " + meta.DoesQualifierExist(TestData.NS1, "QualProp2", XmpConstants.NsXml, "lang")); log.WriteLine(); log.WriteLine("doesPropertyExist (namespace is null) = " + meta.DoesPropertyExist(null, "ns1:Bag")); log.WriteLine("doesArrayItemExist (namespace is null) = " + meta.DoesArrayItemExist(null, "ns1:Bag", XmpConstants.ArrayLastItem)); log.WriteLine("doesQualifierExist ns:Bogus (namespace not existing) = " + meta.DoesPropertyExist("ns:bogus/", "Bogus")); log.WriteLine("doesPropertyExist ns1:Bogus = " + meta.DoesPropertyExist(TestData.NS1, "Bogus")); log.WriteLine("doesArrayItemExist ns1:Bag[99] = " + meta.DoesArrayItemExist(TestData.NS1, "Bag", 99)); log.WriteLine("doesStructFieldExist ns1:Struct/ns2:Bogus = " + meta.DoesStructFieldExist(TestData.NS1, "Struct", TestData.NS2, "Bogus")); log.WriteLine("doesQualifierExist ns1:Prop/?ns2:Bogus = " + meta.DoesQualifierExist(TestData.NS1, "Prop", TestData.NS2, "Bogus")); }