Example #1
0
        private static IExifValue GetOffsetValue(List <IExifValue> ifdValues, List <IExifValue> values, ExifTag offset)
        {
            int index = -1;

            for (int i = 0; i < ifdValues.Count; i++)
            {
                if (ifdValues[i].Tag == offset)
                {
                    index = i;
                }
            }

            if (values.Count > 0)
            {
                if (index != -1)
                {
                    return(ifdValues[index]);
                }

                ExifValue result = ExifValues.Create(offset);
                ifdValues.Add(result);

                return(result);
            }
            else if (index != -1)
            {
                ifdValues.RemoveAt(index);
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Sets the value of the specified tag.
        /// </summary>
        /// <param name="tag">The tag of the exif value.</param>
        /// <param name="value">The value.</param>
        internal void SetValueInternal(ExifTag tag, object value)
        {
            foreach (IExifValue exifValue in this.Values)
            {
                if (exifValue.Tag == tag)
                {
                    exifValue.TrySetValue(value);
                    return;
                }
            }

            ExifValue newExifValue = ExifValues.Create(tag);

            if (newExifValue is null)
            {
                throw new NotSupportedException();
            }

            newExifValue.TrySetValue(value);
            this.values.Add(newExifValue);
        }