Remove duplicated and unused code
MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/DataEncode.cs
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/DataEncode.cs
@@ -55,49 +55,6 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation
return encStruct;
}
- internal static EncodationStruct Encode(IEnumerable<byte> content, ErrorCorrectionLevel eclevel)
- {
- EncoderBase encoderBase = CreateEncoder(QRCodeConstantVariable.DefaultEncoding);
-
- BitList encodeContent = new BitList(content);
-
- int encodeContentLength = encodeContent.Count;
-
- VersionControlStruct vcStruct =
- VersionControl.InitialSetup(encodeContentLength, eclevel, QRCodeConstantVariable.DefaultEncoding);
-
- BitList dataCodewords = new BitList();
- //Eci header
- if (vcStruct.IsContainECI && !(vcStruct.ECIHeader is null))
- {
- dataCodewords.Add(vcStruct.ECIHeader);
- }
- //Header
- dataCodewords.Add(encoderBase.GetModeIndicator());
- int numLetter = encodeContentLength >> 3;
- dataCodewords.Add(encoderBase.GetCharCountIndicator(numLetter, vcStruct.VersionDetail.Version));
- //Data
- dataCodewords.Add(encodeContent);
- //Terminator Padding
- dataCodewords.TerminateBites(dataCodewords.Count, vcStruct.VersionDetail.NumDataBytes);
-
- int dataCodewordsCount = dataCodewords.Count;
- if ((dataCodewordsCount & 0x7) != 0)
- {
- throw new ArgumentException($"{nameof(dataCodewords)} is not byte sized.");
- }
- else if (dataCodewordsCount >> 3 != vcStruct.VersionDetail.NumDataBytes)
- {
- throw new ArgumentException($"{nameof(dataCodewords)} num of bytes not equal to {nameof(vcStruct.VersionDetail.NumDataBytes)} for current version");
- }
-
- var encStruct = new EncodationStruct(vcStruct)
- {
- DataCodewords = dataCodewords
- };
- return encStruct;
- }
-
private static EncoderBase CreateEncoder(string encodingName)
{
return new EightBitByteEncoder(encodingName);

MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/QRCodeEncode.cs
WalletWasabi/Gma/QrCodeNet/Encoding/QRCodeEncode.cs
@@ -17,13 +17,6 @@ namespace Gma.QrCodeNet.Encoding
return ProcessEncodationResult(encodeStruct, errorLevel);
}
- internal static BitMatrix Encode(IEnumerable<byte> content, ErrorCorrectionLevel errorLevel)
- {
- EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel);
-
- return ProcessEncodationResult(encodeStruct, errorLevel);
- }
-
private static BitMatrix ProcessEncodationResult(EncodationStruct encodeStruct, ErrorCorrectionLevel errorLevel)
{
BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail);

MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/QrEncoder.cs
WalletWasabi/Gma/QrCodeNet/Encoding/QrEncoder.cs
@@ -57,40 +57,5 @@ namespace Gma.QrCodeNet.Encoding
return false;
}
}
-
- /// <summary>
- /// Encode byte array content to QrCode matrix
- /// </summary>
- /// <exception cref="InputOutOfBoundaryException">
- /// This exception for string content is null, empty or too large</exception>
- public QrCode Encode(IEnumerable<byte> content)
- {
- if (content is null)
- {
- throw new InputOutOfBoundaryException("Input cannot be null or empty.");
- }
- else
- {
- return new QrCode(QRCodeEncode.Encode(content, ErrorCorrectionLevel));
- }
- }
-
- /// <summary>
- /// Try to encode content
- /// </summary>
- /// <returns>False if input content is empty, null or too large.</returns>
- public bool TryEncode(IEnumerable<byte> content, out QrCode qrCode)
- {
- try
- {
- qrCode = Encode(content);
- return true;
- }
- catch (InputOutOfBoundaryException)
- {
- qrCode = new QrCode();
- return false;
- }
- }
}
}

Remove duplicated and unused code