question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion about ByteSplicer

See original GitHub issue

Hi Luke, May I suggest the ByteSplicer Combine method accept only byte[] instead of object[] as a parameter?

https://github.com/lukevp/ESC-POS-.NET/blob/554802bb73e2de5b229c441468b013ae5fefa3d9/ESCPOS_NET/ByteSplicer.cs#L7-L20

I mention it, because it looks like this method is not ready to use other type of params. That would simplify a little bit your code and avoid potential exception to be thrown

public static byte[] Combine(params byte[] byteArrays)
{
    var builder = new ByteArrayBuilder();
    foreach (var byteArray in byteArrays)
        builder.Append(byteArray);

    return builder.ToArray();
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lukevpcommented, Jun 3, 2020

I’ll update this in the next version, thanks for the feedback!

0reactions
igorocamposcommented, Jun 3, 2020

Hmm, I see… There is sanitation before converting the string to byte[]. And this is going to be different depending on the emitter, is that it?

Yeah, in that case I agree with you

Read more comments on GitHub >

github_iconTop Results From Across the Web

ByteSplicer.cs
Efficient, Easy to Use Thermal Printing & POS (Windows/Linux/OSX, WiFi/BT/USB/Ethernet) - ESC-POS-.NET/ESCPOS_NET/ByteSplicer.cs at master · lukevp/ESC-POS- ...
Read more >
How to save and reuse print buffer? · Issue #72
Write(receipt); var copyOfReceipt = ByteSplicer. ... I was able to save the byte array and reuse it based the method you suggested above....
Read more >
c# - Print unicode in ESCPOS_NET
I need to print a Unicode Vietnamese. and my Code: string text = "Phiếu Tính Tiền"; var encoding = System.Text.Encoding.
Read more >
Feature #18598: Add String#bytesplice - Ruby master
I withdrew the proposal of String#bytesplice in #13110 because it may cause problems if the specified offset does not land on character boundary....
Read more >
Replace loading cutscene with something else..., page 2
bytesplicer: Top idea, those with slow hard drives can 'occupy' themselves during the loading process... I can forsee some people installing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found