/// <summary>
        /// Gets the exif type which corresponds to the specified Type.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static ExifType GetExifType(object value)
        {
            if (value == null)
            {
                return(ExifType.Unknown);
            }

            Type type = value.GetType();

            if (!type.IsEnum)
            {
                throw new NotImplementedException();
            }

            System.Reflection.FieldInfo fieldInfo = type.GetField(Enum.GetName(type, value));

            if (!ExifDataTypeAttribute.IsDefined(fieldInfo, typeof(ExifDataTypeAttribute)))
            {
                return(ExifType.Unknown);
            }

            ExifDataTypeAttribute attribute = (ExifDataTypeAttribute)ExifDataTypeAttribute.GetCustomAttribute(fieldInfo, typeof(ExifDataTypeAttribute));

            return(attribute.ExifType);
        }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tagID"></param>
 /// <returns></returns>
 public ExifProperty this[ExifTag tagID]
 {
     get
     {
         if (!this.items.ContainsKey((int)tagID))
         {
             ExifProperty property = new ExifProperty();
             property.Tag           = tagID;
             property.Type          = ExifDataTypeAttribute.GetExifType(tagID);
             this.items[(int)tagID] = property;
         }
         return(this.items[(int)tagID]);
     }
     set { this.items[(int)tagID] = value; }
 }