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

FieldLengthAttribute where length value includes size of field that stores length #228

Open
lOlbas opened this issue Nov 13, 2023 · 0 comments

Comments

@lOlbas
Copy link

lOlbas commented Nov 13, 2023

Consider the following payload:

          00 01 02 03 04 05
00000000  06 00 01 02 03 04

First two bytes indicate the size of the entire payload, not just the data after it. This is the way I would describe this message:

public class RootEvent
{
    [FieldOrder(1)]
    public ushort DataLength;

    [FieldOrder(2)]
    [FieldLength(nameof(DataLength), -sizeof(ushort)] // Second parameter is "adjustment" for the actual length
    public object Data;
}

However I don't seem to find a way to implement something similar using this library, did I miss something? 🤔

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

1 participant