当前位置: 首页>>代码示例>>C#>>正文


C# File.GetTag方法代码示例

本文整理汇总了C#中File.GetTag方法的典型用法代码示例。如果您正苦于以下问题:C# File.GetTag方法的具体用法?C# File.GetTag怎么用?C# File.GetTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在File的用法示例。


在下文中一共展示了File.GetTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckExif

		public void CheckExif (File file) {
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("NIKON CORPORATION", tag.Make);
			Assert.AreEqual ("NIKON D90", tag.Model);
			Assert.AreEqual (200, tag.ISOSpeedRatings, "ISOSpeedRatings");
			Assert.AreEqual (1.0d/15.0d, tag.ExposureTime);
			Assert.AreEqual (5.6d, tag.FNumber);
			Assert.AreEqual (200.0d, tag.FocalLength);
			Assert.AreEqual (new DateTime (2009, 10, 21, 18, 55, 53), tag.DateTime);
			Assert.AreEqual (new DateTime (2009, 10, 21, 18, 55, 53), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2009, 10, 21, 18, 55, 53), tag.DateTimeOriginal);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:18,代码来源:JpegNikon3Test.cs

示例2: CheckExif

		public void CheckExif (File file) {
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("OLYMPUS CORPORATION", tag.Make);
			Assert.AreEqual ("C5060WZ", tag.Model);
			Assert.AreEqual (100, tag.ISOSpeedRatings);
			Assert.AreEqual (1.0d/250.0d, tag.ExposureTime);
			Assert.AreEqual (4.8d, tag.FNumber);
			Assert.AreEqual (22.9d, tag.FocalLength);
			Assert.AreEqual (new DateTime (2009, 03, 02, 17, 05, 32), tag.DateTime);
			Assert.AreEqual (new DateTime (2009, 03, 02, 17, 05, 32), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2009, 03, 02, 17, 05, 32), tag.DateTimeOriginal);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:18,代码来源:JpegOlympus2Test.cs

示例3: CheckMakerNote

		public void CheckMakerNote (File file) {
			IFDTag tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;
			Assert.IsNotNull (tag, "tag");

			var makernote_ifd =
				tag.ExifIFD.GetEntry (0, (ushort) ExifEntryTag.MakerNote) as MakernoteIFDEntry;

			Assert.IsNotNull (makernote_ifd, "makernote ifd");
			Assert.AreEqual (MakernoteType.Nikon3, makernote_ifd.MakernoteType);

			var structure = makernote_ifd.Structure;
			Assert.IsNotNull (structure, "structure");
			{
				var entry = structure.GetEntry (0, 0x01) as UndefinedIFDEntry;
				Assert.IsNotNull (entry);
				ByteVector read_bytes = entry.Data;
				ByteVector expected_bytes = new ByteVector (new byte [] {48, 50, 49, 48});

				Assert.AreEqual (expected_bytes.Count, read_bytes.Count);
				for (int i = 0; i < expected_bytes.Count; i++)
					Assert.AreEqual (expected_bytes[i], read_bytes[i]);
			}
			{
				var entry = structure.GetEntry (0, 0x05) as StringIFDEntry;
				Assert.IsNotNull (entry, "entry 0x05");
				Assert.AreEqual ("AUTO        ", entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x09) as StringIFDEntry;
				Assert.IsNotNull (entry, "entry 0x09");
				Assert.AreEqual ("                   ", entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x0B) as SShortArrayIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0B");
				var values = entry.Values;

				Assert.IsNotNull (values, "values of entry 0x0B");
				Assert.AreEqual (2, values.Length);
				Assert.AreEqual (0, values[0]);
				Assert.AreEqual (0, values[1]);
			}
			{
				var entry = structure.GetEntry (0, 0x84) as RationalArrayIFDEntry;
				Assert.IsNotNull (entry, "entry 0x84");
				var values = entry.Values;

				Assert.IsNotNull (values, "values of entry 0x84");
				Assert.AreEqual (4, values.Length);
				Assert.AreEqual (180.0d/10.0d, (double) values[0]);
				Assert.AreEqual (2000.0d/10.0d, (double) values[1]);
				Assert.AreEqual (35.0d/10.0d, (double) values[2]);
				Assert.AreEqual (56.0d/10.0d, (double) values[3]);
			}
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:55,代码来源:JpegNikon3Test.cs

示例4: CheckMakerNote

		public void CheckMakerNote (File file) {
			IFDTag tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;
			Assert.IsNotNull (tag, "tag");

			var makernote_ifd =
				tag.ExifIFD.GetEntry (0, (ushort) ExifEntryTag.MakerNote) as MakernoteIFDEntry;

			Assert.IsNotNull (makernote_ifd, "makernote ifd");
			Assert.AreEqual (MakernoteType.Olympus1, makernote_ifd.MakernoteType);

			var structure = makernote_ifd.Structure;
			Assert.IsNotNull (structure, "structure");
			{
				var entry = structure.GetEntry (0, 0x0200) as LongArrayIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0200");
				uint[] values = entry.Values;

				Assert.IsNotNull (values, "values of entry 0x0200");
				Assert.AreEqual (3, values.Length);
				Assert.AreEqual (0, values[0]);
				Assert.AreEqual (0, values[1]);
				Assert.AreEqual (0, values[2]);
			}
			{
				var entry = structure.GetEntry (0, 0x0204) as RationalIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0204");
				Assert.AreEqual (100.0d/100.0d, (double) entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x0207) as StringIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0207");
				Assert.AreEqual ("SX756", entry.Value);
			}
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:34,代码来源:JpegOlympus2Test.cs

示例5: CheckXMP

		public void CheckXMP (File file)
		{
			var tag = file.GetTag (TagTypes.XMP) as XmpTag;

			Assert.IsNotNull (tag, "tag");

			Assert.AreEqual (new string [] {}, tag.Keywords);
			Assert.AreEqual ("OLYMPUS CORPORATION", tag.Make);
			Assert.AreEqual ("C5060WZ", tag.Model);
			Assert.AreEqual ("Adobe Photoshop Elements 4.0", tag.Software);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:11,代码来源:JpegOlympus2Test.cs

示例6: CheckExif

		public void CheckExif (File file)
		{
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("SONY ", tag.Make);
			Assert.AreEqual ("DSLR-A200", tag.Model);
			Assert.AreEqual (400, tag.ISOSpeedRatings, "ISOSpeedRatings");
			Assert.AreEqual (1.0d/60.0d, tag.ExposureTime);
			Assert.AreEqual (5.6d, tag.FNumber);
			Assert.AreEqual (35.0d, tag.FocalLength);
			Assert.AreEqual (52, tag.FocalLengthIn35mmFilm);
			Assert.AreEqual (new DateTime (2009, 11, 21, 12, 39, 39), tag.DateTime);
			Assert.AreEqual (new DateTime (2009, 11, 21, 12, 39, 39), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2009, 11, 21, 12, 39, 39), tag.DateTimeOriginal);
			Assert.AreEqual (Image.ImageOrientation.TopLeft, tag.Orientation);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:21,代码来源:JpegSony1Test.cs

示例7: CheckMakerNote

		public void CheckMakerNote (File file)
		{
			IFDTag tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;
			Assert.IsNotNull (tag, "tag");

			var makernote_ifd =
				tag.ExifIFD.GetEntry (0, (ushort) ExifEntryTag.MakerNote) as MakernoteIFDEntry;

			Assert.IsNotNull (makernote_ifd, "makernote ifd");
			Assert.AreEqual (MakernoteType.Sony, makernote_ifd.MakernoteType);

			var structure = makernote_ifd.Structure;
			Assert.IsNotNull (structure, "structure");
			//Tag info from http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Sony.html
			//0x0102: image quality
			{
				var entry = structure.GetEntry (0, 0x0102) as LongIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0102");
				Assert.AreEqual (2, entry.Value);
			}
			//0x0115: white balance
			{
				var entry = structure.GetEntry (0, 0x0115) as LongIFDEntry;
				Assert.IsNotNull (entry, "entry 0x0115");
				Assert.AreEqual (0, entry.Value);
			}
			//0xb026: image stabilizer
			{
				var entry = structure.GetEntry (0, 0xb026) as LongIFDEntry;
				Assert.IsNotNull (entry, "entry 0xb026");
				Assert.AreEqual (0, entry.Value);
			}
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:33,代码来源:JpegSony1Test.cs

示例8: CheckExif

		public void CheckExif (File file) {
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("OLYMPUS IMAGING CORP.  ", tag.Make);
			Assert.AreEqual ("u700,S700       ", tag.Model);
			Assert.AreEqual (64, tag.ISOSpeedRatings, "ISOSpeedRatings");
			Assert.AreEqual (1.0d/25.0d, tag.ExposureTime);
			Assert.AreEqual (3.4d, tag.FNumber);
			Assert.AreEqual (6.5d, tag.FocalLength);
			Assert.AreEqual (new DateTime (2006, 10, 23, 06, 57, 40), tag.DateTime);
			Assert.AreEqual (new DateTime (2006, 10, 23, 08, 57, 40), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2006, 10, 23, 06, 57, 40), tag.DateTimeOriginal);
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:18,代码来源:JpegOlympus1Test.cs

示例9: CheckXMP

		public void CheckXMP (File file)
		{
			string [] keywords = new string[] {
				"Nikon D70s",
				"Food",
				"2007",
				"2006",
				"Neujahr",
				"Sylvester"
			};

			var tag = file.GetTag (TagTypes.XMP) as XmpTag;

			Assert.IsNotNull (tag, "tag");

			Assert.AreEqual (keywords, tag.Keywords);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:17,代码来源:JpegNikon2Test.cs

示例10: CheckExif

		public void CheckExif (File file) {
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("OLYMPUS IMAGING CORP.  ", tag.Make);
			Assert.AreEqual ("E-410           ", tag.Model);
			Assert.AreEqual (100, tag.ISOSpeedRatings);
			Assert.AreEqual (1.0d/125.0d, tag.ExposureTime);
			Assert.AreEqual (6.3d, tag.FNumber);
			Assert.AreEqual (42.0d, tag.FocalLength);
			Assert.AreEqual (new DateTime (2009, 04, 11, 19, 45, 42), tag.DateTime);
			Assert.AreEqual (new DateTime (2009, 04, 11, 19, 45, 42), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2009, 04, 11, 19, 45, 42), tag.DateTimeOriginal);
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:18,代码来源:JpegOlympus3Test.cs

示例11: CheckMakerNote

		public void CheckMakerNote (File file) {
			IFDTag tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;
			Assert.IsNotNull (tag, "tag");

			var makernote_ifd =
				tag.ExifIFD.GetEntry (0, (ushort) ExifEntryTag.MakerNote) as MakernoteIFDEntry;

			Assert.IsNotNull (makernote_ifd, "makernote ifd");
			Assert.AreEqual (MakernoteType.Olympus2, makernote_ifd.MakernoteType);

			var structure = makernote_ifd.Structure;
			Assert.IsNotNull (structure, "structure");
			/*{
				var entry = structure.GetEntry (0, 0x01) as UndefinedIFDEntry;
				Assert.IsNotNull (entry);
				ByteVector read_bytes = entry.Data;
				ByteVector expected_bytes = new ByteVector (new byte [] {48, 50, 49, 48});

				Assert.AreEqual (expected_bytes.Count, read_bytes.Count);
				for (int i = 0; i < expected_bytes.Count; i++)
					Assert.AreEqual (expected_bytes[i], read_bytes[i]);
			}
			{
				var entry = structure.GetEntry (0, 0x04) as StringIFDEntry;
				Assert.IsNotNull (entry, "entry 0x04");
				Assert.AreEqual ("FINE   ", entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x08) as StringIFDEntry;
				Assert.IsNotNull (entry, "entry 0x08");
				Assert.AreEqual ("NORMAL      ", entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x92) as SShortIFDEntry;
				Assert.IsNotNull (entry, "entry 0x92");
				Assert.AreEqual (0, entry.Value);
			}
			{
				var entry = structure.GetEntry (0, 0x9A) as RationalArrayIFDEntry;
				Assert.IsNotNull (entry, "entry 0x9A");
				var values = entry.Values;

				Assert.IsNotNull (values, "values of entry 0x9A");
				Assert.AreEqual (2, values.Length);
				Assert.AreEqual (78.0d/10.0d, (double) values[0]);
				Assert.AreEqual (78.0d/10.0d, (double) values[1]);
			}*/
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:48,代码来源:JpegOlympus3Test.cs

示例12: CheckJpegComment

		public void CheckJpegComment (File file, int i) {
			var tag = file.GetTag (TagTypes.JpegComment) as JpegCommentTag;
			Assert.IsNotNull (tag, String.Format ("JpegTag Tag not contained: index {0}", i));

			Assert.AreEqual ("Created with GIMP", tag.Comment, String.Format ("index {0}", i));
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:6,代码来源:JpegTangledTest.cs

示例13: CheckXmp

		public void CheckXmp (File file, int i) {
			var tag = file.GetTag (TagTypes.XMP) as XmpTag;
			Assert.IsNotNull (tag, String.Format ("XMP Tag not contained: index {0}", i));

			Assert.AreEqual ("test description", tag.Comment);
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:6,代码来源:JpegTangledTest.cs

示例14: CheckExif

		public void CheckExif (File file, int i) {
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;
			Assert.IsNotNull (tag, String.Format ("Tiff Tag not contained: index {0}", i));

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, String.Format ("Exif SubIFD not contained: index {0}", i));

			Assert.AreEqual ("test comment", tag.Comment, String.Format ("index {0}", i));
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:9,代码来源:JpegTangledTest.cs

示例15: CheckExif

		public void CheckExif (File file)
		{
			var tag = file.GetTag (TagTypes.TiffIFD) as IFDTag;

			Assert.IsNotNull (tag, "tag");

			var exif_ifd = tag.Structure.GetEntry(0, IFDEntryTag.ExifIFD) as SubIFDEntry;
			Assert.IsNotNull (exif_ifd, "Exif IFD");

			Assert.AreEqual ("SONY ", tag.Make);
			Assert.AreEqual ("DSLR-A700", tag.Model);
			Assert.AreEqual (400, tag.ISOSpeedRatings, "ISOSpeedRatings");
			Assert.AreEqual (1.0d/125.0d, tag.ExposureTime);
			Assert.AreEqual (5.6d, tag.FNumber);
			Assert.AreEqual (70.0d, tag.FocalLength);
			Assert.AreEqual (new DateTime (2009, 11, 06, 20, 56, 07), tag.DateTime);
			Assert.AreEqual (new DateTime (2009, 11, 06, 20, 56, 07), tag.DateTimeDigitized);
			Assert.AreEqual (new DateTime (2009, 11, 06, 20, 56, 07), tag.DateTimeOriginal);
		}
开发者ID:tcHylmrX,项目名称:taglib-sharp,代码行数:19,代码来源:JpegSony2Test.cs


注:本文中的File.GetTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。