forked from jefffhaynes/BinarySerializer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8e6f78
commit 4e04b96
Showing
6 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public class GenericNACKPayload : dPayload | ||
{ | ||
[FieldOrder(0)] | ||
[FieldLength(1)] | ||
public byte NackCode { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public class Packet | ||
{ | ||
[FieldOrder(0)] | ||
public byte ProtocolVersion { get; set; } | ||
|
||
[FieldOrder(1)] | ||
public byte InvProtocolVersion { get; set; } | ||
|
||
[FieldOrder(2)] | ||
public dPayloadType PayloadType { get; set; } | ||
|
||
[FieldOrder(3)] | ||
public UInt32 PayloadLength { get; set; } | ||
|
||
[FieldOrder(4)] | ||
[FieldLength(nameof(PayloadLength))] | ||
[Subtype(nameof(PayloadType), dPayloadType.GenericNACK, typeof(GenericNACKPayload))] | ||
[Subtype(nameof(PayloadType), dPayloadType.Request, typeof(Request))] | ||
[Subtype(nameof(PayloadType), dPayloadType.UserData, typeof(UserData))] | ||
public dPayload Payload { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public class Request : dPayload | ||
{ | ||
[FieldOrder(0)] | ||
public byte[] EID { get; set; } // Size is equal to PayloadLength | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public class UserData : dPayload | ||
{ | ||
[FieldOrder(0)] | ||
public byte SA { get; set; } | ||
[FieldOrder(1)] | ||
public byte TA { get; set; } | ||
[FieldOrder(2)] | ||
public byte[] UD { get; set; } // Size is equal to PayloadLength - 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public abstract class dPayload | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace BinarySerialization.Test.Issues.Issue151 | ||
{ | ||
public enum dPayloadType | ||
{ | ||
GenericNACK, | ||
Request, | ||
UserData | ||
} | ||
} |