[Refactor] Convert to switch expressions.

This commit is contained in:
2024-05-01 17:18:37 +01:00
parent 87613c03b7
commit b75fcf0f41
48 changed files with 1321 additions and 2619 deletions

View File

@@ -570,28 +570,19 @@ public partial class Device
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout,
out double duration)
{
switch(responseForm)
{
case SscPositionForms.Long:
case SscPositionForms.OldLong:
case SscPositionForms.OldLongTclpVendor:
case SscPositionForms.OldLongVendor:
case SscPositionForms.Extended:
buffer = new byte[32];
break;
case SscPositionForms.OldTclp:
case SscPositionForms.OldTclpVendor:
case SscPositionForms.Short:
case SscPositionForms.VendorShort:
buffer = new byte[20];
break;
default:
buffer = new byte[32]; // Invalid
break;
}
buffer = responseForm switch
{
SscPositionForms.Long
or SscPositionForms.OldLong
or SscPositionForms.OldLongTclpVendor
or SscPositionForms.OldLongVendor
or SscPositionForms.Extended => new byte[32],
SscPositionForms.OldTclp
or SscPositionForms.OldTclpVendor
or SscPositionForms.Short
or SscPositionForms.VendorShort => new byte[20],
_ => new byte[32]
};
var cdb = new byte[10];
senseBuffer = new byte[64];