Skip to content

Commit

Permalink
Configurable character set
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed May 30, 2024
1 parent b99969a commit 689f76d
Show file tree
Hide file tree
Showing 28 changed files with 2,232 additions and 621 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ jobs:
path: TestResults-${{ runner.os }}.html
- name: Create and validate NuGet package for Core
run: dotnet pack --no-build --verbosity normal Core/Core.csproj
if: startsWith(matrix.os,'windows')
- name: Create and validate NuGet package for PixelCanvas
run: dotnet pack --no-build --verbosity normal PixelCanvas/PixelCanvas.csproj
if: startsWith(matrix.os,'windows')
- name: Create and validate NuGet package for Windows
run: dotnet pack --no-build --verbosity normal WindowsTest/WindowsTest.csproj
if: startsWith(matrix.os,'windows')
24 changes: 19 additions & 5 deletions Core/Bill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ public SwicoBillInformation RetrieveSwicoBillInformation()
/// <value>The line separator for the QR code data fields.</value>
public QrDataSeparator Separator { get; set; } = QrDataSeparator.Lf;

/// <summary>
/// Gets or sets the character set used for the QR bill data.
/// <para>
/// Defaults to <see cref="SpsCharacterSet.Latin1Subset"/>.
/// </para>
/// <para>
/// Until November 21, 2025, <see cref="SpsCharacterSet.Latin1Subset"/>
/// is the only value that will generate QR bills accepted by all banks.
/// </para>
/// </summary>
public SpsCharacterSet CharacterSet { get; set; } = SpsCharacterSet.Latin1Subset;

/// <summary>Determines whether the specified object is equal to the current object.</summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
Expand All @@ -286,7 +298,7 @@ public bool Equals(Bill other)
{
return other != null &&
Version == other.Version &&
EqualityComparer<decimal?>.Default.Equals(Amount, other.Amount) &&
Amount == other.Amount &&
Currency == other.Currency &&
Account == other.Account &&
EqualityComparer<Address>.Default.Equals(Creditor, other.Creditor) &&
Expand All @@ -297,16 +309,17 @@ public bool Equals(Bill other)
BillInformation == other.BillInformation &&
SequenceEqual(AlternativeSchemes, other.AlternativeSchemes) &&
EqualityComparer<BillFormat>.Default.Equals(Format, other.Format) &&
Separator == other.Separator;
Separator == other.Separator &&
CharacterSet == other.CharacterSet;
}

/// <summary>Gets the hash code for this instance.</summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
var hashCode = -765739998;
int hashCode = 1343005904;
hashCode = hashCode * -1521134295 + Version.GetHashCode();
hashCode = hashCode * -1521134295 + EqualityComparer<decimal?>.Default.GetHashCode(Amount);
hashCode = hashCode * -1521134295 + Amount.GetHashCode();
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Currency);
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Account);
hashCode = hashCode * -1521134295 + EqualityComparer<Address>.Default.GetHashCode(Creditor);
Expand All @@ -317,7 +330,8 @@ public override int GetHashCode()
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(BillInformation);
hashCode = hashCode * -1521134295 + EqualityComparer<List<AlternativeScheme>>.Default.GetHashCode(AlternativeSchemes);
hashCode = hashCode * -1521134295 + EqualityComparer<BillFormat>.Default.GetHashCode(Format);
hashCode = hashCode * -1521134295 + EqualityComparer<QrDataSeparator>.Default.GetHashCode(Separator);
hashCode = hashCode * -1521134295 + Separator.GetHashCode();
hashCode = hashCode * -1521134295 + CharacterSet.GetHashCode();
return hashCode;
}

Expand Down
1 change: 0 additions & 1 deletion Core/BillFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public BillFormat(BillFormat format)
/// <value>country code (ISO 3166, two uppercase letters)</value>
public string LocalCountryCode { get; set; } = "CH";


/// <summary>Determines whether the specified object is equal to the current object.</summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
Expand Down
Loading

0 comments on commit 689f76d

Please sign in to comment.