2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-10-30 15:41:35 +00:00
This commit is contained in:
2025-10-15 17:34:18 +03:00
parent 9386cc7a84
commit a63a9b5511
11 changed files with 477 additions and 172 deletions

View File

@@ -188,13 +188,13 @@ public class IIPAuthPacket : Packet
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
(var size, DataType) = ParsedTDU.Parse(data, offset, ends);
DataType = ParsedTDU.Parse(data, offset, ends);
if (DataType == null)
return -(int)size;
if (DataType.Value.Class == TDUClass.Invalid)
return -(int)DataType.Value.TotalLength;
offset += (uint)size;
offset += (uint)DataType.Value.TotalLength;
}
else if (Command == IIPAuthPacketCommand.Acknowledge)
@@ -208,13 +208,13 @@ public class IIPAuthPacket : Packet
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
(var size, DataType) = ParsedTDU.Parse(data, offset, ends);
DataType = ParsedTDU.Parse(data, offset, ends);
if (DataType == null)
return -(int)size;
if (DataType.Value.Class == TDUClass.Invalid)
return -(int)DataType.Value.TotalLength;
offset += (uint)size;
offset += (uint)DataType.Value.TotalLength;
}
else if (Command == IIPAuthPacketCommand.Action)
{
@@ -280,12 +280,12 @@ public class IIPAuthPacket : Packet
Reference = data.GetUInt32(offset, Endian.Little);
offset += 4;
(var size, DataType) = ParsedTDU.Parse(data, offset, ends);
DataType = ParsedTDU.Parse(data, offset, ends);
if (DataType == null)
return -(int)size;
if (DataType.Value.Class == TDUClass.Invalid)
return -(int)DataType.Value.TotalLength;
offset += (uint)size;
offset += (uint)DataType.Value.TotalLength;
}
else if (Action == IIPAuthPacketAction.IAuthHashed)
@@ -445,12 +445,12 @@ public class IIPAuthPacket : Packet
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
(var size, DataType) = ParsedTDU.Parse(data, offset, ends);
DataType = ParsedTDU.Parse(data, offset, ends);
if (DataType == null)
return -(int)size;
if (DataType.Value.Class == TDUClass.Invalid)
return -(int)DataType.Value.TotalLength;
offset += (uint)size;
offset += (uint)DataType.Value.TotalLength;
}
}

View File

@@ -37,10 +37,10 @@ class IIPPacket : Packet
public uint CallbackId { get; set; }
public IIPPacketMethod Method { get; set; }
public IIPPacketRequest Request { get; set; }
public IIPPacketReply Reply { get; set; }
public IIPPacketRequest Request { get; set; }
public IIPPacketReply Reply { get; set; }
public IIPPacketNotification Notification { get; set; }
public IIPPacketNotification Notification { get; set; }
public byte Extension { get; set; }
@@ -57,12 +57,12 @@ class IIPPacket : Packet
public override string ToString()
{
return Method switch
return Method switch
{
IIPPacketMethod.Notification => $"{Method} {Notification}",
IIPPacketMethod.Request => $"{Method} {Request}",
IIPPacketMethod.Reply => $"{Method} {Reply}",
IIPPacketMethod.Extension => $"{Method} {Extension}",
IIPPacketMethod.Request => $"{Method} {Request}",
IIPPacketMethod.Reply => $"{Method} {Reply}",
IIPPacketMethod.Extension => $"{Method} {Extension}",
_ => $"{Method}"
};
}
@@ -124,12 +124,12 @@ class IIPPacket : Packet
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
(var size, DataType) = ParsedTDU.Parse(data, offset, ends);
DataType = ParsedTDU.Parse(data, offset, ends);
if (DataType == null)
return -(int)size;
if (DataType.Value.Class == TDUClass.Invalid)
return -(int)DataType.Value.TotalLength;
offset += (uint)size;
offset += (uint)DataType.Value.TotalLength;
}
else
{