Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API exploration #90

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 4 additions & 25 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 @@ -22,13 +14,12 @@ namespace MetadataExtractor
/// <author>Drew Noakes https://drewnoakes.com</author>
public abstract class Directory
{
#if NETSTANDARD1_3 || NETSTANDARD2_0
#if NETSTANDARD2_0
static Directory()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
#endif
internal static readonly DirectoryList EmptyList = new Directory[0];

private readonly Dictionary<int, string>? _tagNameMap;

Expand Down Expand Up @@ -82,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 @@ -114,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