namespace Gma.QrCodeNet.Encoding;
public class QrEncoder
{
///
/// Default QrEncoder will set ErrorCorrectionLevel as M
///
public QrEncoder()
: this(ErrorCorrectionLevel.M)
{
}
///
/// QrEncoder with parameter ErrorCorrectionLevel.
///
public QrEncoder(ErrorCorrectionLevel errorCorrectionLevel)
{
ErrorCorrectionLevel = errorCorrectionLevel;
}
public ErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
///
/// Encode string content to QrCode matrix
///
///
/// This exception for string content is null, empty or too large
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));
}
}
}