ESCPOS icon indicating copy to clipboard operation
ESCPOS copied to clipboard

Rename methods

Open igorocampos opened this issue 1 year ago • 0 comments

PrintBarCode and PrintQRCode should be renamed as they don't actually print anything, but rather create the necessary command for a barcode/qrcode.

New name should be just Barcode and QRCode

As this is clearly a breaking change, we should first create the new Barcode() and QRCode() methods which will contain the actual code and the previous PrintBarCode and PrintQRCode must be marked as obsolete methods and instead of containing code, they must only call the newly created methods.

After this change is deployed, version should be bumped to 1.2.4 and the usage of the obsolete methods should just generate a warning by decorating the methods with the Obsolete attribute as shown below.

[Obsolete(nameof(PrintBarCode) + " is deprecated, please use "+ nameof(Barcode) + " instead.")]

On the next version, it must be bumped to 1.3.0 and the Obsolete attribute must be changed in order to throw a compilation error if the old method is used. This can be done by adding a new bool parameter to the attribute

[Obsolete(nameof(PrintBarCode) + " is deprecated, please use "+ nameof(Barcode) + " instead.", true)]

And then, on version 1.3.1 we can just get rid of the old methods :)

igorocampos avatar Nov 25 '22 11:11 igorocampos