-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
13 changed files
with
345 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
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Byte1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
public partial GeneratedEnumByte Byte1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumByte)this[0]; | ||
} | ||
set | ||
{ | ||
this[0] = (byte)value; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Byte2.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
public partial GeneratedEnumByte Byte2 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumByte)this[this.AnOffset]; | ||
} | ||
set | ||
{ | ||
this[this.AnOffset] = (byte)value; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Byte3.g.cs
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,34 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
protected partial GeneratedEnumByte[] Byte3 | ||
{ | ||
get | ||
{ | ||
GeneratedEnumByte[] result = new GeneratedEnumByte[this.ALength]; | ||
|
||
for (int i = 0; i < this.ALength; i++) | ||
{ | ||
result[i] = (GeneratedEnumByte)this[this.AnOffset + i]; | ||
} | ||
|
||
return result; | ||
} | ||
set | ||
{ | ||
if (value.Length != this.ALength) | ||
{ | ||
throw new ArgumentOutOfRangeException(nameof(value.Length), value.Length, $"{nameof(value.Length)} must be equal to: {this.ALength}"); | ||
} | ||
|
||
for (int i = 0; i < this.ALength; i++) | ||
{ | ||
this[this.AnOffset + i] = (byte)value[i]; | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Int1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
partial GeneratedEnumInt Int1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumInt)BinaryPrimitives.ReadInt32LittleEndian(this.AsSpan(5, 4)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteInt32LittleEndian(this.AsSpan(5, 4), (int)value); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Int2.g.cs
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,34 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
partial GeneratedEnumInt[] Int2 | ||
{ | ||
get | ||
{ | ||
GeneratedEnumInt[] result = new GeneratedEnumInt[this.ALength]; | ||
|
||
for (int i = 0; i < this.ALength; i++) | ||
{ | ||
result[i] = (GeneratedEnumInt)BinaryPrimitives.ReadInt32LittleEndian(this.AsSpan(9 + (i * 4), 4)); | ||
} | ||
|
||
return result; | ||
} | ||
set | ||
{ | ||
if (value.Length != this.ALength) | ||
{ | ||
throw new ArgumentOutOfRangeException(nameof(value.Length), value.Length, $"{nameof(value.Length)} must be equal to: {this.ALength}"); | ||
} | ||
|
||
for (int i = 0; i < this.ALength; i++) | ||
{ | ||
BinaryPrimitives.WriteInt32LittleEndian(this.AsSpan(9 + (i * 4), 4), (int)value[i]); | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Long1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
public partial GeneratedEnumLong Long1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumLong)BinaryPrimitives.ReadInt64LittleEndian(this.AsSpan(7, 8)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteInt64LittleEndian(this.AsSpan(7, 8), (long)value); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.SByte1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
internal partial GeneratedEnumSByte SByte1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumSByte)(sbyte)this[1]; | ||
} | ||
set | ||
{ | ||
this[1] = (byte)value; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.Short1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
private partial GeneratedEnumShort Short1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumShort)BinaryPrimitives.ReadInt16LittleEndian(this.AsSpan(3, 2)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteInt16LittleEndian(this.AsSpan(3, 2), (short)value); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.UInt1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
protected private partial GeneratedEnumUInt UInt1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumUInt)BinaryPrimitives.ReadUInt32LittleEndian(this.AsSpan(4, 4)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteUInt32LittleEndian(this.AsSpan(4, 4), (uint)value); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.ULong1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
partial GeneratedEnumULong ULong1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumULong)BinaryPrimitives.ReadUInt64LittleEndian(this.AsSpan(6, 8)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteUInt64LittleEndian(this.AsSpan(6, 8), (ulong)value); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.UShort1.g.cs
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,19 @@ | ||
using RyuSocks.Packets; | ||
using System; | ||
using System.Buffers.Binary; | ||
using System.Text; | ||
|
||
partial class TestPacket | ||
{ | ||
protected partial GeneratedEnumUShort UShort1 | ||
{ | ||
get | ||
{ | ||
return (GeneratedEnumUShort)BinaryPrimitives.ReadUInt16LittleEndian(this.AsSpan(2, 2)); | ||
} | ||
set | ||
{ | ||
BinaryPrimitives.WriteUInt16LittleEndian(this.AsSpan(2, 2), (ushort)value); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
RyuSocks.Generator.Test/data/PacketGenerator/GeneratedTypes/TestPacket.cs
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,40 @@ | ||
using RyuSocks.Packets; | ||
|
||
public partial class TestPacket : Packet | ||
{ | ||
private int AnOffset => 2; | ||
protected int ALength => 3; | ||
|
||
[PacketField(0, AssumeGeneratedEnumType="byte")] | ||
public partial GeneratedEnumByte Byte1 { get; set; } | ||
|
||
[PacketField(1, AssumeGeneratedEnumType="SBYTE")] | ||
internal partial GeneratedEnumSByte SByte1 { get; set; } | ||
|
||
[PacketField(2, AssumeGeneratedEnumType="UsHoRt")] | ||
protected partial GeneratedEnumUShort UShort1 { get; set; } | ||
|
||
[PacketField(3, AssumeGeneratedEnumType="sHoRt")] | ||
private partial GeneratedEnumShort Short1 { get; set; } | ||
|
||
[PacketField(4, AssumeGeneratedEnumType="uint")] | ||
protected private partial GeneratedEnumUInt UInt1 { get; set; } | ||
|
||
[PacketField(5, AssumeGeneratedEnumType="int")] | ||
partial GeneratedEnumInt Int1 { get; set; } | ||
|
||
[PacketField(6, AssumeGeneratedEnumType="ulong")] | ||
partial GeneratedEnumULong ULong1 { get; set; } | ||
|
||
[PacketField(7, AssumeGeneratedEnumType="long")] | ||
public partial GeneratedEnumLong Long1 { get; set; } | ||
|
||
[PacketField(nameof(AnOffset), AssumeGeneratedEnumType="byte")] | ||
public partial GeneratedEnumByte Byte2 { get; set; } | ||
|
||
[PacketField(9, LengthMember = nameof(ALength), AssumeGeneratedEnumType="int")] | ||
partial GeneratedEnumInt[] Int2 { get; set; } | ||
|
||
[PacketField(nameof(AnOffset), LengthMember = nameof(ALength), AssumeGeneratedEnumType="byte")] | ||
protected partial GeneratedEnumByte[] Byte3 { get; set; } | ||
} |