mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
946 B
33 lines
946 B
// <copyright file="TiffGenIfdExtensions.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System.Linq;
|
|
|
|
/// <summary>
|
|
/// A utility class for manipulating in-memory Tiff files for use in unit tests.
|
|
/// </summary>
|
|
internal static class TiffGenIfdExtensions
|
|
{
|
|
public static TiffGenIfd WithoutEntry(this TiffGenIfd ifd, ushort tag)
|
|
{
|
|
TiffGenEntry entry = ifd.Entries.FirstOrDefault(e => e.Tag == tag);
|
|
if (entry != null)
|
|
{
|
|
ifd.Entries.Remove(entry);
|
|
}
|
|
return ifd;
|
|
}
|
|
|
|
public static TiffGenIfd WithEntry(this TiffGenIfd ifd, TiffGenEntry entry)
|
|
{
|
|
ifd.WithoutEntry(entry.Tag);
|
|
ifd.Entries.Add(entry);
|
|
|
|
return ifd;
|
|
}
|
|
}
|
|
}
|