This commit is contained in:
TheXamlGuy
2024-04-26 23:05:36 +01:00
parent 9f90ef693d
commit bc55c4649b
206 changed files with 3106 additions and 3204 deletions
@@ -2,38 +2,38 @@ namespace Gma.QrCodeNet.Encoding;
public class QrEncoder
{
/// <summary>
/// Default QrEncoder will set ErrorCorrectionLevel as M
/// </summary>
public QrEncoder()
: this(ErrorCorrectionLevel.M)
{
}
/// <summary>
/// Default QrEncoder will set ErrorCorrectionLevel as M
/// </summary>
public QrEncoder()
: this(ErrorCorrectionLevel.M)
{
}
/// <summary>
/// QrEncoder with parameter ErrorCorrectionLevel.
/// </summary>
public QrEncoder(ErrorCorrectionLevel errorCorrectionLevel)
{
ErrorCorrectionLevel = errorCorrectionLevel;
}
/// <summary>
/// QrEncoder with parameter ErrorCorrectionLevel.
/// </summary>
public QrEncoder(ErrorCorrectionLevel errorCorrectionLevel)
{
ErrorCorrectionLevel = errorCorrectionLevel;
}
public ErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
public ErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
/// <summary>
/// Encode string content to QrCode matrix
/// </summary>
/// <exception cref="InputOutOfBoundaryException">
/// This exception for string content is null, empty or too large</exception>
public QrCode Encode(string content)
{
if (string.IsNullOrEmpty(content))
{
throw new InputOutOfBoundaryException("Input cannot be null or empty.");
}
else
{
return new QrCode(QRCodeEncode.Encode(content, ErrorCorrectionLevel));
}
}
}
/// <summary>
/// Encode string content to QrCode matrix
/// </summary>
/// <exception cref="InputOutOfBoundaryException">
/// This exception for string content is null, empty or too large</exception>
public QrCode Encode(string content)
{
if (string.IsNullOrEmpty(content))
{
throw new InputOutOfBoundaryException("Input cannot be null or empty.");
}
else
{
return new QrCode(QRCodeEncode.Encode(content, ErrorCorrectionLevel));
}
}
}