Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pretty printing #2

Open
melvyniandrag opened this issue Oct 19, 2022 · 3 comments
Open

Add pretty printing #2

melvyniandrag opened this issue Oct 19, 2022 · 3 comments

Comments

@melvyniandrag
Copy link

Does this library have any way to create pretty strings from a message? Would be nice to say

var msg = Parse(string)
Console.WriteLine(msg.asPrettyString())

or something like this.

Would you like to have this in the library?

@Rickedb Rickedb added the question Further information is requested label Oct 21, 2022
@Rickedb
Copy link
Owner

Rickedb commented Oct 21, 2022

Hi @melvyniandrag, you mean printing MID data such as a json output or something like mentioned in #1?

@melvyniandrag
Copy link
Author

Hi @Rickedb yes exactly that. Any format really, json, csv, anything.

For now I've got stuff like this:

           String ret = "";
            ret += "MID0001 - Start Communication" + "\n";
            ret += "Length: " + mid.Header.Length + "\n";
            ret += "Mid: " + mid.Header.Mid +"\n";
            ret += "Revision: " + mid.Header.Revision +"\n";
            ret += "No Ack Flag: " + mid.Header.NoAckFlag +"\n";
            ret += "StationID: " + mid.Header.StationId +"\n";
            ret += "SpindleID: " + mid.Header.SpindleId + "\n";
            ret += "Spare: " + "Not implemented in library" + "\n";
            return ret;

Which is time consuming to write because I'm handling many MIDs.

I imagine the library has a clean way to loop over the values and stick them in a nice, readable format.

I only looked briefly, but I think there is a List in the classes that could be looped over to create a json, csv or whatever. Seems like it would be easy to implement this in one small function.

@Rickedb
Copy link
Owner

Rickedb commented Oct 26, 2022

I understand that logging is extremely necessary when dealing with OpenProtocol.
Although it's not the main purpose of the library, I still want to develop some easy way to print/log OP data to help out.

These months (or this year completely) are being a little tough to me due to many side projects, which is making me a little bit away of OpenProtocolInterpreter project. But I promise this and other features will come as soon as possible.

@Rickedb Rickedb removed the question Further information is requested label Oct 26, 2022
@Rickedb Rickedb transferred this issue from Rickedb/OpenProtocolInterpreter Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants