Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Apr 29, 2022
1 parent 46bdc54 commit 393c5d9
Show file tree
Hide file tree
Showing 67 changed files with 555 additions and 13,795 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ namespace MetadataExtractor.Tests.Formats.Jpeg
/// <author>Drew Noakes https://drewnoakes.com</author>
public sealed class JpegMetadataReaderTest
{
#if !NETCOREAPP1_0
[Fact]
public void ExtractMetadataUsingPath()
{
Validate(JpegMetadataReader.ReadMetadata("Data/withExif.jpg"));
}
#endif

[Fact]
public void ExtractMetadataUsingStream()
Expand Down
4 changes: 0 additions & 4 deletions MetadataExtractor.Tests/RationalTest.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// 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;
#if !NETCOREAPP1_0
using System.ComponentModel;
#endif
using System.Diagnostics.CodeAnalysis;
using Xunit;

Expand Down Expand Up @@ -90,7 +88,6 @@ public void ZeroOverZero()
Assert.True(new Rational(0, 0).IsInteger);
}

#if !NETCOREAPP1_0
[Fact]
public void TypeConverter()
{
Expand All @@ -112,7 +109,6 @@ public void TypeConverter()

Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(null));
}
#endif

[Fact]
public void IConvertible()
Expand Down
10 changes: 0 additions & 10 deletions MetadataExtractor.Tests/UseCultureAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@ public override void Before(MethodInfo methodUnderTest)
_originalCulture = CultureInfo.CurrentCulture;
_originalUiCulture = CultureInfo.CurrentUICulture;

#if NETCOREAPP1_0
CultureInfo.CurrentCulture = Culture;
CultureInfo.CurrentUICulture = Culture;
#else
System.Threading.Thread.CurrentThread.CurrentCulture = Culture;
System.Threading.Thread.CurrentThread.CurrentUICulture = Culture;
#endif
}

/// <summary>
Expand All @@ -86,13 +81,8 @@ public override void Before(MethodInfo methodUnderTest)
/// <param name="methodUnderTest">The method under test</param>
public override void After(MethodInfo methodUnderTest)
{
#if NETCOREAPP1_0
CultureInfo.CurrentCulture = _originalCulture;
CultureInfo.CurrentUICulture = _originalUiCulture;
#else
System.Threading.Thread.CurrentThread.CurrentCulture = _originalCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _originalUiCulture;
#endif
}
}
}
8 changes: 1 addition & 7 deletions MetadataExtractor.Tools.FileProcessor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ internal static class Program
{
private static int Main(string[] args)
{
#if NETFRAMEWORK
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
#else
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
#endif
#if !NET35
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
#endif

return ProcessRecursively(args);
// return ProcessFileList(args);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0</TargetFrameworks>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MetadataExtractor\MetadataExtractor.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35' ">
<Reference Include="System" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
26 changes: 3 additions & 23 deletions MetadataExtractor/Directory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
#if NETSTANDARD1_3 || NETSTANDARD2_0
using System.Text;
#endif
#if NET35
using DirectoryList = System.Collections.Generic.IList<MetadataExtractor.Directory>;
#else
using DirectoryList = System.Collections.Generic.IReadOnlyList<MetadataExtractor.Directory>;
#endif

namespace MetadataExtractor
{
Expand All @@ -25,7 +17,7 @@ public abstract class Directory
#if NETSTANDARD2_0
static Directory()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
#endif

Expand Down Expand Up @@ -81,13 +73,7 @@ protected virtual bool TryGetTagName(int tagType, [NotNullWhen(returnValue: true

/// <summary>Returns all <see cref="Tag"/> objects that have been set in this <see cref="Directory"/>.</summary>
/// <value>The list of <see cref="Tag"/> objects.</value>
public
#if NET35
IEnumerable<Tag>
#else
IReadOnlyList<Tag>
#endif
Tags => _definedTagList;
public IReadOnlyList<Tag> Tags => _definedTagList;

/// <summary>Returns the number of tags set in this Directory.</summary>
/// <value>the number of tags set in this Directory</value>
Expand All @@ -113,13 +99,7 @@ protected void SetDescriptor(ITagDescriptor descriptor)

/// <summary>Used to iterate over any error messages contained in this directory.</summary>
/// <value>The collection of error message strings.</value>
public
#if NET35
IEnumerable<string>
#else
IReadOnlyList<string>
#endif
Errors => _errorList;
public IReadOnlyList<string> Errors => _errorList;

#endregion

Expand Down
13 changes: 0 additions & 13 deletions MetadataExtractor/DirectoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -945,20 +945,7 @@ public static bool TryGetRational(this Directory directory, int tagType, out Rat
}

if (o is IEnumerable<string> strings)
{
#if NET35
var sb = new StringBuilder();
foreach (var s in strings)
{
if (sb.Length != 0)
sb.Append(' ');
sb.Append(s);
}
return sb.ToString();
#else
return string.Join(" ", strings);
#endif
}

if (o is double d)
return d.ToString("0.###");
Expand Down
Loading

0 comments on commit 393c5d9

Please sign in to comment.