Skip to content

Commit

Permalink
Replace EN-US Culture with invariant culture [#144]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeugma440 committed May 22, 2022
1 parent 2155950 commit 227eddd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ATL.test/IO/MetaData/AA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void TagIO_R_AA_simple()
new ConsoleLogger();

string location = TestUtils.GetResourceLocationRoot() + notEmptyFile;
AudioDataManager theFile = new AudioDataManager(ATL.AudioData.AudioDataIOFactory.GetInstance().GetFromPath(location) );
AudioDataManager theFile = new AudioDataManager(AudioDataIOFactory.GetInstance().GetFromPath(location) );

readExistingTagsOnFile(theFile, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion ATL/AudioData/IO/AA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected override bool isLittleEndian
}
public override string EncodeDate(DateTime date)
{
return date.ToString("dd-MMM-yyyy", Utils.EnUsCulture).ToUpper();
return date.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture).ToUpper();
}

public long AudioDataOffset { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion ATL/AudioData/IO/VGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO.Compression;
using static ATL.ChannelsArrangements;
using static ATL.TagData;
using System.Globalization;

namespace ATL.AudioData.IO
{
Expand Down Expand Up @@ -103,7 +104,7 @@ public override string EncodeDate(DateTime date)
return date.Year.ToString();
else
// According to GD3 spec for release date
return date.ToString("yyyy/MM/dd", Utils.EnUsCulture);
return date.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture);
}


Expand Down
5 changes: 3 additions & 2 deletions ATL/Entities/MetadataHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Commons;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using static ATL.TagData;

Expand Down Expand Up @@ -166,8 +167,8 @@ public DateTime Date
tagData.IntegrateValue(Field.RECORDING_DATE, (value > DateTime.MinValue) ? TrackUtils.FormatISOTimestamp(value) : null);
tagData.IntegrateValue(Field.RECORDING_YEAR, (value > DateTime.MinValue) ? value.Year.ToString() : null);
tagData.IntegrateValue(Field.RECORDING_YEAR_OR_DATE, (value > DateTime.MinValue) ? value.ToShortDateString() : null);
tagData.IntegrateValue(Field.RECORDING_DAYMONTH, (value > DateTime.MinValue) ? value.ToString("ddMM", Utils.EnUsCulture) : null);
tagData.IntegrateValue(Field.RECORDING_TIME, (value > DateTime.MinValue) ? value.ToString("HHmm", Utils.EnUsCulture) : null);
tagData.IntegrateValue(Field.RECORDING_DAYMONTH, (value > DateTime.MinValue) ? value.ToString("ddMM", CultureInfo.InvariantCulture) : null);
tagData.IntegrateValue(Field.RECORDING_TIME, (value > DateTime.MinValue) ? value.ToString("HHmm", CultureInfo.InvariantCulture) : null);
}
}
/// <inheritdoc/>
Expand Down
8 changes: 1 addition & 7 deletions ATL/Utils/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ATL;
using System;
using System.Globalization;
using System.Text;
using System.Collections.Generic;
using System.IO;
Expand All @@ -14,7 +13,7 @@ internal static class Utils
{
private static Encoding latin1Encoding = Encoding.GetEncoding("ISO-8859-1");
private static IDictionary<string, Encoding> encodingCache = new Dictionary<string, Encoding>();
private static CultureInfo enUsCulture = CultureInfo.CreateSpecificCulture("en-US");

/// <summary>
/// 'ZERO WIDTH NO-BREAK SPACE' invisible character, sometimes used by certain tagging softwares
/// Looks like a BOM unfortunately converted into an unicode character :/
Expand All @@ -32,11 +31,6 @@ internal static class Utils
/// </summary>
public static Encoding Latin1Encoding { get { return latin1Encoding; } }

/// <summary>
/// en-US culture
/// </summary>
public static CultureInfo EnUsCulture { get { return enUsCulture; } }


/// <summary>
/// Transform the given string so that is becomes non-null
Expand Down

0 comments on commit 227eddd

Please sign in to comment.