Skip to content

Commit

Permalink
Merge pull request #387 from drewnoakes/remove-jetbrains-annotations
Browse files Browse the repository at this point in the history
Remove JetBrains.Annotations
  • Loading branch information
drewnoakes authored Jan 29, 2024
2 parents 24321dd + ca54b0f commit dec5ac9
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 78 deletions.
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />

<!-- Avoid needing to have targeting packs installed for .NET Framework. -->
Expand Down
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,4 @@ license terms:

- XmpCore (runtime) licensed under BSD

- JetBrains.Annotations (design time) licensed under Apache 2.0

- xUnit (design time) licensed under Apache 2.0
2 changes: 0 additions & 2 deletions MetadataExtractor.PowerShell/ExtractMetadataCmdlet.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Copyright (c) Drew Noakes and contributors. All Rights Reserved. Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using System.Management.Automation;
using JetBrains.Annotations;
using MetadataExtractor.Formats.Xmp;

namespace MetadataExtractor.PowerShell
{
[Cmdlet("Extract", "Metadata")]
[UsedImplicitly]
public sealed class ExtractMetadata : PSCmdlet
{
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Path to the file to process")]
Expand Down
2 changes: 0 additions & 2 deletions MetadataExtractor.PowerShell/ShowJpegStructure.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Drew Noakes and contributors. All Rights Reserved. Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using System.Management.Automation;
using JetBrains.Annotations;
using MetadataExtractor.Formats.Exif;
using MetadataExtractor.Formats.Icc;
using MetadataExtractor.Formats.Jfif;
Expand All @@ -26,7 +25,6 @@ public readonly struct JpegSegment(JpegSegmentType type, int length, int padding
}

[Cmdlet(VerbsCommon.Show, "JpegStructure")]
[UsedImplicitly]
public sealed class ShowJpegStructure : PSCmdlet
{
private static readonly ByteTrie<string?> _appSegmentByPreambleBytes = new ByteTrie<string?>(null)
Expand Down
32 changes: 0 additions & 32 deletions MetadataExtractor/DirectoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

using System.Globalization;

using JetBrains.Annotations;

namespace MetadataExtractor
{
public static class DirectoryExtensions
Expand All @@ -16,7 +14,6 @@ public static class DirectoryExtensions
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static byte GetByte(this Directory directory, int tagType)
{
if (directory.TryGetByte(tagType, out byte value))
Expand All @@ -25,7 +22,6 @@ public static byte GetByte(this Directory directory, int tagType)
return ThrowValueNotPossible<byte>(directory, tagType);
}

[Pure]
public static bool TryGetByte(this Directory directory, int tagType, out byte value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -57,7 +53,6 @@ public static bool TryGetByte(this Directory directory, int tagType, out byte va
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static short GetInt16(this Directory directory, int tagType)
{
if (directory.TryGetInt16(tagType, out short value))
Expand All @@ -66,7 +61,6 @@ public static short GetInt16(this Directory directory, int tagType)
return ThrowValueNotPossible<short>(directory, tagType);
}

[Pure]
public static bool TryGetInt16(this Directory directory, int tagType, out short value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -98,7 +92,6 @@ public static bool TryGetInt16(this Directory directory, int tagType, out short
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static ushort GetUInt16(this Directory directory, int tagType)
{
if (directory.TryGetUInt16(tagType, out ushort value))
Expand All @@ -107,7 +100,6 @@ public static ushort GetUInt16(this Directory directory, int tagType)
return ThrowValueNotPossible<ushort>(directory, tagType);
}

[Pure]
public static bool TryGetUInt16(this Directory directory, int tagType, out ushort value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -139,7 +131,6 @@ public static bool TryGetUInt16(this Directory directory, int tagType, out ushor
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static int GetInt32(this Directory directory, int tagType)
{
if (directory.TryGetInt32(tagType, out int value))
Expand All @@ -148,7 +139,6 @@ public static int GetInt32(this Directory directory, int tagType)
return ThrowValueNotPossible<int>(directory, tagType);
}

[Pure]
public static bool TryGetInt32(this Directory directory, int tagType, out int value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -219,7 +209,6 @@ public static bool TryGetUInt32(this Directory directory, int tagType, out uint
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static long GetInt64(this Directory directory, int tagType)
{
if (directory.TryGetInt64(tagType, out long value))
Expand All @@ -228,7 +217,6 @@ public static long GetInt64(this Directory directory, int tagType)
return ThrowValueNotPossible<long>(directory, tagType);
}

[Pure]
public static bool TryGetInt64(this Directory directory, int tagType, out long value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -260,7 +248,6 @@ public static bool TryGetInt64(this Directory directory, int tagType, out long v
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static ulong GetUInt64(this Directory directory, int tagType)
{
if (directory.TryGetUInt64(tagType, out ulong value))
Expand All @@ -269,7 +256,6 @@ public static ulong GetUInt64(this Directory directory, int tagType)
return ThrowValueNotPossible<ulong>(directory, tagType);
}

[Pure]
public static bool TryGetUInt64(this Directory directory, int tagType, out ulong value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -301,7 +287,6 @@ public static bool TryGetUInt64(this Directory directory, int tagType, out ulong
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static float GetSingle(this Directory directory, int tagType)
{
if (directory.TryGetSingle(tagType, out float value))
Expand All @@ -310,7 +295,6 @@ public static float GetSingle(this Directory directory, int tagType)
return ThrowValueNotPossible<float>(directory, tagType);
}

[Pure]
public static bool TryGetSingle(this Directory directory, int tagType, out float value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -342,7 +326,6 @@ public static bool TryGetSingle(this Directory directory, int tagType, out float
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static double GetDouble(this Directory directory, int tagType)
{
if (directory.TryGetDouble(tagType, out double value))
Expand All @@ -351,7 +334,6 @@ public static double GetDouble(this Directory directory, int tagType)
return ThrowValueNotPossible<double>(directory, tagType);
}

[Pure]
public static bool TryGetDouble(this Directory directory, int tagType, out double value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand Down Expand Up @@ -383,7 +365,6 @@ public static bool TryGetDouble(this Directory directory, int tagType, out doubl
/// If the value is an array of <see cref="IConvertible"/> having length one, then the single item is converted.
/// </remarks>
/// <exception cref="MetadataException">No value exists for <paramref name="tagType"/>, or the value is not convertible to the requested type.</exception>
[Pure]
public static bool GetBoolean(this Directory directory, int tagType)
{
if (directory.TryGetBoolean(tagType, out bool value))
Expand All @@ -392,7 +373,6 @@ public static bool GetBoolean(this Directory directory, int tagType)
return ThrowValueNotPossible<bool>(directory, tagType);
}

[Pure]
public static bool TryGetBoolean(this Directory directory, int tagType, out bool value)
{
var convertible = GetConvertibleObject(directory, tagType);
Expand All @@ -419,7 +399,6 @@ public static bool TryGetBoolean(this Directory directory, int tagType, out bool
/// <summary>Gets the specified tag's value as a String array, if possible.</summary>
/// <remarks>Only supported where the tag is set as String[], String, int[], byte[] or Rational[].</remarks>
/// <returns>the tag's value as an array of Strings. If the value is unset or cannot be converted, <see langword="null" /> is returned.</returns>
[Pure]
public static string[]? GetStringArray(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -474,7 +453,6 @@ public static bool TryGetBoolean(this Directory directory, int tagType, out bool
/// <summary>Gets the specified tag's value as a StringValue array, if possible.</summary>
/// <remarks>Only succeeds if the tag is set as StringValue[], or String.</remarks>
/// <returns>the tag's value as an array of StringValues. If the value is unset or cannot be converted, <see langword="null" /> is returned.</returns>
[Pure]
public static StringValue[]? GetStringValueArray(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand All @@ -492,7 +470,6 @@ public static bool TryGetBoolean(this Directory directory, int tagType, out bool
/// <summary>Gets the specified tag's value as an int array, if possible.</summary>
/// <remarks>Only supported where the tag is set as String, Integer, int[], byte[] or Rational[].</remarks>
/// <returns>the tag's value as an int array</returns>
[Pure]
public static int[]? GetInt32Array(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -553,7 +530,6 @@ public static bool TryGetBoolean(this Directory directory, int tagType, out bool
/// <summary>Gets the specified tag's value as an byte array, if possible.</summary>
/// <remarks>Only supported where the tag is set as StringValue, String, Integer, int[], byte[] or Rational[].</remarks>
/// <returns>the tag's value as a byte array</returns>
[Pure]
public static byte[]? GetByteArray(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -672,7 +648,6 @@ public static DateTime GetDateTime(this Directory directory, int tagType /*, Tim
/// </para>
/// </remarks>
/// <returns><see langword="true"/> if a DateTime was returned, otherwise <see langword="false"/>.</returns>
[Pure]
public static bool TryGetDateTime(this Directory directory, int tagType /*, TimeZoneInfo? timeZone = null*/, out DateTime dateTime)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -724,7 +699,6 @@ public static bool TryGetDateTime(this Directory directory, int tagType /*, Time

#region Rational

[Pure]
public static Rational GetRational(this Directory directory, int tagType)
{
if (directory.TryGetRational(tagType, out Rational value))
Expand All @@ -735,7 +709,6 @@ public static Rational GetRational(this Directory directory, int tagType)

/// <summary>Returns the specified tag's value as a Rational.</summary>
/// <remarks>If the value is unset or cannot be converted, <see langword="null" /> is returned.</remarks>
[Pure]
public static bool TryGetRational(this Directory directory, int tagType, out Rational value)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -774,7 +747,6 @@ public static bool TryGetRational(this Directory directory, int tagType, out Rat

/// <summary>Returns the specified tag's value as an array of Rational.</summary>
/// <remarks>If the value is unset or cannot be converted, <see langword="null" /> is returned.</remarks>
[Pure]
public static Rational[]? GetRationalArray(this Directory directory, int tagType)
{
return directory.GetObject(tagType) as Rational[];
Expand All @@ -789,7 +761,6 @@ public static bool TryGetRational(this Directory directory, int tagType, out Rat
/// the String representation of the tag's value, or
/// <see langword="null" /> if the tag hasn't been defined.
/// </returns>
[Pure]
public static string? GetString(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand Down Expand Up @@ -954,15 +925,13 @@ public static bool TryGetRational(this Directory directory, int tagType, out Rat
return o.ToString();
}

[Pure]
public static string? GetString(this Directory directory, int tagType, Encoding encoding)
{
var bytes = directory.GetByteArray(tagType);
return bytes is null ? null
: encoding.GetString(bytes, 0, bytes.Length);
}

[Pure]
public static StringValue GetStringValue(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand All @@ -973,7 +942,6 @@ public static StringValue GetStringValue(this Directory directory, int tagType)
return default;
}

[Pure]
private static IConvertible? GetConvertibleObject(this Directory directory, int tagType)
{
var o = directory.GetObject(tagType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Drew Noakes and contributors. All Rights Reserved. Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using JetBrains.Annotations;
namespace MetadataExtractor.Formats.Exif.Makernotes
{
/// <summary>
Expand Down Expand Up @@ -703,7 +702,6 @@ public String getSensorCleaningDescription()
/// lib\Image\ExifTool\Canon.pm
/// </remarks>
/// <param name="val">value to convert</param>
[Pure]
private static double DecodeCanonEv(int val)
{
var sign = 1;
Expand Down
5 changes: 0 additions & 5 deletions MetadataExtractor/Formats/Png/PngChunkType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) Drew Noakes and contributors. All Rights Reserved. Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using JetBrains.Annotations;

namespace MetadataExtractor.Formats.Png
{
/// <author>Drew Noakes https://drewnoakes.com</author>
Expand Down Expand Up @@ -142,13 +140,10 @@ private static void ValidateBytes(byte[] bytes)

public bool AreMultipleAllowed { get; }

[Pure]
private static bool IsLowerCase(byte b) => (b & (1 << 5)) != 0;

[Pure]
private static bool IsUpperCase(byte b) => (b & (1 << 5)) == 0;

[Pure]
private static bool IsValidByte(byte b) => b is >= 65 and <= 90 or >= 97 and <= 122;

public string Identifier => Encoding.UTF8.GetString(_bytes, 0, _bytes.Length);
Expand Down
5 changes: 0 additions & 5 deletions MetadataExtractor/GeoLocation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Drew Noakes and contributors. All Rights Reserved. Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using JetBrains.Annotations;
using MetadataExtractor.Formats.Exif;

namespace MetadataExtractor
Expand Down Expand Up @@ -40,7 +39,6 @@ public GeoLocation(double latitude, double longitude)
/// of format:
/// <c>-1° 23' 4.56"</c>
/// </summary>
[Pure]
public static string DecimalToDegreesMinutesSecondsString(double value)
{
var dms = DecimalToDegreesMinutesSeconds(value);
Expand All @@ -51,7 +49,6 @@ public static string DecimalToDegreesMinutesSecondsString(double value)
/// Converts a decimal degree angle into its corresponding DMS (degrees-minutes-seconds) component values, as
/// a double array.
/// </summary>
[Pure]
public static double[] DecimalToDegreesMinutesSeconds(double value)
{
var d = (int)value;
Expand All @@ -65,7 +62,6 @@ public static double[] DecimalToDegreesMinutesSeconds(double value)
/// <see cref="GpsDirectory"/>, into a single value in degrees,
/// as a double.
/// </summary>
[Pure]
public static double? DegreesMinutesSecondsToDecimal(Rational degs, Rational mins, Rational secs, bool isNegative)
{
var value = Math.Abs(degs.ToDouble()) + mins.ToDouble() / 60.0d + secs.ToDouble() / 3600.0d;
Expand Down Expand Up @@ -108,7 +104,6 @@ public override bool Equals(object? obj)
/// a string representation of this location, of format:
/// <c>-1° 23' 4.56", 54° 32' 1.92"</c>
/// </returns>
[Pure]
public string ToDmsString() => DecimalToDegreesMinutesSecondsString(Latitude) + ", " + DecimalToDegreesMinutesSecondsString(Longitude);

#endregion
Expand Down
Loading

0 comments on commit dec5ac9

Please sign in to comment.