You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often deal with jumps on structures and need to create a new class rather than one and seek in between of serializations, sometimes is usefull to have the field address rather than sequential enforced
example1:[FieldAddress(40)]uint MyField1;
stream.Position;// eg. 20(SerializeMyField1)// at stream.Position 40
stream.Position=20;// Because of returnToCurrentPosition = true(SerializeMyField2)// at stream.Position 20(SerializeMyField3)// at stream.Position 24
example2:[FieldAddress(nameof(MyField2Address),returnToCurrentPosition=false)]uint MyField1;
stream.Position;// eg. 20(SerializeMyField1)// at stream.Position 40(SerializeMyField2)// at stream.Position 44(SerializeMyField3)// at stream.Position 48// Does not return to old position and continue from here
This will allow complex jumping, dazy chain, and unify classes.
Another use case:
classHeader:[FieldAddress(-4,SeekOrigin.End,true)][FieldOrder(0)] uint Checksum;// Last uint on the file[FieldAddress(0,SeekOrigin.Begin,true)]// Make sure we are on position 0[FieldOrder(1)]uintMyHeader1;// stream.position 0[FieldOrder(2)]uintMyHeader2;// stream.position 4[FieldOrder(3)]uintMyHeader3;// stream.position 8[FieldOrder(4)]uintMyHeader4;// stream.position 12
This way i dont need to deserialize all file first in order to validate my checksum
Of course this will raise other problem, on create file from scrath, in this case we have to write header as last operation or SetLength of file before hand
The text was updated successfully, but these errors were encountered:
I often deal with jumps on structures and need to create a new class rather than one and seek in between of serializations, sometimes is usefull to have the field address rather than sequential enforced
My proposal:
This will allow complex jumping, dazy chain, and unify classes.
Another use case:
This way i dont need to deserialize all file first in order to validate my checksum
Of course this will raise other problem, on create file from scrath, in this case we have to write header as last operation or SetLength of file before hand
The text was updated successfully, but these errors were encountered: