Dreamine.PLC.Mitsubishi.MxComponent
1.0.1
Dreamine.PLC.Mitsubishi.MxComponent 산업 자동화 및 I/O 기능을 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
MitsubishiMxDeviceNameFormatter.cs
이 파일의 문서화 페이지로 가기
1
using
System.Globalization;
2
using
Dreamine.PLC.Abstractions.Devices;
3
4
namespace
Dreamine.PLC.Mitsubishi.MxComponent.Devices
;
5
14
public
static
class
MitsubishiMxDeviceNameFormatter
15
{
48
public
static
string
Format
(PlcAddress address)
49
{
50
var prefix = address.DeviceType
switch
51
{
52
PlcDeviceType.D =>
"D"
,
53
PlcDeviceType.M =>
"M"
,
54
PlcDeviceType.X =>
"X"
,
55
PlcDeviceType.Y =>
"Y"
,
56
PlcDeviceType.B =>
"B"
,
57
PlcDeviceType.W =>
"W"
,
58
PlcDeviceType.R =>
"R"
,
59
PlcDeviceType.ZR =>
"ZR"
,
60
_ =>
throw
new
NotSupportedException($
"Unsupported MX Component device type: {address.DeviceType}"
)
61
};
62
63
var offset = address.DeviceType is PlcDeviceType.X or PlcDeviceType.Y or PlcDeviceType.B or PlcDeviceType.W
64
? address.Offset.ToString(
"X"
, CultureInfo.InvariantCulture)
65
: address.Offset.ToString(CultureInfo.InvariantCulture);
66
67
return
address.BitOffset.HasValue
68
? $
"{prefix}{offset}.{address.BitOffset.Value}"
69
: $
"{prefix}{offset}"
;
70
}
71
112
public
static
string
FormatOffset
(PlcAddress address,
int
delta)
113
{
114
return
Format
(address with { Offset = address.Offset + delta });
115
}
116
}
Dreamine.PLC.Mitsubishi.MxComponent.Devices
Definition
MitsubishiMxDeviceNameFormatter.cs:4
Dreamine.PLC.Mitsubishi.MxComponent.Devices.MitsubishiMxDeviceNameFormatter
Definition
MitsubishiMxDeviceNameFormatter.cs:15
Dreamine.PLC.Mitsubishi.MxComponent.Devices.MitsubishiMxDeviceNameFormatter.Format
static string Format(PlcAddress address)
Definition
MitsubishiMxDeviceNameFormatter.cs:48
Dreamine.PLC.Mitsubishi.MxComponent.Devices.MitsubishiMxDeviceNameFormatter.FormatOffset
static string FormatOffset(PlcAddress address, int delta)
Definition
MitsubishiMxDeviceNameFormatter.cs:112
Devices
MitsubishiMxDeviceNameFormatter.cs
다음에 의해 생성됨 :
1.17.0