From feb4b1e35f2d9f4e50f89f7be9503b598bbcb718 Mon Sep 17 00:00:00 2001
From: Timothy Nunnink <46979634+tnunnink@users.noreply.github.com>
Date: Fri, 8 Dec 2023 13:18:22 -0600
Subject: [PATCH] removed old content
---
src/.idea/.idea.L5Sharp/.idea/workspace.xml | 259 +-
src/L5Sharp.Core/L5Sharp.Core.csproj | 3 +
src/L5Sharp/Common/Address.cs | 175 -
src/L5Sharp/Common/Argument.cs | 253 -
src/L5Sharp/Common/ComponentKey.cs | 82 -
src/L5Sharp/Common/CrossReference.cs | 165 -
src/L5Sharp/Common/Dimensions.cs | 343 -
src/L5Sharp/Common/Instruction.cs | 1735 ---
src/L5Sharp/Common/NeutralText.cs | 177 -
src/L5Sharp/Common/ProductType.cs | 116 -
src/L5Sharp/Common/Revision.cs | 165 -
src/L5Sharp/Common/ScanRate.cs | 90 -
src/L5Sharp/Common/TagMap.cs | 38 -
src/L5Sharp/Common/TagName.cs | 465 -
src/L5Sharp/Common/TaskPriority.cs | 81 -
src/L5Sharp/Common/Vendor.cs | 104 -
src/L5Sharp/Common/Watchdog.cs | 90 -
src/L5Sharp/Components/AddOnInstruction.cs | 269 -
src/L5Sharp/Components/Controller.cs | 328 -
src/L5Sharp/Components/DataType.cs | 117 -
src/L5Sharp/Components/Module.cs | 438 -
src/L5Sharp/Components/Program.cs | 195 -
src/L5Sharp/Components/Routine.cs | 118 -
src/L5Sharp/Components/Tag.cs | 759 --
src/L5Sharp/Components/Task.cs | 215 -
src/L5Sharp/Components/Trend.cs | 381 -
src/L5Sharp/Components/WatchList.cs | 88 -
src/L5Sharp/Elements/Block.cs | 1056 --
src/L5Sharp/Elements/Chart.cs | 53 -
src/L5Sharp/Elements/Communications.cs | 51 -
src/L5Sharp/Elements/Connection.cs | 197 -
src/L5Sharp/Elements/DataTypeMember.cs | 162 -
src/L5Sharp/Elements/Diagram.cs | 143 -
src/L5Sharp/Elements/DiagramElement.cs | 175 -
src/L5Sharp/Elements/Line.cs | 98 -
src/L5Sharp/Elements/Parameter.cs | 204 -
src/L5Sharp/Elements/ParameterConnection.cs | 54 -
src/L5Sharp/Elements/Pen.cs | 153 -
src/L5Sharp/Elements/Port.cs | 119 -
src/L5Sharp/Elements/RedundancyInfo.cs | 73 -
src/L5Sharp/Elements/Rung.cs | 214 -
src/L5Sharp/Elements/SafetyInfo.cs | 89 -
src/L5Sharp/Elements/Security.cs | 82 -
src/L5Sharp/Elements/Sheet.cs | 248 -
src/L5Sharp/Elements/TextBox.cs | 77 -
src/L5Sharp/Elements/WatchTag.cs | 52 -
src/L5Sharp/Elements/Wire.cs | 115 -
src/L5Sharp/Enums/CaptureSizeType.cs | 26 -
src/L5Sharp/Enums/ComponentType.cs | 64 -
src/L5Sharp/Enums/ConnectionPriority.cs | 31 -
src/L5Sharp/Enums/ConnectionType.cs | 74 -
src/L5Sharp/Enums/DataFormat.cs | 44 -
src/L5Sharp/Enums/DataTypeClass.cs | 43 -
src/L5Sharp/Enums/DataTypeFamily.cs | 24 -
src/L5Sharp/Enums/DiagramType.cs | 49 -
src/L5Sharp/Enums/Direction.cs | 23 -
src/L5Sharp/Enums/ElectronicKeying.cs | 31 -
src/L5Sharp/Enums/ExternalAccess.cs | 29 -
src/L5Sharp/Enums/Keyword.cs | 124 -
src/L5Sharp/Enums/ModuleCategory.cs | 47 -
src/L5Sharp/Enums/OnlineEditType.cs | 26 -
src/L5Sharp/Enums/Operator.cs | 96 -
src/L5Sharp/Enums/PassThroughOption.cs | 27 -
src/L5Sharp/Enums/PenType.cs | 26 -
src/L5Sharp/Enums/ProductionTrigger.cs | 26 -
src/L5Sharp/Enums/ProgramType.cs | 21 -
src/L5Sharp/Enums/Radix.cs | 754 --
src/L5Sharp/Enums/RoutineType.cs | 46 -
src/L5Sharp/Enums/RungType.cs | 66 -
src/L5Sharp/Enums/SFCExecutionControl.cs | 21 -
src/L5Sharp/Enums/SFCLastScan.cs | 26 -
src/L5Sharp/Enums/SFCRestartPosition.cs | 21 -
src/L5Sharp/Enums/SamplesType.cs | 21 -
src/L5Sharp/Enums/Scope.cs | 100 -
src/L5Sharp/Enums/SheetOrientation.cs | 21 -
src/L5Sharp/Enums/SheetSize.cs | 76 -
src/L5Sharp/Enums/TagType.cs | 31 -
src/L5Sharp/Enums/TagUsage.cs | 62 -
src/L5Sharp/Enums/TaskEventTrigger.cs | 61 -
src/L5Sharp/Enums/TaskType.cs | 27 -
src/L5Sharp/Enums/TokenType.cs | 37 -
src/L5Sharp/Enums/TransmissionType.cs | 26 -
src/L5Sharp/Enums/TriggerOperation.cs | 102 -
src/L5Sharp/Enums/TriggerTargetType.cs | 21 -
src/L5Sharp/Enums/TriggerType.cs | 21 -
src/L5Sharp/Enums/Use.cs | 66 -
src/L5Sharp/ILogixReferencable.cs | 20 -
src/L5Sharp/ILogixSerializable.cs | 15 -
src/L5Sharp/L5Sharp.csproj | 42 -
src/L5Sharp/L5Sharp.csproj.DotSettings | 10 -
src/L5Sharp/L5X.cs | 1245 ---
src/L5Sharp/L5XInfo.cs | 91 -
src/L5Sharp/Logix.cs | 14 -
src/L5Sharp/LogixCode.cs | 78 -
src/L5Sharp/LogixComponent.cs | 180 -
src/L5Sharp/LogixContainer.cs | 359 -
src/L5Sharp/LogixData.cs | 279 -
src/L5Sharp/LogixElement.cs | 767 --
src/L5Sharp/LogixEnum.cs | 336 -
src/L5Sharp/LogixIndex.cs | 385 -
src/L5Sharp/LogixMember.cs | 295 -
src/L5Sharp/LogixSerializer.cs | 140 -
src/L5Sharp/LogixType.cs | 363 -
src/L5Sharp/Types/ArrayType.cs | 405 -
src/L5Sharp/Types/Atomic.cs | 101 -
src/L5Sharp/Types/AtomicType.cs | 95 -
src/L5Sharp/Types/Atomics/BOOL.cs | 305 -
src/L5Sharp/Types/Atomics/DINT.cs | 305 -
src/L5Sharp/Types/Atomics/INT.cs | 390 -
src/L5Sharp/Types/Atomics/LINT.cs | 304 -
src/L5Sharp/Types/Atomics/LREAL.cs | 275 -
src/L5Sharp/Types/Atomics/REAL.cs | 275 -
src/L5Sharp/Types/Atomics/SINT.cs | 299 -
src/L5Sharp/Types/Atomics/UDINT.cs | 303 -
src/L5Sharp/Types/Atomics/UINT.cs | 299 -
src/L5Sharp/Types/Atomics/ULINT.cs | 299 -
src/L5Sharp/Types/Atomics/USINT.cs | 299 -
src/L5Sharp/Types/ComplexType.cs | 119 -
src/L5Sharp/Types/NullType.cs | 40 -
src/L5Sharp/Types/Predefined/ALARM.cs | 266 -
src/L5Sharp/Types/Predefined/ALARM_ANALOG.cs | 689 --
src/L5Sharp/Types/Predefined/ALARM_DIGITAL.cs | 319 -
src/L5Sharp/Types/Predefined/CONTROL.cs | 126 -
src/L5Sharp/Types/Predefined/COUNTER.cs | 96 -
src/L5Sharp/Types/Predefined/MESSAGE.cs | 184 -
src/L5Sharp/Types/Predefined/PHASE.cs | 544 -
src/L5Sharp/Types/Predefined/PID.cs | 589 --
src/L5Sharp/Types/Predefined/STRING.cs | 54 -
src/L5Sharp/Types/Predefined/TIMER.cs | 93 -
src/L5Sharp/Types/StringType.cs | 306 -
src/L5Sharp/Types/StructureType.cs | 361 -
src/L5Sharp/Utilities/Catalog/CatalogEntry.cs | 56 -
.../Utilities/Catalog/ModuleCatalog.cs | 193 -
src/L5Sharp/Utilities/Catalog/PortInfo.cs | 29 -
src/L5Sharp/Utilities/L5XExtensions.cs | 236 -
src/L5Sharp/Utilities/L5XName.cs | 9378 -----------------
src/L5Sharp/Utilities/L5XParser.cs | 124 -
src/L5Sharp/Utilities/L5XTypeAttribute.cs | 52 -
138 files changed, 6 insertions(+), 35522 deletions(-)
delete mode 100644 src/L5Sharp/Common/Address.cs
delete mode 100644 src/L5Sharp/Common/Argument.cs
delete mode 100644 src/L5Sharp/Common/ComponentKey.cs
delete mode 100644 src/L5Sharp/Common/CrossReference.cs
delete mode 100644 src/L5Sharp/Common/Dimensions.cs
delete mode 100644 src/L5Sharp/Common/Instruction.cs
delete mode 100644 src/L5Sharp/Common/NeutralText.cs
delete mode 100644 src/L5Sharp/Common/ProductType.cs
delete mode 100644 src/L5Sharp/Common/Revision.cs
delete mode 100644 src/L5Sharp/Common/ScanRate.cs
delete mode 100644 src/L5Sharp/Common/TagMap.cs
delete mode 100644 src/L5Sharp/Common/TagName.cs
delete mode 100644 src/L5Sharp/Common/TaskPriority.cs
delete mode 100644 src/L5Sharp/Common/Vendor.cs
delete mode 100644 src/L5Sharp/Common/Watchdog.cs
delete mode 100644 src/L5Sharp/Components/AddOnInstruction.cs
delete mode 100644 src/L5Sharp/Components/Controller.cs
delete mode 100644 src/L5Sharp/Components/DataType.cs
delete mode 100644 src/L5Sharp/Components/Module.cs
delete mode 100644 src/L5Sharp/Components/Program.cs
delete mode 100644 src/L5Sharp/Components/Routine.cs
delete mode 100644 src/L5Sharp/Components/Tag.cs
delete mode 100644 src/L5Sharp/Components/Task.cs
delete mode 100644 src/L5Sharp/Components/Trend.cs
delete mode 100644 src/L5Sharp/Components/WatchList.cs
delete mode 100644 src/L5Sharp/Elements/Block.cs
delete mode 100644 src/L5Sharp/Elements/Chart.cs
delete mode 100644 src/L5Sharp/Elements/Communications.cs
delete mode 100644 src/L5Sharp/Elements/Connection.cs
delete mode 100644 src/L5Sharp/Elements/DataTypeMember.cs
delete mode 100644 src/L5Sharp/Elements/Diagram.cs
delete mode 100644 src/L5Sharp/Elements/DiagramElement.cs
delete mode 100644 src/L5Sharp/Elements/Line.cs
delete mode 100644 src/L5Sharp/Elements/Parameter.cs
delete mode 100644 src/L5Sharp/Elements/ParameterConnection.cs
delete mode 100644 src/L5Sharp/Elements/Pen.cs
delete mode 100644 src/L5Sharp/Elements/Port.cs
delete mode 100644 src/L5Sharp/Elements/RedundancyInfo.cs
delete mode 100644 src/L5Sharp/Elements/Rung.cs
delete mode 100644 src/L5Sharp/Elements/SafetyInfo.cs
delete mode 100644 src/L5Sharp/Elements/Security.cs
delete mode 100644 src/L5Sharp/Elements/Sheet.cs
delete mode 100644 src/L5Sharp/Elements/TextBox.cs
delete mode 100644 src/L5Sharp/Elements/WatchTag.cs
delete mode 100644 src/L5Sharp/Elements/Wire.cs
delete mode 100644 src/L5Sharp/Enums/CaptureSizeType.cs
delete mode 100644 src/L5Sharp/Enums/ComponentType.cs
delete mode 100644 src/L5Sharp/Enums/ConnectionPriority.cs
delete mode 100644 src/L5Sharp/Enums/ConnectionType.cs
delete mode 100644 src/L5Sharp/Enums/DataFormat.cs
delete mode 100644 src/L5Sharp/Enums/DataTypeClass.cs
delete mode 100644 src/L5Sharp/Enums/DataTypeFamily.cs
delete mode 100644 src/L5Sharp/Enums/DiagramType.cs
delete mode 100644 src/L5Sharp/Enums/Direction.cs
delete mode 100644 src/L5Sharp/Enums/ElectronicKeying.cs
delete mode 100644 src/L5Sharp/Enums/ExternalAccess.cs
delete mode 100644 src/L5Sharp/Enums/Keyword.cs
delete mode 100644 src/L5Sharp/Enums/ModuleCategory.cs
delete mode 100644 src/L5Sharp/Enums/OnlineEditType.cs
delete mode 100644 src/L5Sharp/Enums/Operator.cs
delete mode 100644 src/L5Sharp/Enums/PassThroughOption.cs
delete mode 100644 src/L5Sharp/Enums/PenType.cs
delete mode 100644 src/L5Sharp/Enums/ProductionTrigger.cs
delete mode 100644 src/L5Sharp/Enums/ProgramType.cs
delete mode 100644 src/L5Sharp/Enums/Radix.cs
delete mode 100644 src/L5Sharp/Enums/RoutineType.cs
delete mode 100644 src/L5Sharp/Enums/RungType.cs
delete mode 100644 src/L5Sharp/Enums/SFCExecutionControl.cs
delete mode 100644 src/L5Sharp/Enums/SFCLastScan.cs
delete mode 100644 src/L5Sharp/Enums/SFCRestartPosition.cs
delete mode 100644 src/L5Sharp/Enums/SamplesType.cs
delete mode 100644 src/L5Sharp/Enums/Scope.cs
delete mode 100644 src/L5Sharp/Enums/SheetOrientation.cs
delete mode 100644 src/L5Sharp/Enums/SheetSize.cs
delete mode 100644 src/L5Sharp/Enums/TagType.cs
delete mode 100644 src/L5Sharp/Enums/TagUsage.cs
delete mode 100644 src/L5Sharp/Enums/TaskEventTrigger.cs
delete mode 100644 src/L5Sharp/Enums/TaskType.cs
delete mode 100644 src/L5Sharp/Enums/TokenType.cs
delete mode 100644 src/L5Sharp/Enums/TransmissionType.cs
delete mode 100644 src/L5Sharp/Enums/TriggerOperation.cs
delete mode 100644 src/L5Sharp/Enums/TriggerTargetType.cs
delete mode 100644 src/L5Sharp/Enums/TriggerType.cs
delete mode 100644 src/L5Sharp/Enums/Use.cs
delete mode 100644 src/L5Sharp/ILogixReferencable.cs
delete mode 100644 src/L5Sharp/ILogixSerializable.cs
delete mode 100644 src/L5Sharp/L5Sharp.csproj
delete mode 100644 src/L5Sharp/L5Sharp.csproj.DotSettings
delete mode 100644 src/L5Sharp/L5X.cs
delete mode 100644 src/L5Sharp/L5XInfo.cs
delete mode 100644 src/L5Sharp/Logix.cs
delete mode 100644 src/L5Sharp/LogixCode.cs
delete mode 100644 src/L5Sharp/LogixComponent.cs
delete mode 100644 src/L5Sharp/LogixContainer.cs
delete mode 100644 src/L5Sharp/LogixData.cs
delete mode 100644 src/L5Sharp/LogixElement.cs
delete mode 100644 src/L5Sharp/LogixEnum.cs
delete mode 100644 src/L5Sharp/LogixIndex.cs
delete mode 100644 src/L5Sharp/LogixMember.cs
delete mode 100644 src/L5Sharp/LogixSerializer.cs
delete mode 100644 src/L5Sharp/LogixType.cs
delete mode 100644 src/L5Sharp/Types/ArrayType.cs
delete mode 100644 src/L5Sharp/Types/Atomic.cs
delete mode 100644 src/L5Sharp/Types/AtomicType.cs
delete mode 100644 src/L5Sharp/Types/Atomics/BOOL.cs
delete mode 100644 src/L5Sharp/Types/Atomics/DINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/INT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/LINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/LREAL.cs
delete mode 100644 src/L5Sharp/Types/Atomics/REAL.cs
delete mode 100644 src/L5Sharp/Types/Atomics/SINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/UDINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/UINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/ULINT.cs
delete mode 100644 src/L5Sharp/Types/Atomics/USINT.cs
delete mode 100644 src/L5Sharp/Types/ComplexType.cs
delete mode 100644 src/L5Sharp/Types/NullType.cs
delete mode 100644 src/L5Sharp/Types/Predefined/ALARM.cs
delete mode 100644 src/L5Sharp/Types/Predefined/ALARM_ANALOG.cs
delete mode 100644 src/L5Sharp/Types/Predefined/ALARM_DIGITAL.cs
delete mode 100644 src/L5Sharp/Types/Predefined/CONTROL.cs
delete mode 100644 src/L5Sharp/Types/Predefined/COUNTER.cs
delete mode 100644 src/L5Sharp/Types/Predefined/MESSAGE.cs
delete mode 100644 src/L5Sharp/Types/Predefined/PHASE.cs
delete mode 100644 src/L5Sharp/Types/Predefined/PID.cs
delete mode 100644 src/L5Sharp/Types/Predefined/STRING.cs
delete mode 100644 src/L5Sharp/Types/Predefined/TIMER.cs
delete mode 100644 src/L5Sharp/Types/StringType.cs
delete mode 100644 src/L5Sharp/Types/StructureType.cs
delete mode 100644 src/L5Sharp/Utilities/Catalog/CatalogEntry.cs
delete mode 100644 src/L5Sharp/Utilities/Catalog/ModuleCatalog.cs
delete mode 100644 src/L5Sharp/Utilities/Catalog/PortInfo.cs
delete mode 100644 src/L5Sharp/Utilities/L5XExtensions.cs
delete mode 100644 src/L5Sharp/Utilities/L5XName.cs
delete mode 100644 src/L5Sharp/Utilities/L5XParser.cs
delete mode 100644 src/L5Sharp/Utilities/L5XTypeAttribute.cs
diff --git a/src/.idea/.idea.L5Sharp/.idea/workspace.xml b/src/.idea/.idea.L5Sharp/.idea/workspace.xml
index f0eae5b3..00ce8d60 100644
--- a/src/.idea/.idea.L5Sharp/.idea/workspace.xml
+++ b/src/.idea/.idea.L5Sharp/.idea/workspace.xml
@@ -8,262 +8,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -309,10 +54,12 @@
+
+
diff --git a/src/L5Sharp.Core/L5Sharp.Core.csproj b/src/L5Sharp.Core/L5Sharp.Core.csproj
index cbe35062..91839e2e 100644
--- a/src/L5Sharp.Core/L5Sharp.Core.csproj
+++ b/src/L5Sharp.Core/L5Sharp.Core.csproj
@@ -22,6 +22,9 @@
Copyright (c) Timothy Nunnink 2022README.mdL5Sharp
+ https://github.com/tnunnink/L5Sharp
+
+ en-US
diff --git a/src/L5Sharp/Common/Address.cs b/src/L5Sharp/Common/Address.cs
deleted file mode 100644
index 1bfa1a10..00000000
--- a/src/L5Sharp/Common/Address.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-using System;
-using System.Linq;
-using System.Net;
-using System.Text.RegularExpressions;
-
-namespace L5Sharp.Core;
-
-///
-/// Provides a wrapper around the string port address value to indicate what type of address the value is.
-///
-public class Address
-{
- private readonly string _value;
-
- ///
- /// Creates a new with the provided string value.
- ///
- ///
- ///
- public Address(string address)
- {
- _value = address ?? throw new ArgumentNullException(nameof(address));
- }
-
- ///
- /// Indicates whether the current is a slot number address.
- ///
- /// true if the address value is a valid byte address; otherwise, false.
- public bool IsSlot => byte.TryParse(_value, out _);
-
- ///
- /// Indicates whether the current is a IPv4 address.
- ///
- /// true if the address value is a valid IPv4 address; otherwise, false.
- public bool IsIPv4 => _value.Count(c => c == '.') == 3 && IPAddress.TryParse(_value, out _);
-
- ///
- /// Indicates whether the current is a host name address.
- ///
- /// true if the address value is a valid host name address; otherwise, false.
- ///
- /// A host name must start with a letter, contain only alpha-numeric characters or special characters '.' and '-',
- /// and have a maximum length of 64 characters.
- ///
- public bool IsHostName => Regex.IsMatch(_value, "^[A-Za-z][A-Za-z0-9.-]{1,63}$");
-
- ///
- /// Indicates that the address value is an empty string.
- ///
- public bool IsEmpty => _value.IsEmpty();
-
- ///
- /// Represents no address value, or an empty string.
- ///
- public static Address None => new(string.Empty);
-
- ///
- /// Converts the current to a value.
- ///
- /// The value to convert.
- /// A representing the address value.
- public static implicit operator Address(string address) => new(address);
-
- ///
- /// Converts the current to a value.
- ///
- /// The value to convert.
- /// A representing the address value.
- public static implicit operator string(Address address) => address.ToString();
-
- ///
- /// Converts the current to a value.
- ///
- /// The value to convert.
- /// A representing the address value.
- public static implicit operator Address(byte address) => new(address.ToString());
-
- ///
- /// Converts the current to a value.
- ///
- /// The value to convert.
- /// A representing the address value.
- public static implicit operator byte(Address address) => byte.Parse(address._value);
-
- ///
- /// Creates a new instance from the provided object.
- ///
- /// The value that represents the port address.
- /// A new value from the provided IP.
- /// ipAddress is null.
- public static Address FromIP(IPAddress ipAddress)
- {
- if (ipAddress is null) throw new ArgumentNullException(nameof(ipAddress));
- return new Address(ipAddress.ToString());
- }
-
- ///
- /// Creates a new instance from the provided byte slot number value.
- ///
- /// the byte number value that represents the port address.
- /// A new value from the provided slot number.
- public static Address FromSlot(byte slot) => new(slot.ToString());
-
- ///
- /// Creates a new with the common default IP of 192.168.0.1.
- ///
- /// A with the default IP value.
- public static Address DefaultIP() => new("192.168.0.1");
-
- ///
- /// Creates a new with the default slot 0.
- ///
- /// A with the default slot value.
- public static Address DefaultSlot() => new("0");
-
- ///
- /// Creates a new with the specified slot number.
- ///
- /// The slot number to create.
- ///
- public static Address Slot(byte slot) => new($"{slot}");
-
- ///
- ///
- ///
- ///
- ///
- public IPAddress ToIPAddress() => IsIPv4
- ? IPAddress.Parse(_value)
- : throw new InvalidOperationException($"The current address '{_value}' is not a valid IP address");
-
- ///
- ///
- ///
- ///
- ///
- public byte ToSlot() => IsSlot
- ? byte.Parse(_value)
- : throw new InvalidOperationException($"The current address '{_value}' is not a valid slot number");
-
- ///
- public override string ToString() => _value;
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- Address other => string.Equals(_value, other._value, StringComparison.OrdinalIgnoreCase),
- string other => string.Equals(_value, other, StringComparison.OrdinalIgnoreCase),
- byte other => string.Equals(_value, other.ToString(), StringComparison.OrdinalIgnoreCase),
- IPAddress other => string.Equals(_value, other.ToString(), StringComparison.OrdinalIgnoreCase),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => _value.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(Address? left, Address? right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(Address? left, Address? right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Argument.cs b/src/L5Sharp/Common/Argument.cs
deleted file mode 100644
index 4194bd2c..00000000
--- a/src/L5Sharp/Common/Argument.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// Represents an argument to an instruction, which could be a tag name reference or an immediate atomic value.
-///
-public class Argument
-{
- private readonly object _value;
-
- ///
- /// Creates a new wrapping the object value.
- ///
- /// An object representing the argument.
- /// value is null.
- private Argument(object value)
- {
- _value = value ?? throw new ArgumentNullException(nameof(value));
- }
-
- ///
- /// Indicates whether the argument is an immediate atomic value.
- ///
- /// true if the underlying value is an object; Otherwise, false.
- public bool IsAtomic => _value is AtomicType;
-
- ///
- /// Indicates whether the argument is an expression or combination of tag names, operators, and/or immediate values.
- ///
- /// true if the underlying value is a instance wrapping a complex expression;
- /// Otherwise, false.
- public bool IsExpression => _value is NeutralText;
-
- ///
- /// Indicates whether the argument is an immediate value, either string literal or atomic value.
- ///
- /// true if the underlying value is an or object;
- /// Otherwise, false.
- public bool IsImmediate => _value is AtomicType or string;
-
- ///
- /// Indicates whether the argument is an tag name reference.
- ///
- /// true if the underlying value is a object; Otherwise, false.
- public bool IsTag => _value is TagName;
-
- ///
- /// Indicates whether the argument is a literal string value with the single quote identifiers.
- ///
- /// true if the underlying value is an object; Otherwise, false.
- public bool IsString => _value is string;
-
- ///
- /// The collection of values found in the argument.
- ///
- /// A of values.
- ///
- /// Since an argument could represent a complex expression, it may contain more than one tag name value.
- /// We need a way to get all tag names from a single argument whether it's a single tag name or expression or
- /// multiple tag names.
- ///
- public IEnumerable Tags => _value switch
- {
- TagName tagName => new[] { tagName },
- NeutralText text => text.Tags(),
- _ => Enumerable.Empty()
- };
-
- ///
- /// Represents an unknown argument that can be found in certain instruction text.
- ///
- /// A representing an unknown parameter.
- /// This is literally the '?' character, as often seen in the TIMER instruction arguments.
- public static Argument Unknown => new("?");
-
- ///
- /// Represents an empty argument.
- ///
- /// A wrapping an empty string objet value.
- ///
- /// Some instruction have an empty/optional argument(s) (GSV) and therefore we need a way to represent
- /// that value.
- ///
- public static Argument Empty => new(string.Empty);
-
- ///
- /// Parses the string input into a valid object.
- ///
- /// Teh string value to parse.
- /// A representing the string input.
- /// value is null or empty
- /// This parse method expects the string to be an immediate value,
- /// a single value, or an expression that can be represented as
- /// type.
- ///
- public static Argument Parse(string? value)
- {
- //Empty value - lets not crash on empty or invalid arguments.
- if (string.IsNullOrEmpty(value)) return Empty;
-
- //Unknown value - Can be found in TON instructions and probably others.
- if (value == "?") return Unknown;
-
- //Literal string value - We need to intercept this before the Atomic.TryParse method to prevent exceptions.
- if (value.StartsWith('\'') && value.EndsWith('\'')) return new Argument(value);
-
- //Immediate atomic value
- if (Atomic.TryParse(value, out var atomic) && atomic is not null) return new Argument(atomic);
-
- //TagName or Expression otherwise
- return TagName.IsTag(value) ? new Argument(new TagName(value)) : new Argument(new NeutralText(value));
- }
-
- ///
- /// Implicitly converts the provided to an .
- ///
- /// The object to convert.
- /// A object containing the value of the tag name.
- public static implicit operator Argument(TagName tagName) => new(tagName);
-
- ///
- /// Implicitly converts the provided to an .
- ///
- /// The object to convert.
- /// A object containing the value of the tag name.
- public static implicit operator Argument(string value) => Parse(value);
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(bool value) => new(new BOOL(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(sbyte value) => new(new SINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(byte value) => new(new USINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(short value) => new(new INT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(ushort value) => new(new UINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(int value) => new(new DINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(uint value) => new(new UDINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(long value) => new(new LINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(ulong value) => new(new ULINT(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(float value) => new(new REAL(value));
-
- ///
- /// Implicitly converts the provided value to an .
- ///
- /// The object value to convert.
- /// An containing the value of the provided object.
- public static implicit operator Argument(double value) => new(new LREAL(value));
-
- ///
- /// Explicitly converts the provided to a .
- ///
- /// The object to convert.
- /// A object representing the value of the argument.
- public static explicit operator TagName(Argument argument) => (TagName)argument._value;
-
- ///
- /// Explicitly converts the provided to an .
- ///
- /// The object to convert.
- /// A object representing the value of the argument.
- public static explicit operator AtomicType(Argument argument) => (AtomicType)argument._value;
-
- ///
- /// Explicitly converts the provided to an .
- ///
- /// The object to convert.
- /// A object representing the value of the argument.
- public static explicit operator NeutralText(Argument argument) => (NeutralText)argument._value;
-
- ///
- public override bool Equals(object? obj) => _value.Equals(obj);
-
- ///
- public override int GetHashCode() => _value.GetHashCode();
-
- ///
- public override string ToString() => _value.ToString();
-
- ///
- /// Determines whether two Argument objects are equal.
- ///
- /// The left Argument object.
- /// The right Argument object.
- /// Returns true if the two objects are equal, otherwise false.
- public static bool operator ==(Argument left, Argument right) => Equals(left, right);
-
- ///
- /// Defines the inequality operator for the Argument class.
- ///
- /// The left Argument object.
- /// The right Argument object.
- /// true if the left Argument is not equal to the right Argument; otherwise, false.
- public static bool operator !=(Argument left, Argument right) => Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/ComponentKey.cs b/src/L5Sharp/Common/ComponentKey.cs
deleted file mode 100644
index b66729f8..00000000
--- a/src/L5Sharp/Common/ComponentKey.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-
-namespace L5Sharp.Core;
-
-///
-/// A composite key for a logix component that can be used to uniquely identify a component in the L5X file.
-///
-///
-/// This is an library construct that is primarily used for indexing and quick lookup of components
-/// and their references within a give L5X file. Since components of different types can have the same name,
-/// we consider both the component type and name to be the unique identifier.
-///
-public readonly struct ComponentKey : IEquatable
-{
- private readonly string _type;
- private readonly string _name;
-
- ///
- /// Creates a new value type with the provided parameters.
- ///
- /// The logix type the component represents (DataType, Tag, etc.)
- /// The base name of the component.
- public ComponentKey(string type, string name)
- {
- _type = type ?? throw new ArgumentNullException(nameof(type));
- _name = name ?? throw new ArgumentNullException(nameof(name));
- }
-
- ///
- /// Determines if this key has the specified component name.
- ///
- /// The name of the component to test.
- /// true if the component key has the provided name; Otherwise, false.
- public bool HasName(string name) => string.Equals(_name, name, StringComparison.OrdinalIgnoreCase);
-
- ///
- /// Determines if this key is of the specified component type name.
- ///
- /// The component type to check.
- /// true if the component key is of the provided type name; Otherwise, false.
- public bool IsType(string type) => _type.IsEquivalent(type);
-
- ///
- /// Determines if this key is of the specified component type parameter.
- ///
- /// The component type to check
- /// true if the component key is of the provided type parameter; Otherwise, false.
- public bool IsType() where TComponent : LogixComponent =>
- _type.IsEquivalent(typeof(TComponent).L5XType());
-
- ///
- public bool Equals(ComponentKey other) =>
- StringComparer.OrdinalIgnoreCase.Equals(_type, other._type) &&
- StringComparer.OrdinalIgnoreCase.Equals(_name, other._name);
-
- ///
- public override bool Equals(object? obj) => obj is ComponentKey other && Equals(other);
-
- ///
- public override int GetHashCode() =>
- StringComparer.OrdinalIgnoreCase.GetHashCode(_type) ^
- StringComparer.OrdinalIgnoreCase.GetHashCode(_name);
-
- ///
- /// Determines if two objects are equal.
- ///
- /// The first object to compare.
- /// The second object to compare.
- /// true if the objects have the same type and name property; Otherwise, false.
- public static bool operator ==(ComponentKey left, ComponentKey right) => Equals(left, right);
-
- ///
- /// Determines if two objects are not equal.
- ///
- /// The first object to compare.
- /// The second object to compare.
- /// true if the objects have the same type and name property; Otherwise, false.
- public static bool operator !=(ComponentKey left, ComponentKey right) => !Equals(left, right);
-
- ///
- public override string ToString() => $"[{_type}]{_name}";
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/CrossReference.cs b/src/L5Sharp/Common/CrossReference.cs
deleted file mode 100644
index ebb7fec4..00000000
--- a/src/L5Sharp/Common/CrossReference.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using System;
-using System.Linq;
-using System.Xml.Linq;
-using JetBrains.Annotations;
-
-namespace L5Sharp.Core;
-
-///
-/// Represents a reference to a component within a Logix project. This could be a code reference or a reference
-/// from another component. This class is meant to provide a uniform set of information for all types of references,
-/// however, code references have some additional information that is useful for further identifying the target or
-/// location of the reference.
-///
-[PublicAPI]
-public class CrossReference
-{
- private readonly XElement _element;
-
- ///
- /// Creates a new with a referencing element, component name and type, and optional instruction data.
- ///
- /// The referencing object.
- /// The type of the component that is being referenced.
- /// The name of the component that is being referenced.
- /// The optional instruction name/key for the reference.
- /// This is intended for code references as opposed to component references. Will be null if not applicable.
- ///
- /// element, type, or name is null.
- public CrossReference(XElement element, string type, string reference, string? instruction = null,
- string? operand = null)
- {
- _element = element ?? throw new ArgumentNullException(nameof(element));
-
- if (string.IsNullOrEmpty(type))
- throw new ArgumentException("Type cannot be null or empty.", nameof(type));
- if (string.IsNullOrEmpty(reference))
- throw new ArgumentException("Name cannot be null or empty.", nameof(reference));
-
- Type = type;
- Reference = reference;
- Instruction = instruction;
- Operand = operand;
- }
-
- ///
- /// The corresponding of the reference, indicating both the component type and name
- /// this element is in reference to.
- ///
- public ComponentKey Key => new(Type, Reference);
-
- ///
- /// The type of the component the element references.
- ///
- /// A indicating the type of the component.
- public string Type { get; }
-
- ///
- /// The name of the component or element that is referenced.
- ///
- /// A indicating the name of the component.
- public string Reference { get; }
-
- ///
- /// The that is contains the reference to the component.
- ///
- /// The object that contains the component reference. This may be another
- /// Component, a Code instance, or even a single DiagramElement object.
- public LogixElement Element => _element.Deserialize();
-
- ///
- /// The type of the LogixElement that contains the reference to the component.
- ///
- /// A representing the name of the element type.
- /// This helps further identify the reference element relative to other references.
- public string ElementType => _element.Name.LocalName;
-
- ///
- /// A unique identifier of the LogixElement that contains the reference to the component.
- ///
- /// A containing the name or number identifying the reference element.
- ///
- /// This will ultimately be either the name of the referencing component (for Tag references),
- /// the number of the referencing rung or line of logic (for RLL and ST code), or the ID of the referencing
- /// diagram block (for FBD/SFC code). This helps further identify the reference element relative to other references.
- ///
- public string ElementId => _element.Attribute(L5XName.ID) is not null ? _element.Attribute(L5XName.ID)!.Value
- : _element.Attribute(L5XName.Number) is not null ? _element.Attribute(L5XName.Number)!.Value
- : _element.Attribute(L5XName.Name) is not null ? _element.Attribute(L5XName.Name)!.Value
- : string.Empty;
-
- ///
- /// The name of the Task that the reference is contained within if applicable.
- ///
- /// A representing the containing task if found; Otherwise, an empty string.
- ///
- /// This could potentially be helpful for analyzing references to tags that are used across multiple
- /// Task components.
- ///
- public string Task => Scope.Task(_element);
-
- ///
- /// The type that the reference is contained within.
- ///
- /// A indicating scope of the reference.
- public Scope Scope => Scope.Type(_element);
-
- ///
- /// The name of the scoped program, instruction, or controller that the reference is contained within.
- ///
- ///
- /// A representing the name of program, controller, or instruction the reference
- /// is contained within.
- ///
- public string Container => Scope.Container(_element);
-
- ///
- /// The name of the Routine that the reference is contained within, it is a
- /// type element.
- ///
- /// A representing the containing routine if found; Otherwise, an empty string.
- public string Routine => _element.Ancestors(L5XName.Routine).FirstOrDefault()?.LogixName() ?? string.Empty;
-
- ///
- /// The instruction object containing the reference to the component if this reference is a logic or code reference.
- ///
- /// If the reference is a code reference, then the object the reference
- /// was found; Otherwise, null.
- ///
- /// The helps further identify where in the logix element the reference is located. Having the associated
- /// instruction can help for searching or filtering references and finding other references sharing the common
- /// instruction.
- ///
- public string? Instruction { get; }
-
- ///
- ///
- ///
- public string? Operand { get; }
-
- ///
- public override bool Equals(object? obj)
- {
- if (ReferenceEquals(this, obj))
- return true;
-
- if (obj is not CrossReference other)
- return false;
-
- return Key == other.Key &&
- Scope == other.Scope &&
- Container.IsEquivalent(other.Container) &&
- Routine.IsEquivalent(other.Routine) &&
- ElementId.IsEquivalent(other.ElementId) &&
- ElementType.IsEquivalent(other.ElementType);
- }
-
- ///
- public override int GetHashCode()
- {
- return HashCode.Combine(Key, Scope, Container, Routine, ElementId, ElementType);
- }
-
- ///
- public override string ToString() => Key.ToString();
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Dimensions.cs b/src/L5Sharp/Common/Dimensions.cs
deleted file mode 100644
index 41253bca..00000000
--- a/src/L5Sharp/Common/Dimensions.cs
+++ /dev/null
@@ -1,343 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace L5Sharp.Core;
-
-///
-/// Represents the dimensions of an array for a Logix type.
-///
-///
-/// Logix Dimensions can have one, two, or three dimensions.
-/// These dimensions are represented by the properties X, Y, and Z.
-/// This class also provides helpful methods and properties for working with dimensions of an array.
-///
-public sealed class Dimensions : IEquatable
-{
- private Dimensions()
- {
- }
-
- ///
- /// Creates a one dimensional instance with the provided values.
- ///
- /// The length of the first dimensional element
- public Dimensions(ushort x)
- {
- X = x;
- }
-
- ///
- /// Creates a two dimensional instance with the provided values.
- ///
- /// The length of the first dimensional element
- /// The length of the second dimensional element
- ///
- /// Thrown in the value of x is 0 and y is greater than 0.
- ///
- public Dimensions(ushort x, ushort y) : this(x)
- {
- if (x == 0 && y > 0)
- throw new ArgumentException("X must be greater than zero to have two dimensions");
-
- Y = y;
- }
-
-
- ///
- /// Creates a three dimensional instance with the provided values.
- ///
- /// The length of the first dimensional element
- /// The length of the second dimensional element
- /// The length of the third dimensional element
- ///
- /// Thrown in the value of y is 0 and z is greater than 0.
- ///
- public Dimensions(ushort x, ushort y, ushort z) : this(x, y)
- {
- if (y == 0 && z > 0)
- throw new ArgumentException("Y must be greater than zero to have three dimensions");
-
- Z = z;
- }
-
- ///
- /// Gets the value of the X (or first) dimensional unit of the object.
- ///
- ///
- /// An unsigned short that represents the length the first dimensional parameter.
- ///
- public ushort X { get; }
-
- ///
- /// Gets the value of the Y or second dimensional unit of the object.
- ///
- ///
- /// An unsigned short that represents the length the second dimensional parameter.
- ///
- public ushort Y { get; }
-
- ///
- /// Gets the value of the Z or third dimensional unit of the object.
- ///
- ///
- /// An unsigned short that represents the length the third dimensional parameter.
- ///
- public ushort Z { get; }
-
- ///
- /// Gets the value of the total length of .
- ///
- ///
- /// An integer that represents the combined length of all three dimensional parameters.
- ///
- public int Length => Z > 0 ? X * Y * Z : Y > 0 ? X * Y : X;
-
- ///
- /// Indicates whether are empty or equals zero.
- ///
- public bool IsEmpty => Length == 0;
-
- ///
- /// Indicates whether are multi-dimensional.
- ///
- ///
- /// Multi-dimensional simply means that the dimensions have a value for Y or Z.
- ///
- public bool IsMultiDimensional => Y > 0;
-
- ///
- /// Gets the value for the number or parameters or coordinates in the object.
- ///
- ///
- /// An integer value 1, 2, or 3 that represents the number of dimensional parameters for the current object.
- ///
- ///
- /// More plainly, this property indicates whether the current are one, two, or three
- /// dimensional based on the values of X, Y, and Z.
- ///
- public int Rank => Z > 0 ? 3 : Y > 0 ? 2 : X > 0 ? 1 : 0;
-
- ///
- /// Represents an empty object, or object with all three dimensional parameters equal
- /// to zero.
- ///
- public static Dimensions Empty => new();
-
- ///
- /// Returns the dimension of a specified array type.
- ///
- /// The array instance for which to determine the dimensions.
- ///
- /// array is null.
- /// array has a dimensional rank that is greater than
- /// max value -or- array has more than three dimensions.
- public static Dimensions FromArray(Array array)
- {
- if (array is null)
- throw new ArgumentNullException(nameof(array));
-
- if (array.Length == 0) return Empty;
-
- for (var i = 0; i < array.Rank; i++)
- {
- var length = array.GetLength(i);
-
- if (length > ushort.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(array),
- $"Array length of {array.Length} is out of range. Length must be less than or equal to {ushort.MaxValue}");
- }
-
- return array.Rank switch
- {
- 1 => new Dimensions((ushort)array.GetLength(0)),
- 2 => new Dimensions((ushort)array.GetLength(0), (ushort)array.GetLength(1)),
- 3 => new Dimensions((ushort)array.GetLength(0), (ushort)array.GetLength(1), (ushort)array.GetLength(2)),
- _ => throw new ArgumentOutOfRangeException($"An array with '{array.Rank} dimensional units is not supported.")
- };
- }
-
- ///
- /// Gets the set of indices for the object.
- ///
- ///
- /// An containing all index strings that represent the indices of a
- /// dimension array. If are empty, then an empty collection.
- ///
- ///
- /// The indices are determined by the dimensions (x, y, z) of the object.
- ///
- public IEnumerable Indices()
- {
- var indices = new List();
-
- for (ushort i = 0; i < X; i++)
- {
- if (Y == 0)
- indices.Add(GenerateIndex(i));
-
- for (ushort j = 0; j < Y; j++)
- {
- if (Z == 0)
- indices.Add(GenerateIndex(i, j));
-
- for (ushort k = 0; k < Z; k++)
- indices.Add(GenerateIndex(i, j, k));
- }
- }
-
- return indices;
- }
-
- ///
- /// Parses the provided string to a object.
- ///
- /// The value to parse.
- ///
- /// A new object that represents parsed dimensional value.
- /// If value empty or 0; returns .
- ///
- /// value is null
- /// value contains invalid characters.
- ///
- /// Valid dimensions must have only numbers and special characters "[ ,]". If more than 3 numbers are
- /// found in the provided value, or the numbers are not parsable to a ,
- /// then exception will be thrown.
- ///
- /// 1 2 3 -or- [1,2]
- ///
- public static Dimensions Parse(string value)
- {
- if (value is null)
- throw new ArgumentNullException(nameof(value));
-
- if (value.IsEmpty()) return Empty;
-
- var numbers = Regex.Matches(value, @"\d+")
- .Select(m => ushort.Parse(m.Value))
- .ToList();
-
- return numbers.Count switch
- {
- 3 => new Dimensions(numbers[0], numbers[1], numbers[2]),
- 2 => new Dimensions(numbers[0], numbers[1]),
- 1 => new Dimensions(numbers[0]),
- _ => throw new ArgumentOutOfRangeException(nameof(numbers.Count),
- $"Value '{value}' has a invalid number of arguments. Expecting between 1 and 3 arguments.")
- };
- }
-
- ///
- /// Attempts to parse the provided string to a object.
- ///
- /// The value to parse.
- /// When the method returns, the value of the parsed dimensions if successful;
- /// otherwise, null
- /// true if the parse was successful; otherwise, false.
- /// value is null
- ///
- /// Valid dimensions must have only numbers and special characters "[ ,]". If more than 3 numbers are
- /// found in the provided value, or the numbers are not parsable to a ,
- /// then exception will be thrown.
- ///
- /// 1 2 3 -or- [1,2,3]
- ///
- public static bool TryParse(string value, out Dimensions? dimensions)
- {
- if (string.IsNullOrEmpty(value))
- {
- dimensions = null;
- return false;
- }
-
- var numbers = Regex.Matches(value, @"\d+")
- .Select(m => ushort.Parse(m.Value))
- .ToList();
-
- dimensions = numbers.Count switch
- {
- 3 => new Dimensions(numbers[0], numbers[1], numbers[2]),
- 2 => new Dimensions(numbers[0], numbers[1]),
- 1 => new Dimensions(numbers[0]),
- _ => null
- };
-
- return dimensions is not null;
- }
-
- ///
- /// Creates a new instance of the current with the same value.
- ///
- /// A new object with the same value.
- public Dimensions Copy() =>
- Z > 0 ? new Dimensions(X, Y, Z) : Y > 0 ? new Dimensions(X, Y) : X > 0 ? new Dimensions(X) : Empty;
-
- ///
- /// Generates a string value that represents the in the L5X format.
- ///
- /// A string of numbers separated by a single space.
- /// 1 2 3
- public override string ToString() => Z > 0 ? $"{X} {Y} {Z}" : Y > 0 ? $"{X} {Y}" : $"{X}";
-
- ///
- /// Generates a string value that represents the in the array bracket notation.
- ///
- /// A string of numbers separated by a comma and enclosed in brackets.
- /// [1,2,3]
- public string ToIndex() => Z > 0 ? $"[{X},{Y},{Z}]" : Y > 0 ? $"[{X},{Y}]" : X > 0 ? $"[{X}]" : "[]";
-
- ///
- /// Converts the provided to a value.
- ///
- /// The length value to convert.
- ///
- /// A Dimensions value representing the provided ushort length.
- ///
- public static implicit operator Dimensions(ushort length) => new(length);
-
- ///
- /// Converts the provided to a value.
- ///
- /// The Dimensions value to convert.
- ///
- /// A int value representing the provided Dimensions .
- ///
- public static implicit operator int(Dimensions dimensions) => dimensions.Length;
-
- ///
- public bool Equals(Dimensions? other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return X == other.X && Y == other.Y && Z == other.Z;
- }
-
- ///
- public override bool Equals(object? obj) => Equals(obj as Dimensions);
-
- ///
- public override int GetHashCode() => X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode();
-
- ///
- /// Determines whether the objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the objects are equal, otherwise, false.
- public static bool operator ==(Dimensions left, Dimensions right) => Equals(left, right);
-
- ///
- /// Determines whether the objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the objects are not equal, otherwise, false.
- public static bool operator !=(Dimensions left, Dimensions right) => !Equals(left, right);
-
- private static string GenerateIndex(ushort x) => $"[{x}]";
-
- private static string GenerateIndex(ushort x, ushort y) => $"[{x},{y}]";
-
- private static string GenerateIndex(ushort x, ushort y, ushort z) => $"[{x},{y},{z}]";
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Instruction.cs b/src/L5Sharp/Common/Instruction.cs
deleted file mode 100644
index e8233f5f..00000000
--- a/src/L5Sharp/Common/Instruction.cs
+++ /dev/null
@@ -1,1735 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using JetBrains.Annotations;
-
-// ReSharper disable StringLiteralTypo
-// ReSharper disable IdentifierTypo
-// ReSharper disable InconsistentNaming
-// ReSharper disable CommentTypo
-
-namespace L5Sharp.Core;
-
-///
-///
-///
-[PublicAPI]
-public sealed class Instruction
-{
- ///
- /// Pattern for identifying any instruction and the contents of it's signature. This expression should
- /// capture everything enclosed or between the instruction parentheses. This includes nested parenthesis.
- /// This works on the assumption that the text has balanced opening/closing parentheses.
- ///
- public const string Pattern = @"[A-Za-z_]\w{1,39}\((?>\((?)|[^()]+|\)(?<-c>))*(?(c)(?!))\)";
-
- /*///
- /// Pattern finds all text prior to opening parentheses, which is the instruction name or key that identifies
- /// the instruction.
- ///
- private const string KeyPattern = @"[A-Za-z_]\w{1,39}(?=\()";*/
-
- ///
- /// Captures all content within parentheses, including outer parentheses and nested parentheses, assuming they
- /// are balanced (number of opening equals number of closing).
- ///
- private const string SignaturePattern = @"\((?>\((?)|[^()]+|\)(?<-c>))*(?(c)(?!))\)";
-
- ///
- /// The regex pattern for Logix tag names without starting and ending anchors.
- /// This pattern also includes a negative lookahead for removing text prior to parenthesis (i.e. instruction keys)
- /// Use this pattern for tag names within text, such as longer
- ///
- private const string TagNamePattern =
- @"(?!\w*\()[A-Za-z_][\w+:]{1,39}(?:(?:\[\d+\]|\[\d+,\d+\]|\[\d+,\d+,\d+\])?(?:\.[A-Za-z_]\w{1,39})?)+(?:\.[0-9][0-9]?)?";
-
- ///
- /// A regex pattern that finds all commas not contained in array brackets so that we can split the arguments
- /// of an instruction signature into separate parsable values.
- ///
- private const string ArgumentSplitPattern = ",(?![^[]*])";
-
- ///
- /// Lazy list of all known instructions and their corresponding factory method function.
- ///
- private static Dictionary> _known = Factories().ToDictionary(x => x.Key, x => x.Value);
-
- ///
- /// Creates a new with the provided string key and regex signature pattern.
- ///
- /// The key identifier of the instruction.
- ///
- ///
- private Instruction(string key, string? signature = null, params Argument[] arguments)
- {
- if (string.IsNullOrEmpty(key))
- throw new ArgumentException("Instruction key cannot be null or empty.", nameof(key));
-
- Key = key;
- Signature = signature ?? $"{key}({DefaultArgs(arguments.Length)})";
- Arguments = arguments;
- }
-
- ///
- /// The unique identifier of the instruction type.
- ///
- ///
- /// A containing the short hand instruction key identifier (e.g. XIC/OTE).
- /// For an AddOnInstruction this is the name of the component.
- ///
- public string Key { get; }
-
- ///
- /// The signature portion of the instruction instance. This represents the argument (parenthesis included) that are
- /// supplied to the instruction block instance.
- ///
- ///
- /// A containing the signature of the Instruction.
- /// This simply joins the and ecloses them in parenthesis.
- ///
- public string Signature { get; }
-
- ///
- /// The collection of values for the instruction instance.
- ///
- /// A of value objects. These could represent literal values, tag names, or expressions.
- ///
- public IEnumerable Arguments { get; }
-
- ///
- /// The collection of operand names found in the signature of the instruction.
- ///
- ///
- public IEnumerable Operadns
- {
- get
- {
- var input = Regex.Match(Signature, SignaturePattern).Value[1..^1];
-
- return !string.IsNullOrEmpty(input)
- ? Regex.Split(input, ArgumentSplitPattern)
- : Enumerable.Empty().ToArray();
- }
- }
-
- ///
- /// The representation of the instruction instance.
- ///
- /// A instance that represents the instruction in Logix neutral text format.
- public NeutralText Text => new($"{Key}({string.Join(',', Arguments.AsEnumerable())})");
-
- ///
- /// Indicates whether the instruction is conditional or evaluates a certain condition to be true or false, from which
- /// it directs the control flow of a program.
- ///
- /// true if the instruction is conditional; Otherwise, false.
- /// An example of a condition instruction is an .
- public bool IsConditional => Key is nameof(CMP) or nameof(EQU) or nameof(GEQ) or nameof(GRT) or nameof(LEQ)
- or nameof(LES) or nameof(LIM) or nameof(MEQ) or nameof(NEQ) or nameof(XIC) or nameof(XIO);
-
- ///
- /// Indicates whether this Instruction is one that calls or references a Task component by name.
- ///
- public bool IsTaskCall => Key is nameof(EVENT);
-
- ///
- /// Indicates whether this Instruction is one that calls or references a Routine component by name.
- ///
- public bool IsRoutineCall => Key is nameof(JSR) or nameof(JXR) or nameof(SFR) or nameof(SFP) or nameof(FOR);
-
- ///
- /// Indicates whether the instruction argument cound matches the operand count.
- ///
- public bool IsValid => Key is nameof(JSR) or nameof(SBR) or nameof(RET) || Operadns.Count() == Arguments.Count();
-
- ///
- /// Creates a new with the provided key and optional arguments.
- ///
- /// A containing the unique name of the instruction.
- /// A set of to initialize the intruction with.
- /// A instance with the provided key and arguments.
- ///
- /// This factory method is the means through which to create unknown or other instruction that are not captured
- /// in this classes static factory methods. If this is a known instruction, use the corresponding instruction
- /// factory method so it can initialize the known signature.
- ///
- public static Instruction New(string key, params Argument[] args) => new(key, arguments: args);
-
- ///
- /// Creates a new with the provided key, signature, and optional arguments.
- ///
- /// A containing the unique name of the instruction.
- /// A containing the method signature or format. This should be in the
- /// format 'key(arg1,arg2,...)'.
- /// A set of to initialize the intruction with.
- /// A instance with the provided key, signature, and arguments.
- public static Instruction New(string key, string? signature = null, params Argument[] args) =>
- new(key, signature, args);
-
- ///
- /// Parses the provided string neutral text into a instance.
- ///
- /// The neutral text to parse.
- /// A object representing the parsed text.
- /// text is null or empty.
- public static Instruction Parse(string text)
- {
- if (string.IsNullOrEmpty(text))
- throw new ArgumentException("Instruction text can not be null or empty.", nameof(text));
-
- if (!Regex.IsMatch(text, Pattern))
- throw new FormatException("Instruction text must be in the format of 'key(arg1,arg2,...)'.");
-
- var key = text[..text.IndexOf('(')];
- var signature = Regex.Match(text, SignaturePattern).Value[1..^1];
- var arguments = Regex.Split(signature, ArgumentSplitPattern).Select(Argument.Parse).ToArray();
-
- return _known.TryGetValue(key, out var create)
- ? create().Of(arguments)
- : new Instruction(key, arguments: arguments);
- }
-
- ///
- /// Returns a collection of all known or defined instances.
- ///
- ///
- /// A containing all known instances with no arguments.
- ///
- public static IEnumerable Keys() => _known.Keys.AsEnumerable();
-
- ///
- /// Retrieves teh argument for a specified operand name from the instruction.
- ///
- /// A containing the operand name to search for.
- /// A representing the value passed
- public Argument? GetArgument(string operand)
- {
- var index = Operadns.ToList().IndexOf(operand);
- return index >= 0 ? Arguments.ElementAt(index) : default;
- }
-
- ///
- /// Retrieves teh argument for a specified operand name from the instruction.
- ///
- /// A zero based index number at which to retrieve an argument.
- /// A representing the value passed
- public Argument? GetArgument(int index)
- {
- return index >= 0 && index < Arguments.Count() ? Arguments.ElementAt(index) : default;
- }
-
- ///
- /// Retrieves all values from this instruction instance's arguments.
- ///
- /// A collection of values cotnained by the instruction.
- public IEnumerable Tags()
- {
- var tags = new List();
-
- foreach (var argument in Arguments)
- {
- if (argument.IsTag) tags.Add((TagName)argument);
- if (!argument.IsExpression) continue;
- tags.AddRange(((NeutralText)argument).Tags());
- }
-
- return tags;
- }
-
- ///
- /// Creates a of the same type with the updated argument values.
- ///
- /// The collection of arguments make up the instruction signature.
- /// A new complete with the provided values.
- public Instruction Append(params Argument[] arguments) =>
- new(Key, Signature, Arguments.Concat(arguments).ToArray());
-
-
- ///
- /// Creates a of the same type with the updated argument values.
- ///
- /// The collection of arguments make up the instruction signature.
- /// A new complete with the provided values.
- public Instruction Of(params Argument[] arguments) => new(Key, Signature, arguments);
-
- ///
- public override bool Equals(object? obj)
- {
- if (ReferenceEquals(this, obj)) return true;
-
- return obj switch
- {
- Instruction other => Equals(Text, other.Text),
- string text => Text.ToString().IsEquivalent(text),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => Text.GetHashCode();
-
- ///
- public override string ToString() => Text;
-
- ///
- /// Determines the equality of two instances.
- ///
- /// The left to compare.
- /// The right to compare.
- /// true if the values are equal; Otherwise, false.
- public static bool operator ==(Instruction? left, Instruction? right) => Equals(left, right);
-
- ///
- /// Determines the equality of two instances.
- ///
- /// The left to compare.
- /// The right to compare.
- /// true if the values are not equal; Otherwise, false.
- public static bool operator !=(Instruction? left, Instruction? right) => !Equals(left, right);
-
- #region Factories
-
- ///
- /// Gets the ABL instruction definition instance.
- ///
- public static Instruction ABL(Argument channel, Argument serial_port_control, Argument character_count) =>
- new(nameof(ABL), "ABL(channel,serial_port_control,character_count)", channel, serial_port_control,
- character_count);
-
- ///
- /// Gets the ABS instruction definition instance.
- ///
- public static Instruction ABS(Argument source, Argument destination) =>
- new(nameof(ABS), "ABS(source,destination)", source, destination);
-
- ///
- /// Gets the ACB instruction definition instance.
- ///
- public static Instruction ACB(Argument channel, Argument serial_port_control, Argument character_count) =>
- new(nameof(ACB), "ACB(channel,serial_port_control,character_count)", channel, serial_port_control,
- character_count);
-
- ///
- /// Gets the ACL instruction definition instance.
- ///
- public static Instruction
- ACL(Argument channel, Argument clear_serial_port_read, Argument clear_serial_port_write) => new(nameof(ACL),
- "ACL(channel,clear_serial_port_read,clear_serial_port_write)", channel, clear_serial_port_read,
- clear_serial_port_write);
-
- ///
- /// Gets the ACS instruction definition instance.
- ///
- public static Instruction ACS(Argument source, Argument destination) =>
- new(nameof(ACS), "ACS(source,destination)", source, destination);
-
- ///
- /// Gets the ADD instruction definition instance.
- ///
- public static Instruction ADD(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(ADD), "ADD(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the AFI instruction definition instance.
- ///
- public static Instruction AFI() => new(nameof(AFI), "AFI()");
-
- ///
- /// Gets the AHL instruction definition instance.
- ///
- public static Instruction AHL(Argument channel, Argument ANDMask, Argument ORMask, Argument serial_port_control,
- Argument channel_status) => new(nameof(AHL),
- "AHL(channel,ANDMask,ORMask,serial_port_control,channel_status)", channel, ANDMask, ORMask,
- serial_port_control, channel_status);
-
- ///
- /// Gets the ALMA instruction definition instance.
- ///
- public static Instruction ALMA(Argument alma_tag, Argument @in, Argument program_acknowledge_all,
- Argument program_disable, Argument program_enable) => new(nameof(ALMA),
- "ALMA(alma_tag,in,program_acknowledge_all,program_disable,program_enable)", alma_tag, @in,
- program_acknowledge_all, program_disable, program_enable);
-
- ///
- /// Gets the ALMD instruction definition instance.
- ///
- public static Instruction ALMD(Argument almd_tag, Argument program_acknowledge, Argument program_reset,
- Argument program_disable, Argument program_enable) => new(nameof(ALMD),
- "ALMD(almd_tag,program_acknowledge,program_reset,program_disable,program_enable)", almd_tag,
- program_acknowledge, program_reset, program_disable, program_enable);
-
- ///
- /// Gets the AND instruction definition instance.
- ///
- public static Instruction AND(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(AND), "AND(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the ARD instruction definition instance.
- ///
- public static Instruction ARD(Argument channel, Argument destination, Argument serial_port_control,
- Argument string_length, Argument characters_read) => new(nameof(ARD),
- "ARD(channel,destination,serial_port_control,string_length,characters_read)", channel, destination,
- serial_port_control, string_length, characters_read);
-
- ///
- /// Gets the ARL instruction definition instance.
- ///
- public static Instruction ARL(Argument channel, Argument destination, Argument serial_port_control,
- Argument string_length, Argument characters_read) => new(nameof(ARL),
- "ARL(channel,destination,serial_port_control,string_length,characters_read)", channel, destination,
- serial_port_control, string_length, characters_read);
-
- ///
- /// Gets the ASN instruction definition instance.
- ///
- public static Instruction ASN(Argument source, Argument destination) =>
- new(nameof(ASN), "ASN(source,destination)", source, destination);
-
- ///
- /// Gets the ATN instruction definition instance.
- ///
- public static Instruction ATN(Argument source, Argument destination) =>
- new(nameof(ATN), "ATN(source,destination)", source, destination);
-
- ///
- /// Gets the AVC instruction definition instance.
- ///
- public static Instruction AVC(Argument avc_tag, Argument feedback_type, Argument feedback_reation_time,
- Argument delay_type, Argument delay_time, Argument output_follows_actuate, Argument actuate,
- Argument delay_enable, Argument feedback_1, Argument input_status, Argument output_status, Argument reset) =>
- new(nameof(AVC),
- "AVC(avc_tag,feedback_type,feedback_reation_time,delay_type,delay_time,output_follows_actuate,actuate,delay_enable,feedback_1,input_status,output_status,reset)",
- avc_tag, feedback_type, feedback_reation_time, delay_type, delay_time, output_follows_actuate, actuate,
- delay_enable, feedback_1, input_status, output_status, reset);
-
- ///
- /// Gets the AVE instruction definition instance.
- ///
- public static Instruction AVE(Argument array, Argument dim_to_vary, Argument destination, Argument control,
- Argument length, Argument position) => new(nameof(AVE),
- "AVE(array,dim_to_vary,destination,control,length,position)", array, dim_to_vary, destination, control, length,
- position);
-
- ///
- /// Gets the AWA instruction definition instance.
- ///
- public static Instruction AWA(Argument channel, Argument source, Argument serial_port_control,
- Argument string_length, Argument characters_sent) => new(nameof(AWA),
- "AWA(channel,source,serial_port_control,string_length,characters_sent)", channel, source, serial_port_control,
- string_length, characters_sent);
-
- ///
- /// Gets the AWT instruction definition instance.
- ///
- public static Instruction AWT(Argument channel, Argument source, Argument serial_port_control,
- Argument string_length, Argument characters_sent) => new(nameof(AWT),
- "AWT(channel,source,serial_port_control,string_length,characters_sent)", channel, source, serial_port_control,
- string_length, characters_sent);
-
- ///
- /// Gets the BRK instruction definition instance.
- ///
- public static Instruction BRK() => new(nameof(BRK), "BRK()");
-
- ///
- /// Gets the BSL instruction definition instance.
- ///
- public static Instruction BSL(Argument array, Argument control, Argument source_bit, Argument length) =>
- new(nameof(BSL), "BSL(array,control,source_bit,length)", array, control, source_bit, length);
-
- ///
- /// Gets the BSR instruction definition instance.
- ///
- public static Instruction BSR(Argument array, Argument control, Argument source_bit, Argument length) =>
- new(nameof(BSR), "BSR(array,control,source_bit,length)", array, control, source_bit, length);
-
- ///
- /// Gets the BTD instruction definition instance.
- ///
- public static Instruction BTD(Argument source, Argument source_bit, Argument destination, Argument destination_bit,
- Argument length) => new(nameof(BTD),
- "BTD(source,source_bit,destination,destination_bit,length)", source, source_bit, destination, destination_bit,
- length);
-
- ///
- /// Gets the CBCM instruction definition instance.
- ///
- public static Instruction CBCM(Argument cbcm_tag, Argument ack_type, Argument mode, Argument takeover_mode,
- Argument enable, Argument safety_enable, Argument standard_enable, Argument arm_continuous, Argument start,
- Argument stop_at_top, Argument press_in_motion, Argument motion_monitor_fault, Argument slide_zone,
- Argument safety_enable_ack) => new(nameof(CBCM),
- "CBCM(cbcm_tag,ack_type,mode,takeover_mode,enable,safety_enable,standard_enable,arm_continuous,start,stop_at_top,press_in_motion,motion_monitor_fault,slide_zone,safety_enable_ack)",
- cbcm_tag, ack_type, mode, takeover_mode, enable, safety_enable, standard_enable, arm_continuous, start,
- stop_at_top, press_in_motion, motion_monitor_fault, slide_zone, safety_enable_ack);
-
- ///
- /// Gets the CBIM instruction definition instance.
- ///
- public static Instruction CBIM(Argument cbim_tag, Argument ack_type, Argument inch_time, Argument enable,
- Argument safety_enable, Argument standard_enable, Argument start, Argument press_in_motion,
- Argument motion_monitor_fault, Argument slide_zone, Argument safety_enable_ack) => new(nameof(CBIM),
- "CBIM(cbim_tag,ack_type,inch_time,enable,safety_enable,standard_enable,start,press_in_motion,motion_monitor_fault,slide_zone,safety_enable_ack)",
- cbim_tag, ack_type, inch_time, enable, safety_enable, standard_enable, start, press_in_motion,
- motion_monitor_fault, slide_zone, safety_enable_ack);
-
- ///
- /// Gets the CBSSM instruction definition instance.
- ///
- public static Instruction CBSSM(Argument cbssm_tag, Argument ack_type, Argument takeover_mode, Argument enable,
- Argument safety_enable, Argument standard_enable, Argument start, Argument press_in_motion,
- Argument motion_monitor_fault, Argument slide_zone, Argument saefty_enable_ack) => new(nameof(CBSSM),
- "CBSSM(cbssm_tag,ack_type,takeover_mode,enable,safety_enable,standard_enable,start,press_in_motion,motion_monitor_fault,slide_zone,saefty_enable_ack)",
- cbssm_tag, ack_type, takeover_mode, enable, safety_enable, standard_enable, start, press_in_motion,
- motion_monitor_fault, slide_zone, saefty_enable_ack);
-
- ///
- /// Gets the CLR instruction definition instance.
- ///
- public static Instruction CLR(Argument destination) => new(nameof(CLR), "CLR(destination)", destination);
-
- ///
- /// Gets the CMP instruction definition instance.
- ///
- public static Instruction CMP(Argument expression) => new(nameof(CMP), "CMP(expression)", expression);
-
- ///
- /// Gets the CONCAT instruction definition instance.
- ///
- public static Instruction CONCAT(Argument sourceA, Argument sourceB, Argument destination) =>
- new(nameof(CONCAT), "CONCAT(sourceA,sourceB,destination)", sourceA, sourceB, destination);
-
- ///
- /// Gets the COP instruction definition instance.
- ///
- public static Instruction COP(Argument source, Argument destination, Argument length) => new(nameof(COP),
- "COP(source,destination,length)", source, destination, length);
-
- ///
- /// Gets the COS instruction definition instance.
- ///
- public static Instruction COS(Argument source, Argument destination) =>
- new(nameof(COS), "COS(source,destination)", source, destination);
-
- ///
- /// Gets the CPM instruction definition instance.
- ///
- public static Instruction CPM(Argument cpm_tag, Argument cam_profile, Argument enable, Argument brake_cam,
- Argument takeover_cam, Argument dynamic_cam, Argument input_status, Argument reverse,
- Argument press_motion_status, Argument reset) => new(nameof(CPM),
- "CPM(cpm_tag,cam_profile,enable,brake_cam,takeover_cam,dynamic_cam,input_status,reverse,press_motion_status,reset)",
- cpm_tag, cam_profile, enable, brake_cam, takeover_cam, dynamic_cam, input_status, reverse, press_motion_status,
- reset);
-
- ///
- /// Gets the CPS instruction definition instance.
- ///
- public static Instruction CPS(Argument source, Argument destination, Argument length) => new(nameof(CPS),
- "CPS(source,destination,length)", source, destination, length);
-
- ///
- /// Gets the CPT instruction definition instance.
- ///
- public static Instruction CPT(Argument destination, Argument expression) =>
- new(nameof(CPT), "CPT(destination,expression)", destination, expression);
-
- ///
- /// Gets the CROUT instruction definition instance.
- ///
- public static Instruction CROUT(Argument crout_tag, Argument feedback_type, Argument feedback_reaction_time,
- Argument actuate, Argument feedback_1, Argument feedback_2, Argument input_status, Argument output_status,
- Argument reset) => new(nameof(CROUT),
- "CROUT(crout_tag,feedback_type,feedback_reaction_time,actuate,feedback_1,feedback_2,input_status,output_status,reset)",
- crout_tag, feedback_type, feedback_reaction_time, actuate, feedback_1, feedback_2, input_status, output_status,
- reset);
-
- ///
- /// Gets the CSM instruction definition instance.
- ///
- public static Instruction CSM(Argument csm_tag, Argument mechanical_delay_timer, Argument max_pulse_period,
- Argument motion_request, Argument channel_A, Argument channel_B, Argument input_status, Argument reset) => new(
- nameof(CSM),
- "CSM(csm_tag,mechanical_delay_timer,max_pulse_period,motion_request,channel_A,channel_B,input_status,reset)",
- csm_tag, mechanical_delay_timer, max_pulse_period, motion_request, channel_A, channel_B, input_status, reset);
-
- ///
- /// Gets the CTD instruction definition instance.
- ///
- public static Instruction CTD(Argument counter, Argument preset, Argument accum) =>
- new(nameof(CTD), "CTD(counter,preset,accum)", counter, preset, accum);
-
- ///
- /// Gets the CTU instruction definition instance.
- ///
- public static Instruction CTU(Argument counter, Argument preset, Argument accum) =>
- new(nameof(CTU), "CTU(counter,preset,accum)", counter, preset, accum);
-
- ///
- /// Gets the DCM instruction definition instance.
- ///
- public static Instruction DCM(Argument dcm_tag, Argument safety_function, Argument input_type,
- Argument descrepancy_time, Argument channel_A, Argument channel_B, Argument input_status, Argument reset) =>
- new(nameof(DCM),
- "DCM(dcm_tag,safety_function,input_type,descrepancy_time,channel_A,channel_B,input_status,reset)", dcm_tag,
- safety_function, input_type, descrepancy_time, channel_A, channel_B, input_status, reset);
-
- ///
- /// Gets the DCS instruction definition instance.
- ///
- public static Instruction DCS(Argument dcs_tag, Argument safety_function, Argument input_type,
- Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
- Argument channel_B, Argument input_status, Argument reset) => new(nameof(DCS),
- "DCS(dcs_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,input_status,reset)",
- dcs_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
- input_status, reset);
-
- ///
- /// Gets the DCSRT instruction definition instance.
- ///
- public static Instruction DCSRT(Argument dcsrt_tag, Argument safety_function, Argument input_type,
- Argument discrepancy_time, Argument enable, Argument channel_A, Argument channel_B, Argument input_status,
- Argument reset) => new(nameof(DCSRT),
- "DCSRT(dcsrt_tag,safety_function,input_type,discrepancy_time,enable,channel_A,channel_B,input_status,reset)",
- dcsrt_tag, safety_function, input_type, discrepancy_time, enable, channel_A, channel_B, input_status, reset);
-
- ///
- /// Gets the DCST instruction definition instance.
- ///
- public static Instruction DCST(Argument dcst_tag, Argument safety_function, Argument input_type,
- Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
- Argument channel_B, Argument test_request, Argument input_status, Argument reset) => new(nameof(DCST),
- "DCST(dcst_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,test_request,input_status,reset)",
- dcst_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
- test_request, input_status, reset);
-
- ///
- /// Gets the DCSTM instruction definition instance.
- ///
- public static Instruction DCSTM(Argument dcstm_tag, Argument safety_function, Argument input_type,
- Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument test_type,
- Argument test_time, Argument channel_A, Argument channel_B, Argument test_request, Argument mute,
- Argument muting_lamp_status, Argument input_status, Argument reset) => new(nameof(DCSTM),
- "DCSTM(dcstm_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,test_type,test_time,channel_A,channel_B,test_request,mute,muting_lamp_status,input_status,reset)",
- dcstm_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, test_type, test_time,
- channel_A, channel_B, test_request, mute, muting_lamp_status, input_status, reset);
-
- ///
- /// Gets the DCSTL instruction definition instance.
- ///
- public static Instruction DCSTL(Argument dcstl_tag, Argument safety_function, Argument input_type,
- Argument discrepancy_time, Argument restart_type, Argument cold_start_type, Argument channel_A,
- Argument channel_B, Argument test_request, Argument unlock_request, Argument lock_feedback,
- Argument hazard_stopped, Argument input_status, Argument reset) => new(nameof(DCSTL),
- "DCSTL(dcstl_tag,safety_function,input_type,discrepancy_time,restart_type,cold_start_type,channel_A,channel_B,test_request,unlock_request,lock_feedback,hazard_stopped,input_status,reset)",
- dcstl_tag, safety_function, input_type, discrepancy_time, restart_type, cold_start_type, channel_A, channel_B,
- test_request, unlock_request, lock_feedback, hazard_stopped, input_status, reset);
-
- ///
- /// Gets the DDT instruction definition instance.
- ///
- public static Instruction DDT(Argument source, Argument reference, Argument result, Argument cmp_control,
- Argument length, Argument position, Argument result_control, Argument result_length,
- Argument result_position) => new(nameof(DDT),
- "DDT(source,reference,result,cmp_control,length,position,result_control,length,position)", source, reference,
- result, cmp_control, length, position, result_control, result_length, result_position);
-
- ///
- /// Gets the DEG instruction definition instance.
- ///
- public static Instruction DEG(Argument source, Argument destination) =>
- new(nameof(DEG), "DEG(source,destination)", source, destination);
-
- ///
- /// Gets the DELETE instruction definition instance.
- ///
- public static Instruction DELETE(Argument source, Argument quantity, Argument start, Argument destination) =>
- new(nameof(DELETE), "DELETE(source,quantity,start,destination)", source, quantity, start, destination);
-
- ///
- /// Gets the DIN instruction definition instance.
- ///
- public static Instruction DIN(Argument din_tag, Argument reset_type, Argument channel_A, Argument channel_B,
- Argument circuit_reset, Argument fault_reset) => new(nameof(DIN),
- "DIN(din_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", din_tag, reset_type, channel_A,
- channel_B, circuit_reset, fault_reset);
-
- ///
- /// Gets the DIV instruction definition instance.
- ///
- public static Instruction DIV(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(DIV), "DIV(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the DTOS instruction definition instance.
- ///
- public static Instruction DTOS(Argument source, Argument destination) =>
- new(nameof(DTOS), "DTOS(source,destination)", source, destination);
-
- ///
- /// Gets the DTR instruction definition instance.
- ///
- public static Instruction DTR(Argument source, Argument mask, Argument reference) =>
- new(nameof(DTR), "DTR(source,mask,reference)", source, mask, reference);
-
- ///
- /// Gets the ENPEN instruction definition instance.
- ///
- public static Instruction ENPEN(Argument enpen_tag, Argument reset_type, Argument channel_A, Argument channel_B,
- Argument circuit_reset, Argument fault_reset) => new(nameof(ENPEN),
- "ENPEN(enpen_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", enpen_tag, reset_type, channel_A,
- channel_B, circuit_reset, fault_reset);
-
- ///
- /// Gets the EOT instruction definition instance.
- ///
- public static Instruction EOT(Argument data_bit) => new(nameof(EOT), "EOT(data_bit)", data_bit);
-
- ///
- /// Gets the EPMS instruction definition instance.
- ///
- public static Instruction EPMS(Argument epms_tag, Argument input_1, Argument input_2, Argument input_3,
- Argument input_4, Argument input_5, Argument input_6, Argument input_7, Argument input_8, Argument input_status,
- Argument lck, Argument reset) => new(nameof(EPMS),
- "EPMS(epms_tag,input_1,input_2,input_3,input_4,input_5,input_6,input_7,input_8,input_status,lock,reset)",
- epms_tag, input_1, input_2, input_3, input_4, input_5, input_6, input_7, input_8, input_status, lck, reset);
-
- ///
- /// Gets the EQU instruction definition instance.
- ///
- public static Instruction EQU(Argument source_A, Argument source_B) =>
- new(nameof(EQU), "EQU(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the ESTOP instruction definition instance.
- ///
- public static Instruction ESTOP(Argument estop_tag, Argument reset_type, Argument channel_A, Argument channel_B,
- Argument circuit_reset, Argument fault_reset) => new(nameof(ESTOP),
- "ESTOP(estop_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", estop_tag, reset_type, channel_A,
- channel_B, circuit_reset, fault_reset);
-
- ///
- /// Gets the EVENT instruction definition instance.
- ///
- public static Instruction EVENT(Argument task) => new(nameof(EVENT), "EVENT(task)", task);
-
- ///
- /// Gets the FAL instruction definition instance.
- ///
- public static Instruction FAL(Argument control, Argument length, Argument position, Argument mode,
- Argument destination, Argument expression) =>
- new(nameof(FAL), "FAL(control,length,position,mode,destination,expression)", control, length, position, mode,
- destination, expression);
-
- ///
- /// Gets the FBC instruction definition instance.
- ///
- public static Instruction FBC(Argument source, Argument reference, Argument result, Argument cmp_control,
- Argument length, Argument position, Argument result_control, Argument result_length,
- Argument result_position) => new(nameof(FBC),
- "FBC(source,reference,result,cmp_control,length,position,result_control,length,position)", source, reference,
- result, cmp_control, length, position, result_control, result_length, result_position);
-
- ///
- /// Gets the FFL instruction definition instance.
- ///
- public static Instruction FFL(Argument source, Argument FIFO, Argument control, Argument length,
- Argument position) =>
- new(nameof(FFL), "FFL(source,FIFO,control,length,position)", source, FIFO, control, length, position);
-
- ///
- /// Gets the FFU instruction definition instance.
- ///
- public static Instruction FFU(Argument FIFO, Argument destination, Argument control, Argument length,
- Argument position) =>
- new(nameof(FFU), "FFU(FIFO,destination,control,length,position)", FIFO, destination, control, length,
- position);
-
- ///
- /// Gets the FIND instruction definition instance.
- ///
- public static Instruction FIND(Argument source, Argument search, Argument start, Argument result) =>
- new(nameof(FIND), "FIND(source,search,start,result)", source, search, start, result);
-
- ///
- /// Gets the FLL instruction definition instance.
- ///
- public static Instruction FLL(Argument source, Argument destination, Argument length) => new(nameof(FLL),
- "FLL(source,destination,length)", source, destination, length);
-
- ///
- /// Gets the FOR instruction definition instance.
- ///
- public static Instruction FOR(Argument routine_name, Argument index, Argument initial_value,
- Argument terminal_value, Argument step_size) => new(nameof(FOR),
- "FOR(routine_name,index,initial_value,terminal_value,step_size)", routine_name, index, initial_value,
- terminal_value, step_size);
-
- ///
- /// Gets the FPMS instruction definition instance.
- ///
- public static Instruction FPMS(Argument fpms_tag, Argument input_1, Argument input_2, Argument input_3,
- Argument input_4, Argument input_5, Argument fault_reset) => new(nameof(FPMS),
- "FPMS(fpms_tag,input_1,input_2,input_3,input_4,input_5,fault_reset)", fpms_tag, input_1, input_2, input_3,
- input_4, input_5, fault_reset);
-
- ///
- /// Gets the FRD instruction definition instance.
- ///
- public static Instruction FRD(Argument source, Argument destination) =>
- new(nameof(FRD), "FRD(source,destination)", source, destination);
-
- ///
- /// Gets the FSBM instruction definition instance.
- ///
- public static Instruction FSBM(Argument fsbm_tag, Argument restart_type, Argument S1_S2_time, Argument S2_LC_time,
- Argument LC_S3_time, Argument S3_S4_time, Argument maximum_mute_time, Argument maximum_override_time,
- Argument direction, Argument light_curtain, Argument sensor_1, Argument sensor_2, Argument sensor_3,
- Argument sensor_4, Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status,
- Argument reset) => new(nameof(FSBM),
- "FSBM(fsbm_tag,restart_type,S1_S2_time,S2_LC_time,LC_S3_time,S3_S4_time,maximum_mute_time,maximum_override_time,direction,light_curtain,sensor_1,sensor_2,sensor_3,sensor_4,enable_mute,override,input_status,muting_lamp_status,reset)",
- fsbm_tag, restart_type, S1_S2_time, S2_LC_time, LC_S3_time, S3_S4_time, maximum_mute_time,
- maximum_override_time, direction, light_curtain, sensor_1, sensor_2, sensor_3, sensor_4, enable_mute, @override,
- input_status, muting_lamp_status, reset);
-
- ///
- /// Gets the FSC instruction definition instance.
- ///
- public static Instruction FSC(Argument control, Argument length, Argument position, Argument mode,
- Argument expression) =>
- new(nameof(FSC), "FSC(control,length,position,mode,expression)", control, length, position, mode, expression);
-
- ///
- /// Gets the GEQ instruction definition instance.
- ///
- public static Instruction GEQ(Argument source_A, Argument source_B) =>
- new(nameof(GEQ), "GEQ(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the GRT instruction definition instance.
- ///
- public static Instruction GRT(Argument source_A, Argument source_B) =>
- new(nameof(GRT), "GRT(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the GSV instruction definition instance.
- ///
- public static Instruction GSV(Argument class_name, Argument instance_name, Argument attribute_name,
- Argument destination) =>
- new(nameof(GSV), "GSV(class_name,instance_name,attribute_name,destination)", class_name, instance_name,
- attribute_name, destination);
-
- ///
- /// Gets the INSERT instruction definition instance.
- ///
- public static Instruction INSERT(Argument sourceA, Argument sourceB, Argument start, Argument destination) =>
- new(nameof(INSERT), "INSERT(sourceA,sourceB,start,destination)", sourceA, sourceB, start, destination);
-
- ///
- /// Gets the IOT instruction definition instance.
- ///
- public static Instruction IOT(Argument output_tag) => new(nameof(IOT), "IOT(output_tag)", output_tag);
-
- ///
- /// Gets the JMP instruction definition instance.
- ///
- public static Instruction JMP(Argument label_name) => new(nameof(JMP), "JMP(label_name)", label_name);
-
- ///
- /// Gets the JSR instruction definition instance.
- ///
- public static Instruction JSR(Argument routine_name, Argument number_of_inputs, params Argument[]? parameters) =>
- new(nameof(JSR), "JSR(routine_name,number_of_inputs,input_1,input_n,return_1,return_n)",
- parameters is not null
- ? new[] { routine_name, number_of_inputs }.Concat(parameters).ToArray()
- : new[] { routine_name, number_of_inputs });
-
- ///
- /// Gets the JXR instruction definition instance.
- ///
- public static Instruction JXR(Argument external_routine_name, Argument external_routine_control, Argument parameter,
- Argument return_parameter) => new(nameof(JXR),
- "JXR(external_routine_name,external_routine_control,parameter,return_parameter)", external_routine_name,
- external_routine_control, parameter, return_parameter);
-
- ///
- /// Gets the LBL instruction definition instance.
- ///
- public static Instruction LBL(Argument label_name) => new(nameof(LBL), "LBL(label_name)", label_name);
-
- ///
- /// Gets the LC instruction definition instance.
- ///
- public static Instruction LC(Argument lc_tag, Argument reset_type, Argument channel_A, Argument channel_B,
- Argument input_filter_time, Argument mute_light_curtain, Argument circuit_reset, Argument fault_reset) => new(
- nameof(LC),
- "LC(lc_tag,reset_type,channel_A,channel_B,input_filter_time,mute_light_curtain,circuit_reset,fault_reset)",
- lc_tag, reset_type, channel_A, channel_B, input_filter_time, mute_light_curtain, circuit_reset, fault_reset);
-
- ///
- /// Gets the LEQ instruction definition instance.
- ///
- public static Instruction LEQ(Argument source_A, Argument source_B) =>
- new(nameof(LEQ), "LEQ(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the LES instruction definition instance.
- ///
- public static Instruction LES(Argument source_A, Argument source_B) =>
- new(nameof(LES), "LES(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the LFL instruction definition instance.
- ///
- public static Instruction LFL(Argument source, Argument LIFO, Argument control, Argument length,
- Argument position) =>
- new(nameof(LFL), "LFL(source,LIFO,control,length,position)", source, LIFO, control, length, position);
-
- ///
- /// Gets the LFU instruction definition instance.
- ///
- public static Instruction LFU(Argument LIFO, Argument destination, Argument control, Argument length,
- Argument position) =>
- new(nameof(LFU), "LFU(LIFO,destination,control,length,position)", LIFO, destination, control, length,
- position);
-
- ///
- /// Gets the LIM instruction definition instance.
- ///
- public static Instruction LIM(Argument low_limit, Argument test, Argument high_limit) => new(nameof(LIM),
- "LIM(low_limit,test,high_limit)", low_limit, test, high_limit);
-
- ///
- /// Gets the LN instruction definition instance.
- ///
- public static Instruction LN(Argument source, Argument destination) =>
- new(nameof(LN), "LN(source,destination)", source, destination);
-
- ///
- /// Gets the LOG instruction definition instance.
- ///
- public static Instruction LOG(Argument source, Argument destination) =>
- new(nameof(LOG), "LOG(source,destination)", source, destination);
-
- ///
- /// Gets the LOWER instruction definition instance.
- ///
- public static Instruction LOWER(Argument source, Argument destination) =>
- new(nameof(LOWER), "LOWER(source,destination)", source, destination);
-
- ///
- /// Gets the MAAT instruction definition instance.
- ///
- public static Instruction MAAT(Argument axis, Argument motion_control) =>
- new(nameof(MAAT), "MAAT(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MAFR instruction definition instance.
- ///
- public static Instruction MAFR(Argument axis, Argument motion_control) =>
- new(nameof(MAFR), "MAFR(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MAG instruction definition instance.
- ///
- public static Instruction MAG(Argument slave_axis, Argument master_axis, Argument motion_control,
- Argument direction, Argument ratio, Argument slave_counts, Argument master_counts, Argument master_reference,
- Argument ratio_format, Argument clutch, Argument accel_rate, Argument accel_units) => new(nameof(MAG),
- "MAG(slave_axis,master_axis,motion_control,direction,ratio,slave_counts,master_counts,master_reference,ratio_format,clutch,accel_rate,accel_units)",
- slave_axis, master_axis, motion_control, direction, ratio, slave_counts, master_counts, master_reference,
- ratio_format, clutch, accel_rate, accel_units);
-
- ///
- /// Gets the MAH instruction definition instance.
- ///
- public static Instruction MAH(Argument axis, Argument motion_control) =>
- new(nameof(MAH), "MAH(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MAHD instruction definition instance.
- ///
- public static Instruction MAHD(Argument axis, Argument motion_control, Argument diagnostic_test,
- Argument observed_direction) => new(nameof(MAHD),
- "MAHD(axis,motion_control,diagnostic_test,observed_direction)", axis, motion_control, diagnostic_test,
- observed_direction);
-
- ///
- /// Gets the MAJ instruction definition instance.
- ///
- public static Instruction MAJ(Argument axis, Argument motion_control, Argument direction, Argument speed,
- Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate, Argument decel_units,
- Argument profile, Argument merge, Argument merge_speed) => new(nameof(MAJ),
- "MAJ(axis,motion_control,direction,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,merge,merge_speed)",
- axis, motion_control, direction, speed, speed_units, accel_rate, accel_units, decel_rate, decel_units, profile,
- merge, merge_speed);
-
- ///
- /// Gets the MAM instruction definition instance.
- ///
- public static Instruction MAM(Argument axis, Argument motion_control, Argument move_type, Argument position,
- Argument speed, Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate,
- Argument decel_units, Argument profile, Argument merge, Argument merge_speed) => new(nameof(MAM),
- "MAM(axis,motion_control,move_type,position,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,merge,merge_speed)",
- axis, motion_control, move_type, position, speed, speed_units, accel_rate, accel_units, decel_rate, decel_units,
- profile, merge, merge_speed);
-
- ///
- /// Gets the MAOC instruction definition instance.
- ///
- public static Instruction MAOC(Argument axis, Argument execution_target, Argument motion_control, Argument output,
- Argument input, Argument output_cam, Argument cam_start_position, Argument cam_end_position,
- Argument output_compensation, Argument execution_mode, Argument execution_schedule, Argument axis_arm_position,
- Argument cam_arm_position, Argument reference) => new(nameof(MAOC),
- "MAOC(axis,execution_target,motion_control,output,input,output_cam,cam_start_position,cam_end_position,output_compensation,execution_mode,execution_schedule,axis_arm_position,cam_arm_position,reference)",
- axis, execution_target, motion_control, output, input, output_cam, cam_start_position, cam_end_position,
- output_compensation, execution_mode, execution_schedule, axis_arm_position, cam_arm_position, reference);
-
- ///
- /// Gets the MAPC instruction definition instance.
- ///
- public static Instruction MAPC(Argument slave_axis, Argument master_axis, Argument motion_control,
- Argument direction, Argument cam_profile, Argument slave_scaling, Argument master_scaling,
- Argument execution_mode, Argument execution_schedule, Argument master_lock_position, Argument cam_lock_position,
- Argument master_reference, Argument master_direction) => new(nameof(MAPC),
- "MAPC(slave_axis,master_axis,motion_control,direction,cam_profile,slave_scaling,master_scaling,execution_mode,execution_schedule,master_lock_position,cam_lock_position,master_reference,master_direction)",
- slave_axis, master_axis, motion_control, direction, cam_profile, slave_scaling, master_scaling, execution_mode,
- execution_schedule, master_lock_position, cam_lock_position, master_reference, master_direction);
-
- ///
- /// Gets the MAR instruction definition instance.
- ///
- public static Instruction MAR(Argument axis, Argument motion_control, Argument trigger_condition,
- Argument windowed_registration, Argument minimum_position, Argument maximum_position) => new(nameof(MAR),
- "MAR(axis,motion_control,trigger_condition,windowed_registration,minimum_position,maximum_position)", axis,
- motion_control, trigger_condition, windowed_registration, minimum_position, maximum_position);
-
- ///
- /// Gets the MAS instruction definition instance.
- ///
- public static Instruction MAS(Argument axis, Argument motion_control, Argument stop_type, Argument change_decel,
- Argument decel_rate, Argument decel_units) => new(nameof(MAS),
- "MAS(axis,motion_control,stop_type,change_decel,decel_rate,decel_units)", axis, motion_control, stop_type,
- change_decel, decel_rate, decel_units);
-
- ///
- /// Gets the MASD instruction definition instance.
- ///
- public static Instruction MASD(Argument axis, Argument motion_control) =>
- new(nameof(MASD), "MASD(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MASR instruction definition instance.
- ///
- public static Instruction MASR(Argument axis, Argument motion_control) =>
- new(nameof(MASR), "MASR(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MATC instruction definition instance.
- ///
- public static Instruction MATC(Argument axis, Argument motion_control, Argument direction, Argument cam_profile,
- Argument distance_scaling, Argument time_scaling, Argument execution_mode, Argument execution_schedule) => new(
- nameof(MATC),
- "MATC(axis,motion_control,direction,cam_profile,distance_scaling,time_scaling,execution_mode,execution_schedule)",
- axis, motion_control, direction, cam_profile, distance_scaling, time_scaling, execution_mode,
- execution_schedule);
-
- ///
- /// Gets the MAW instruction definition instance.
- ///
- public static Instruction MAW(Argument axis, Argument motion_control, Argument trigger_condition,
- Argument position) =>
- new(nameof(MAW), "MAW(axis,motion_control,trigger_condition,position)", axis, motion_control,
- trigger_condition, position);
-
- ///
- /// Gets the MCCD instruction definition instance.
- ///
- public static Instruction MCCD(Argument coordinate_system, Argument motion_control, Argument motion_type,
- Argument change_speed, Argument speed, Argument speed_units, Argument change_accel, Argument accel_rate,
- Argument accel_units, Argument change_decel, Argument decel_rate, Argument decel_units, Argument scope) => new(
- nameof(MCCD),
- "MCCD(coordinate_system,motion_control,motion_type,change_speed,speed,speed_units,change_accel,accel_rate,accel_units,change_decel,decel_rate, decel_units,scope)",
- coordinate_system, motion_control, motion_type, change_speed, speed, speed_units, change_accel, accel_rate,
- accel_units, change_decel, decel_rate, decel_units, scope);
-
- ///
- /// Gets the MCCM instruction definition instance.
- ///
- public static Instruction MCCM(Argument coordinate_system, Argument motion_control, Argument move_type,
- Argument position, Argument circle_type, Argument radius, Argument direction, Argument speed,
- Argument speed_units, Argument accel_rate, Argument accel_units, Argument decel_rate, Argument decel_units,
- Argument profile, Argument termination_type, Argument merge, Argument merge_speed) => new(nameof(MCCM),
- "MCCM(coordinate_system,motion_control,move_type,position,circle_type,via/center/radius,direction,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile,termination_type,merge,merge_speed)",
- coordinate_system, motion_control, move_type, position, circle_type, radius, direction, speed, speed_units,
- accel_rate, accel_units, decel_rate, decel_units, profile, termination_type, merge, merge_speed);
-
- ///
- /// Gets the MCCP instruction definition instance.
- ///
- public static Instruction MCCP(Argument motion_control, Argument cam, Argument length, Argument start_slope,
- Argument end_slope, Argument cam_profile) => new(nameof(MCCP),
- "MCCP(motion_control,cam,length,start_slope,end_slope,cam_profile)", motion_control, cam, length, start_slope,
- end_slope, cam_profile);
-
- ///
- /// Gets the MCLM instruction definition instance.
- ///
- public static Instruction MCLM(Argument coordinate_system, Argument motion_control, Argument move_type,
- Argument position, Argument speed, Argument speed_units, Argument accel_rate, Argument accel_units,
- Argument decel_rate, Argument decel_units, Argument profile, Argument termination_type, Argument merge,
- Argument merge_speed) => new(nameof(MCLM),
- "MCLM(coordinate_system,motion_control,move_type,position,speed,speed_units,accel_rate,accel_units,decel_rate,decel_units,profile, termination_type,merge,merge_speed)",
- coordinate_system, motion_control, move_type, position, speed, speed_units, accel_rate, accel_units, decel_rate,
- decel_units, profile, termination_type, merge, merge_speed);
-
- ///
- /// Gets the MCD instruction definition instance.
- ///
- public static Instruction MCD(Argument axis, Argument motion_control, Argument motion_type, Argument change_speed,
- Argument speed, Argument change_accel, Argument accel_rate, Argument change_decel, Argument decel_rate,
- Argument speed_units, Argument accel_units, Argument decel_units) => new(nameof(MCD),
- "MCD(axis,motion_control,motion_type,change_speed,speed,change_accel,accel_rate,change_decel,decel_rate,speed_units,accel_units,decel_units)",
- axis, motion_control, motion_type, change_speed, speed, change_accel, accel_rate, change_decel, decel_rate,
- speed_units, accel_units, decel_units);
-
- ///
- /// Gets the MCR instruction definition instance.
- ///
- public static Instruction MCR() => new(nameof(MCR), "MCR()");
-
- ///
- /// Gets the MCS instruction definition instance.
- ///
- public static Instruction MCS(Argument coordinate_system, Argument motion_control, Argument stop_type,
- Argument change_decel, Argument decel_rate, Argument decel_units) => new(nameof(MCS),
- "MCS(coordinate_system,motion_control,stop_type,change_decel,decel_rate, decel_units)", coordinate_system,
- motion_control, stop_type, change_decel, decel_rate, decel_units);
-
- ///
- /// Gets the MCSD instruction definition instance.
- ///
- public static Instruction MCSD(Argument coordinate_system, Argument motion_control) =>
- new(nameof(MCSD), "MCSD(coordinate_system,motion_control)", coordinate_system, motion_control);
-
- ///
- /// Gets the MCSR instruction definition instance.
- ///
- public static Instruction MCSR(Argument coordinate_system, Argument motion_control) =>
- new(nameof(MCSR), "MCSR(coordinate_system,motion_control)", coordinate_system, motion_control);
-
- ///
- /// Gets the MCSV instruction definition instance.
- ///
- public static Instruction MCSV(Argument motion_control, Argument cam_profile, Argument master_value,
- Argument slave_value, Argument slope_value, Argument slope_derivative) => new(nameof(MCSV),
- "MCSV(motion_control,cam_profile,master_value,slave_value,slope_value,slope_derivative)", motion_control,
- cam_profile, master_value, slave_value, slope_value, slope_derivative);
-
- ///
- /// Gets the MCT instruction definition instance.
- ///
- public static Instruction MCT(Argument source_system, Argument target_system, Argument motion_control,
- Argument orientation, Argument translation) => new(nameof(MCT),
- "MCT(source_system,target_system,motion_control,orientation,translation)", source_system, target_system,
- motion_control, orientation, translation);
-
- ///
- /// Gets the MCTP instruction definition instance.
- ///
- public static Instruction MCTP(Argument source_system, Argument target_system, Argument motion_control,
- Argument orientation, Argument translation, Argument transform_direction, Argument reference_position,
- Argument transform_position) => new(nameof(MCTP),
- "MCTP(source_system,target_system,motion_control,orientation,translation,transform_direction,reference_position,transform_position)",
- source_system, target_system, motion_control, orientation, translation, transform_direction, reference_position,
- transform_position);
-
- ///
- /// Gets the MDF instruction definition instance.
- ///
- public static Instruction MDF(Argument axis, Argument motion_control) =>
- new(nameof(MDF), "MDF(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MDO instruction definition instance.
- ///
- public static Instruction MDO(Argument axis, Argument motion_control, Argument drive_output,
- Argument drive_units) =>
- new(nameof(MDO), "MDO(axis,motion_control,drive_output,drive_units)", axis, motion_control, drive_output,
- drive_units);
-
- ///
- /// Gets the MDOC instruction definition instance.
- ///
- public static Instruction MDOC(Argument axis, Argument execution_target, Argument motion_control,
- Argument disarm_type) =>
- new(nameof(MDOC), "MDOC(axis,execution_target,motion_control,disarm_type)", axis, execution_target,
- motion_control, disarm_type);
-
- ///
- /// Gets the MDR instruction definition instance.
- ///
- public static Instruction MDR(Argument axis, Argument motion_control) =>
- new(nameof(MDR), "MDR(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MDW instruction definition instance.
- ///
- public static Instruction MDW(Argument axis, Argument motion_control) =>
- new(nameof(MDW), "MDW(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MEQ instruction definition instance.
- ///
- public static Instruction MEQ(Argument source, Argument mask, Argument compare) =>
- new(nameof(MEQ), "MEQ(source,mask,compare)", source, mask, compare);
-
- ///
- /// Gets the MGS instruction definition instance.
- ///
- public static Instruction MGS(Argument group, Argument motion_control, Argument stop_mode) =>
- new(nameof(MGS), "MGS(group,motion_control,stop_mode)", group, motion_control, stop_mode);
-
- ///
- /// Gets the MGSD instruction definition instance.
- ///
- public static Instruction MGSD(Argument group, Argument motion_control) =>
- new(nameof(MGSD), "MGSD(group,motion_control)", group, motion_control);
-
- ///
- /// Gets the MGSP instruction definition instance.
- ///
- public static Instruction MGSP(Argument group, Argument motion_control) =>
- new(nameof(MGSP), "MGSP(group,motion_control)", group, motion_control);
-
- ///
- /// Gets the MGSR instruction definition instance.
- ///
- public static Instruction MGSR(Argument group, Argument motion_control) =>
- new(nameof(MGSR), "MGSR(group,motion_control)", group, motion_control);
-
- ///
- /// Gets the MID instruction definition instance.
- ///
- public static Instruction MID(Argument source, Argument quantity, Argument start, Argument destination) =>
- new(nameof(MID), "MID(source,quantity,start,destination)", source, quantity, start, destination);
-
- ///
- /// Gets the MMVC instruction definition instance.
- ///
- public static Instruction MMVC(Argument mmvc_tag, Argument enable, Argument keyswitch, Argument bottom,
- Argument flywheel_stopped, Argument safety_enable, Argument actuate, Argument input_status,
- Argument output_status, Argument reset) => new(nameof(MMVC),
- "MMVC(mmvc_tag,enable,keyswitch,bottom,flywheel_stopped,safety_enable,actuate,input_status,output_status,reset)",
- mmvc_tag, enable, keyswitch, bottom, flywheel_stopped, safety_enable, actuate, input_status, output_status,
- reset);
-
- ///
- /// Gets the MOD instruction definition instance.
- ///
- public static Instruction MOD(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(MOD), "MOD(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the MOV instruction definition instance.
- ///
- public static Instruction MOV(Argument source, Argument destination) =>
- new(nameof(MOV), "MOV(source,destination)", source, destination);
-
- ///
- /// Gets the MRAT instruction definition instance.
- ///
- public static Instruction MRAT(Argument axis, Argument motion_control) =>
- new(nameof(MRAT), "MRAT(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MRHD instruction definition instance.
- ///
- public static Instruction MRHD(Argument axis, Argument motion_control, Argument diagnostic_test) =>
- new(nameof(MRHD), "MRHD(axis,motion_control,diagnostic_test)", axis, motion_control, diagnostic_test);
-
- ///
- /// Gets the MRP instruction definition instance.
- ///
- public static Instruction MRP(Argument axis, Argument motion_control, Argument type, Argument position_select,
- Argument position) =>
- new(nameof(MRP), "MRP(axis,motion_control,type,position_select,position)", axis, motion_control, type,
- position_select, position);
-
- ///
- /// Gets the MSF instruction definition instance.
- ///
- public static Instruction MSF(Argument axis, Argument motion_control) =>
- new(nameof(MSF), "MSF(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MSG instruction definition instance.
- ///
- public static Instruction MSG(Argument message_control) =>
- new(nameof(MSG), "MSG(message_control)", message_control);
-
- ///
- /// Gets the MSO instruction definition instance.
- ///
- public static Instruction MSO(Argument axis, Argument motion_control) =>
- new(nameof(MSO), "MSO(axis,motion_control)", axis, motion_control);
-
- ///
- /// Gets the MUL instruction definition instance.
- ///
- public static Instruction MUL(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(MUL), "MUL(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the MVC instruction definition instance.
- ///
- public static Instruction MVC(Argument mvc_tag, Argument feedback_type, Argument feedback_reaction_time,
- Argument actuate, Argument feedback_1, Argument feedback_2, Argument input_status, Argument output_status,
- Argument reset) => new(nameof(MVC),
- "MVC(mvc_tag,feedback_type,feedback_reaction_time,actuate,feedback_1,feedback_2,input_status,output_status,reset)",
- mvc_tag, feedback_type, feedback_reaction_time, actuate, feedback_1, feedback_2, input_status, output_status,
- reset);
-
- ///
- /// Gets the MVM instruction definition instance.
- ///
- public static Instruction MVM(Argument source, Argument mask, Argument destination) =>
- new(nameof(MVM), "MVM(source,mask,destination)", source, mask, destination);
-
- ///
- /// Gets the NEG instruction definition instance.
- ///
- public static Instruction NEG(Argument source, Argument destination) =>
- new(nameof(NEG), "NEG(source,destination)", source, destination);
-
- ///
- /// Gets the NEQ instruction definition instance.
- ///
- public static Instruction NEQ(Argument source_A, Argument source_B) =>
- new(nameof(NEQ), "NEQ(source_A,source_B)", source_A, source_B);
-
- ///
- /// Gets the NOP instruction definition instance.
- ///
- public static Instruction NOP() => new(nameof(NOP), "NOP()");
-
- ///
- /// Gets the NOT instruction definition instance.
- ///
- public static Instruction NOT(Argument source, Argument destination) =>
- new(nameof(NOT), "NOT(source,destination)", source, destination);
-
- ///
- /// Gets the ONS instruction definition instance.
- ///
- public static Instruction ONS(Argument storage_bit) => new(nameof(ONS), "ONS(storage_bit)", storage_bit);
-
- ///
- /// Gets the OR instruction definition instance.
- ///
- public static Instruction OR(Argument source_A, Argument source_B, Argument destination) => new(nameof(OR),
- "OR(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the OSF instruction definition instance.
- ///
- public static Instruction OSF(Argument storage_bit, Argument output_bit) =>
- new(nameof(OSF), "OSF(storage_bit,output_bit)", storage_bit, output_bit);
-
- ///
- /// Gets the OSR instruction definition instance.
- ///
- public static Instruction OSR(Argument storage_bit, Argument output_bit) =>
- new(nameof(OSR), "OSR(storage_bit,output_bit)", storage_bit, output_bit);
-
- ///
- /// Gets the OTE instruction definition instance.
- ///
- public static Instruction OTE(Argument data_bit) => new(nameof(OTE), "OTE(data_bit)", data_bit);
-
- ///
- /// Gets the OTL instruction definition instance.
- ///
- public static Instruction OTL(Argument data_bit) => new(nameof(OTL), "OTL(data_bit)", data_bit);
-
- ///
- /// Gets the OTU instruction definition instance.
- ///
- public static Instruction OTU(Argument data_bit) => new(nameof(OTU), "OTU(data_bit)", data_bit);
-
- ///
- /// Gets the PATT instruction definition instance.
- ///
- public static Instruction PATT(Argument phase_name, Argument result) =>
- new(nameof(PATT), "PATT(phase_name,result)", phase_name, result);
-
- ///
- /// Gets the PCLF instruction definition instance.
- ///
- public static Instruction PCLF(Argument phase_name) => new(nameof(PCLF), "PCLF(phase_name)", phase_name);
-
- ///
- /// Gets the PCMD instruction definition instance.
- ///
- public static Instruction PCMD(Argument phase_name, Argument command, Argument result) =>
- new(nameof(PCMD), "PCMD(phase_name,command,result)", phase_name, command, result);
-
- ///
- /// Gets the PDET instruction definition instance.
- ///
- public static Instruction PDET(Argument phase_name) => new(nameof(PDET), "PDET(phase_name)", phase_name);
-
- ///
- /// Gets the PFL instruction definition instance.
- ///
- public static Instruction PFL(Argument source) => new(nameof(PFL), "PFL(source)", source);
-
- ///
- /// Gets the PID instruction definition instance.
- ///
- public static Instruction PID(Argument PID, Argument process_variable, Argument tieback, Argument control_variable,
- Argument pid_master_loop, Argument inhold_bit, Argument inhold_value) => new(nameof(PID),
- "PID(PID,process_variable,tieback,control_variable,pid_master_loop,inhold_bit,inhold_value)", PID,
- process_variable, tieback, control_variable, pid_master_loop, inhold_bit, inhold_value);
-
- ///
- /// Gets the POVR instruction definition instance.
- ///
- public static Instruction POVR(Argument phase_name, Argument command, Argument result) =>
- new(nameof(POVR), "POVR(phase_name,command,result)", phase_name, command, result);
-
- ///
- /// Gets the PPD instruction definition instance.
- ///
- public static Instruction PPD() => new(nameof(PPD), "PPD()");
-
- ///
- /// Gets the PRNP instruction definition instance.
- ///
- public static Instruction PRNP() => new(nameof(PRNP), "PRNP()");
-
- ///
- /// Gets the PSC instruction definition instance.
- ///
- public static Instruction PSC() => new(nameof(PSC), "PSC()");
-
- ///
- /// Gets the PXRQ instruction definition instance.
- ///
- public static Instruction PXRQ(Argument phase_instruction, Argument external_request, Argument data_value) =>
- new(nameof(PXRQ), "PXRQ(phase_instruction,external_request,data_value)", phase_instruction, external_request,
- data_value);
-
- ///
- /// Gets the RAD instruction definition instance.
- ///
- public static Instruction RAD(Argument source, Argument destination) =>
- new(nameof(RAD), "RAD(source,destination)", source, destination);
-
- ///
- /// Gets the RES instruction definition instance.
- ///
- public static Instruction RES(Argument structure) => new(nameof(RES), "RES(structure)", structure);
-
- ///
- /// Gets the RET instruction definition instance.
- ///
- public static Instruction RET(params Argument[] outputs) => new(nameof(RET), "RET(return_1,return_n)", outputs);
-
- ///
- /// Gets the RIN instruction definition instance.
- ///
- public static Instruction RIN(Argument rin_tag, Argument reset_type, Argument channel_A, Argument channel_B,
- Argument circuit_reset, Argument fault_reset) => new(nameof(RIN),
- "RIN(rin_tag,reset_type,channel_A,channel_B,circuit_reset,fault_reset)", rin_tag, reset_type, channel_A,
- channel_B, circuit_reset, fault_reset);
-
- ///
- /// Gets the ROUT instruction definition instance.
- ///
- public static Instruction ROUT(Argument rout_tag, Argument feedback_type, Argument enable, Argument feedback_1,
- Argument feedback_2, Argument fault_reset) => new(nameof(ROUT),
- "ROUT(rout_tag,feedback_type,enable,feedback_1,feedback_2,fault_reset)", rout_tag, feedback_type, enable,
- feedback_1, feedback_2, fault_reset);
-
- ///
- /// Gets the RTO instruction definition instance.
- ///
- public static Instruction RTO(Argument timer, Argument preset, Argument accum) =>
- new(nameof(RTO), "RTO(timer,preset,accum)", timer, preset, accum);
-
- ///
- /// Gets the RTOS instruction definition instance.
- ///
- public static Instruction RTOS(Argument source, Argument destination) =>
- new(nameof(RTOS), "RTOS(source,destination)", source, destination);
-
- ///
- /// Gets the SBR instruction definition instance.
- ///
- public static Instruction SBR(params Argument[] inputs) => new(nameof(SBR), "SBR(input_1,input_n)", inputs);
-
- ///
- /// Gets the SFP instruction definition instance.
- ///
- public static Instruction SFP(Argument SFC_routine_name, Argument target_state) =>
- new(nameof(SFP), "SFP(SFC_routine_name,target_state)", SFC_routine_name, target_state);
-
- ///
- /// Gets the SFR instruction definition instance.
- ///
- public static Instruction SFR(Argument SFC_routine_name, Argument step_name) => new(nameof(SFR),
- "SFR(SFC_routine_name,step_name)", SFC_routine_name, step_name);
-
- ///
- /// Gets the SIN instruction definition instance.
- ///
- public static Instruction SIN(Argument source, Argument destination) =>
- new(nameof(SIN), "SIN(source,destination)", source, destination);
-
- ///
- /// Gets the SIZE instruction definition instance.
- ///
- public static Instruction SIZE(Argument souce, Argument dimension_to_vary, Argument size) =>
- new(nameof(SIZE), "SIZE(souce,dimension_to_vary,size)", souce, dimension_to_vary, size);
-
- ///
- /// Gets the SMAT instruction definition instance.
- ///
- public static Instruction SMAT(Argument smat_tag, Argument restart_type, Argument short_circuit_detect_delay_time,
- Argument channel_A, Argument channel_B, Argument input_status, Argument reset) => new(nameof(SMAT),
- "SMAT(smat_tag,restart_type,short_circuit_detect_delay_time,channel_A,channel_B,input_status,reset)", smat_tag,
- restart_type, short_circuit_detect_delay_time, channel_A, channel_B, input_status, reset);
-
- ///
- /// Gets the SQI instruction definition instance.
- ///
- public static Instruction SQI(Argument array, Argument mask, Argument source, Argument control, Argument length,
- Argument position) =>
- new(nameof(SQI), "SQI(array,mask,source,control,length,position)", array, mask, source, control, length,
- position);
-
- ///
- /// Gets the SQL instruction definition instance.
- ///
- public static Instruction SQL(Argument array, Argument source, Argument control, Argument length,
- Argument position) =>
- new(nameof(SQL), "SQL(array,source,control,length,position)", array, source, control, length, position);
-
- ///
- /// Gets the SQO instruction definition instance.
- ///
- public static Instruction SQO(Argument array, Argument mask, Argument destination, Argument control,
- Argument length, Argument position) =>
- new(nameof(SQO), "SQO(array,mask,destination,control,length,position)", array, mask, destination, control,
- length, position);
-
- ///
- /// Gets the SQR instruction definition instance.
- ///
- public static Instruction SQR(Argument source, Argument destination) =>
- new(nameof(SQR), "SQR(source,destination)", source, destination);
-
- ///
- /// Gets the SRT instruction definition instance.
- ///
- public static Instruction SRT(Argument array, Argument dim_to_vary, Argument control, Argument length,
- Argument position) =>
- new(nameof(SRT), "SRT(array,dim_to_vary,control,length,position)", array, dim_to_vary, control, length,
- position);
-
- ///
- /// Gets the SSV instruction definition instance.
- ///
- public static Instruction SSV(Argument class_name, Argument instance_name, Argument attribute_name,
- Argument source) =>
- new(nameof(SSV), "SSV(class_name,instance_name,attribute_name,source)", class_name, instance_name,
- attribute_name, source);
-
- ///
- /// Gets the STD instruction definition instance.
- ///
- public static Instruction STD(Argument array, Argument dim_to_vary, Argument destination, Argument control,
- Argument length, Argument position) => new(nameof(STD),
- "STD(array,dim_to_vary,destination,control,length,position)", array, dim_to_vary, destination, control, length,
- position);
-
- ///
- /// Gets the STOD instruction definition instance.
- ///
- public static Instruction STOD(Argument source, Argument destination) =>
- new(nameof(STOD), "STOD(source,destination)", source, destination);
-
- ///
- /// Gets the STOR instruction definition instance.
- ///
- public static Instruction STOR(Argument source, Argument destination) =>
- new(nameof(STOR), "STOR(source,destination)", source, destination);
-
- ///
- /// Gets the SUB instruction definition instance.
- ///
- public static Instruction SUB(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(SUB), "SUB(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the SWPB instruction definition instance.
- ///
- public static Instruction SWPB(Argument source, Argument order_mode, Argument destination) =>
- new(nameof(SWPB), "SWPB(source,order_mode,destination)", source, order_mode, destination);
-
- ///
- /// Gets the TAN instruction definition instance.
- ///
- public static Instruction TAN(Argument source, Argument destination) =>
- new(nameof(TAN), "TAN(source,destination)", source, destination);
-
- ///
- /// Gets the THRS instruction definition instance.
- ///
- public static Instruction THRS(Argument thrs_tag, Argument active_pin_type, Argument active_pin,
- Argument right_button_normally_open, Argument right_button_normally_closed, Argument left_button_normally_open,
- Argument left_button_normally_closed, Argument fault_reset) => new(nameof(THRS),
- "THRS(thrs_tag,active_pin_type,active_pin,right_button_normally_open,right_button_normally_closed,left_button_normally_open,left_button_normally_closed,fault_reset)",
- thrs_tag, active_pin_type, active_pin, right_button_normally_open, right_button_normally_closed,
- left_button_normally_open, left_button_normally_closed, fault_reset);
-
- ///
- /// Gets the THRSE instruction definition instance.
- ///
- public static Instruction THRSE(Argument thrse_tag, Argument discprepancy_time, Argument enable,
- Argument disconnected, Argument right_button_normally_open, Argument right_button_normally_closed,
- Argument left_button_normally_open, Argument left_button_normally_closed, Argument input_status,
- Argument resest) => new(nameof(THRSE),
- "THRSE(thrse_tag,discprepancy_time,enable,disconnected,right_button_normally_open,right_button_normally_closed,left_button_normally_open,left_button_normally_closed,input_status,resest)",
- thrse_tag, discprepancy_time, enable, disconnected, right_button_normally_open, right_button_normally_closed,
- left_button_normally_open, left_button_normally_closed, input_status, resest);
-
- ///
- /// Gets the TND instruction definition instance.
- ///
- public static Instruction TND() => new(nameof(TND), "TND()");
-
- ///
- /// Gets the TOD instruction definition instance.
- ///
- public static Instruction TOD(Argument source, Argument destination) =>
- new(nameof(TOD), "TOD(source,destination)", source, destination);
-
- ///
- /// Gets the TOF instruction definition instance.
- ///
- public static Instruction TOF(Argument timer, Argument preset, Argument accum) =>
- new(nameof(TOF), "TOF(timer,preset,accum)", timer, preset, accum);
-
- ///
- /// Gets the TON instruction definition instance.
- ///
- public static Instruction TON(Argument timer, Argument preset, Argument accum) =>
- new(nameof(TON), "TON(timer,preset,accum)", timer, preset, accum);
-
- ///
- /// Gets the TRN instruction definition instance.
- ///
- public static Instruction TRN(Argument source, Argument destination) =>
- new(nameof(TRN), "TRN(source,destination)", source, destination);
-
- ///
- /// Gets the TSAM instruction definition instance.
- ///
- public static Instruction TSAM(Argument tsam_tag, Argument restart_type, Argument S1_S2_time, Argument S2_LC_time,
- Argument maximum_mute_time, Argument maximum_override_time, Argument light_curtain, Argument sensor_1,
- Argument sensor_2, Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status,
- Argument reset) => new(nameof(TSAM),
- "TSAM(tsam_tag,restart_type,S1_S2_time,S2_LC_time,maximum_mute_time,maximum_override_time,light_curtain,sensor_1,sensor_2,enable_mute,override,input_status,muting_lamp_status,reset)",
- tsam_tag, restart_type, S1_S2_time, S2_LC_time, maximum_mute_time, maximum_override_time, light_curtain,
- sensor_1, sensor_2, enable_mute, @override, input_status, muting_lamp_status, reset);
-
- ///
- /// Gets the TSSM instruction definition instance.
- ///
- public static Instruction TSSM(Argument tssm_tag, Argument restart_type, Argument S1_S2_discrepancy_time,
- Argument S1_S2_LC_minimum_time, Argument S1_S2_LC_maximum_time, Argument maximum_mute_time,
- Argument maximum_override_time, Argument light_curtain, Argument sensor_1, Argument sensor_2,
- Argument enable_mute, Argument @override, Argument input_status, Argument muting_lamp_status, Argument reset) =>
- new(nameof(TSSM),
- "TSSM(tssm_tag,restart_type,S1_S2_discrepancy_time,S1_S2_LC_minimum_time,S1_S2_LC_maximum_time,maximum_mute_time,maximum_override_time,light_curtain,sensor_1,sensor_2,enable_mute,override,input_status,muting_lamp_status,reset)",
- tssm_tag, restart_type, S1_S2_discrepancy_time, S1_S2_LC_minimum_time, S1_S2_LC_maximum_time,
- maximum_mute_time, maximum_override_time, light_curtain, sensor_1, sensor_2, enable_mute, @override,
- input_status, muting_lamp_status, reset);
-
- ///
- /// Gets the UID instruction definition instance.
- ///
- public static Instruction UID() => new(nameof(UID), "UID()");
-
- ///
- /// Gets the UIE instruction definition instance.
- ///
- public static Instruction UIE() => new(nameof(UIE), "UIE()");
-
- ///
- /// Gets the UPPER instruction definition instance.
- ///
- public static Instruction UPPER(Argument source, Argument destination) =>
- new(nameof(UPPER), "UPPER(source,destination)", source, destination);
-
- ///
- /// Creates a new XIC instruction instance with the predeinfed signature and provided instruction arguments.
- ///
- /// A new with initialized key, signature, and arguments.
- ///
- /// Note that this instruction method signature was extracted from the Rockwell L5X documentation.
- /// Each instruction will take the set of matching the instruction signature.
- /// It is up to the caller to know whether these can be immediate value arguments or tag name reference arguments.
- ///
- public static Instruction XIC(Argument data_bit) => new(nameof(XIC), "XIC(data_bit)", data_bit);
-
- ///
- /// Gets the XIO instruction definition instance.
- ///
- public static Instruction XIO(Argument data_bit) => new(nameof(XIO), "XIO(data_bit)", data_bit);
-
- ///
- /// Gets the XOR instruction definition instance.
- ///
- public static Instruction XOR(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(XOR), "XOR(source_A,source_B,destination)", source_A, source_B, destination);
-
- ///
- /// Gets the XPY instruction definition instance.
- ///
- public static Instruction XPY(Argument source_A, Argument source_B, Argument destination) =>
- new(nameof(XPY), "XPY(source_A,source_B,destination)", source_A, source_B, destination);
-
- #endregion
-
- ///
- /// Creates some default arg names for a provided number of arguments.
- ///
- private static string DefaultArgs(int number)
- {
- return string.Join(',', Enumerable.Range(0, number).Select(i => $"arg{i}"));
- }
-
- ///
- /// Indexes all instruction factory methods in the class and creates a function returning the instruction
- /// mathcing the specified key or method name. The method is passed null argumnts and therefore will be a default
- /// instruction instance. Callers can then use to pass argument array.
- ///
- private static IEnumerable>> Factories()
- {
- var methods = typeof(Instruction).GetMethods(BindingFlags.Public | BindingFlags.Static)
- .Where(m => m.ReturnType == typeof(Instruction) && m.Name.All(char.IsUpper));
-
- foreach (var method in methods)
- {
- var arguments = method.GetParameters()
- .Select(p => Expression.TypeAs(Expression.Constant(null), p.ParameterType));
- var function = Expression.Call(method, arguments);
- var lambda = Expression.Lambda>(function);
- yield return new KeyValuePair>(method.Name, lambda.Compile());
- }
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/NeutralText.cs b/src/L5Sharp/Common/NeutralText.cs
deleted file mode 100644
index a3c56a31..00000000
--- a/src/L5Sharp/Common/NeutralText.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace L5Sharp.Core;
-
-///
-/// A thin wrapper around the textual representation of logic notation called neutral text. This could represent a
-/// single instruction signature, a rung of logic (combination of instructions), or a line of structured text. The
-/// purpose of this class is to provide a way to parse the text into strongly typed objects that are easier to work with.
-///
-///
-/// Neutral text can represent a single instruction or a full rung (collection of instructions).
-/// Each instruction contains sets of tag names and values known as arguments or operands.
-/// This class provides functions for extracting the textual information into strongly type classes that are easier
-/// to work with.
-///
-///
-///
-///
-public sealed class NeutralText
-{
- private readonly string _text;
-
- ///
- /// Creates a new object with the provided text input.
- ///
- /// A string input that represents a neutral text format.
- /// When text is null.
- /// When text is null.
- public NeutralText(string text)
- {
- _text = text ?? throw new ArgumentNullException(nameof(text));
- }
-
- ///
- /// Indicates whether the current neutral text value has balanced brackets and parentheses.
- ///
- /// true if the text has balanced brackets and parentheses; otherwise, false.
- public bool IsBalanced => TextIsBalanced(_text, '[', ']') && TextIsBalanced(_text, '(', ')');
-
- ///
- /// Indicates whether the current neutral text value is an empty string.
- ///
- /// true if the text empty; otherwise false.
- public bool IsEmpty => _text.IsEquivalent(string.Empty);
-
- ///
- /// Represents a new empty instance of the .
- ///
- /// An empty object.
- public static NeutralText Empty => new(string.Empty);
-
- ///
- /// Returns a value indicating whether a specified instruction key occurs within this neutral text.
- ///
- /// The instruction name to seek.
- /// true if this text contains the instruction key; otherwise, false..
- public bool Contains(string value) => _text.Contains(value);
-
- ///
- /// Runs the provided regex pattern against the neutral text and indicates whether the patterns is matched.
- ///
- /// The regex pattern to test against.
- /// true if regex is a match against this neutral text value.
- public bool HasPattern(string regex) => Regex.IsMatch(_text, regex);
-
- ///
- /// Returns a collection of objects that were found in the current neutral text value.
- ///
- /// An containing objects found in the text.
- public IEnumerable Instructions() =>
- Regex.Matches(_text, Instruction.Pattern).Select(m => Instruction.Parse(m.Value));
-
- ///
- ///
- ///
- ///
- ///
- public IEnumerable Instructions(string key) =>
- Regex.Matches(_text, Instruction.Pattern).Select(m => Instruction.Parse(m.Value)).Where(i => i.Key == key);
-
- ///
- /// Returns a collection of objects that were found in the current neutral text value.
- ///
- /// An containing objects found in the text.
- public IEnumerable Instructions(Instruction instruction) =>
- Regex.Matches(_text, Instruction.Pattern).Select(m => Instruction.Parse(m.Value)).Where(i => i == instruction);
-
- ///
- /// Gets a collection of keywords found in the current neutral text.
- ///
- /// A containing values found.
- public IEnumerable Keywords() => Keyword.All().Where(k => _text.Contains(k.Value));
-
- ///
- /// Gets a collection of tag names found in the current neutral text.
- ///
- /// A of values that were in from the current text.
- ///
- public IEnumerable Tags() => Regex.Matches(_text, TagName.SearchPattern).Select(t => new TagName(t.Value));
-
- ///
- /// Gets a collection of tag names found in the current neutral text that are operands or arguments to a specific instruction.
- ///
- /// The instruction for which to find tags as arguments to.
- /// A containing tag names found in the specified instruction.
- public IEnumerable TagsIn(string instruction) => Instructions(instruction).SelectMany(i => i.Text.Tags());
-
- ///
- public override string ToString() => _text;
-
- ///
- public override bool Equals(object? obj)
- {
- if (ReferenceEquals(this, obj)) return true;
-
- return obj switch
- {
- NeutralText other => _text.IsEquivalent(other._text),
- string other => _text.IsEquivalent(other),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(_text);
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(NeutralText? left, NeutralText? right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(NeutralText? left, NeutralText? right) => !Equals(left, right);
-
- ///
- /// Converts a NeutralText object to a string object.
- ///
- /// the NeutralText instance to convert.
- /// A string that represents the value of the NeutralText.
- public static implicit operator string(NeutralText text) => text._text;
-
- ///
- /// Converts a string object to a NeutralText object.
- ///
- /// the string instance to convert.
- /// A NeutralText that represents the value of the string.
- public static implicit operator NeutralText(string text) => new(text);
-
- private bool TextIsBalanced(string value, char opening, char closing)
- {
- var characters = new Stack();
-
- foreach (var c in value)
- {
- if (Equals(c, opening))
- characters.Push(c);
-
- if (!Equals(c, closing)) continue;
-
- if (!characters.TryPop(out _))
- return false;
- }
-
- return characters.Count == 0;
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/ProductType.cs b/src/L5Sharp/Common/ProductType.cs
deleted file mode 100644
index f0da89e5..00000000
--- a/src/L5Sharp/Common/ProductType.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System;
-
-namespace L5Sharp.Core;
-
-///
-/// An entity that represents the type of product of a given .
-///
-///
-/// This object is a simple entity type wrapper that groups the product type id and name.
-/// Product types are defined by Rockwell and assigned unique Id and name.
-/// Some known/common types that are available as static members of this class
-/// include , , , and .
-///
-public class ProductType
-{
- ///
- /// Creates a new entity with the provided id and name.
- ///
- /// The unique Id of the ProductType.
- /// The name of the ProductType. Will default to empty if not provided.
- public ProductType(ushort id, string? name = null)
- {
- Id = id;
- Name = name ?? string.Empty;
- }
-
- ///
- /// Gets the value that uniquely identifies the .
- ///
- public ushort Id { get; }
-
- ///
- /// Gets the value that represents the name.
- ///
- public string Name { get; }
-
- ///
- /// Represents an Unknown with no id or name.
- ///
- public static ProductType Unknown => new(0);
-
- ///
- /// Gets the General Purpose Discrete I/O ProductType instance (id=7).
- ///
- public static ProductType Discrete => new(7, "General Purpose Discrete I/O");
-
- ///
- /// Gets the General Purpose Analog I/O ProductType instance (id=10).
- ///
- public static ProductType Analog => new(10, "General Purpose Analog I/O");
-
- ///
- /// Gets the General Purpose Discrete ProductType instance (id=14).
- ///
- public static ProductType Controller => new(14, "Programmable Logic Controller");
-
- ///
- /// Gets the General Purpose Discrete ProductType instance (id=12).
- ///
- public static ProductType Communications => new(12, "Communications Adapter");
-
- ///
- /// Converts a object to a that represents the Id.
- ///
- /// The object to convert.
- /// A representing the value of the ProductType Id.
- public static implicit operator ushort(ProductType productType) => productType.Id;
-
- ///
- /// Converts a value to a object that represents the Id.
- ///
- /// The value to convert.
- /// A with the Id of the converted value.
- public static implicit operator ProductType(ushort productTypeId) => new(productTypeId);
-
- ///
- /// Creates a new using the provided product Id.
- ///
- /// The unique valid that identifies the Product.
- /// A new object with the provided Id.
- public static ProductType Parse(string productId) =>
- ushort.TryParse(productId, out var id) ? new ProductType(id) : Unknown;
-
- ///
- public override string ToString() => Name;
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- ProductType other => Id.Equals(other.Id),
- ValueType other => Id.Equals(other),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => Id.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(ProductType? left, ProductType? right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(ProductType? left, ProductType? right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Revision.cs b/src/L5Sharp/Common/Revision.cs
deleted file mode 100644
index 4fceda57..00000000
--- a/src/L5Sharp/Common/Revision.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using System;
-using System.Globalization;
-using System.Text.RegularExpressions;
-
-namespace L5Sharp.Core;
-
-///
-/// Represents a revision number that is expressed by as {Major}.{Minor}.
-///
-public sealed class Revision : IComparable
-{
- private const string RevisionSeparator = ".";
- private readonly string _value;
-
- ///
- /// Creates a new default with value 1.0.
- ///
- public Revision()
- {
- _value = "1.0";
- }
-
- ///
- ///
- ///
- ///
- public Revision(string value)
- {
- if (string.IsNullOrEmpty(value))
- throw new ArgumentException("Revision value can not be null or empty.");
-
- if (!Regex.IsMatch(value, @"^[0-9]+\.[0-9]+$"))
- throw new FormatException(
- $"Value '{value}' is invalid revision format. Revision format must be Major.Minor.");
-
- _value = value;
- }
-
- ///
- /// Creates a new with the specified major and minor values.
- ///
- /// The value of the major revision.
- /// The value of the minor revision. Will default to 0 if not provided.
- public Revision(ushort major, ushort minor = 0)
- {
- _value = $"{major}.{minor}";
- }
-
- ///
- /// Creates a new with the specified value.
- ///
- /// The double value representing the revision number.
- public Revision(double value)
- {
- _value = value.ToString(CultureInfo.InvariantCulture);
- }
-
- ///
- /// The major revision of the value.
- ///
- public string Major => _value.Split(RevisionSeparator)[0];
-
- ///
- /// The minor revision of the value.
- ///
- public string Minor => _value.Split(RevisionSeparator)[1];
-
- ///
- public int CompareTo(object? obj)
- {
- return obj switch
- {
- null => 1,
- Revision other => string.Compare(_value, other._value, StringComparison.Ordinal),
- string value => string.Compare(_value, value, StringComparison.Ordinal),
- _ => throw new ArgumentException($"Can not compare {obj.GetType()} with Revision value.")
- };
- }
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- Revision other => string.Equals(_value, other._value, StringComparison.Ordinal),
- string value => string.Equals(_value, value, StringComparison.Ordinal),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => _value.GetHashCode();
-
- ///
- public override string ToString() => _value;
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(Revision left, Revision right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(Revision left, Revision right) => !Equals(left, right);
-
- ///
- /// Compares two objects and determines if left is greater than right.
- ///
- /// A to compare.
- /// A to compare.
- /// true if left is greater than right, otherwise, false.
- public static bool operator >(Revision left, Revision right) => left.CompareTo(right) > 0;
-
- ///
- /// Compares two objects and determines if left is less than right.
- ///
- /// A to compare.
- /// A to compare.
- /// true if left is less than right, otherwise, false.
- public static bool operator <(Revision left, Revision right) => left.CompareTo(right) < 0;
-
- ///
- /// Compares two objects and determines if left is greater than or equal to right.
- ///
- /// A to compare.
- /// A to compare.
- /// true if left is greater than or equal to right, otherwise, false.
- public static bool operator >=(Revision left, Revision right) => left.CompareTo(right) >= 0;
-
- ///
- /// Compares two objects and determines if left is less than or equal to right.
- ///
- /// A to compare.
- /// A to compare.
- /// true if left is less or equal to than right, otherwise, false.
- public static bool operator <=(Revision left, Revision right) => left.CompareTo(right) <= 0;
-
- ///
- /// Converts a to a .
- ///
- /// The revision value to convert.
- /// A new value representing a major and minor revision.
- public static implicit operator string(Revision revision) => revision.ToString();
-
- ///
- /// Converts a to a .
- ///
- /// The revision value to convert.
- /// A new value representing a major and minor revision.
- public static implicit operator Revision(string revision) => new(revision);
-
- ///
- /// Converts a to a .
- ///
- /// The revision value to convert.
- /// A new value representing a major and minor revision.
- public static implicit operator Revision(double revision) => new(revision);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/ScanRate.cs b/src/L5Sharp/Common/ScanRate.cs
deleted file mode 100644
index 9522dc4c..00000000
--- a/src/L5Sharp/Common/ScanRate.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace L5Sharp.Core;
-
-///
-/// A configurable property of a that controls the rate at which the task will be evaluated or scanned.
-///
-///
-/// is a simple float value that must be between 0.1 and 2,000,000.0ms.
-/// Attempting to set the to a value outside that range will result in an
-/// .
-/// This parameter will control the rate at which the component is scanned.
-///
-public readonly struct ScanRate : IEquatable
-{
- private readonly float _rate;
-
- ///
- /// Creates a new instance of with the specified rate value.
- ///
- /// The scan rate value in milliseconds. Valid range is between 0.1 and 2M
- /// Throw when the provided rate is outside the specified range
- public ScanRate(float rate)
- {
- if (rate is < 0.1f or > 2000000.0f)
- throw new ArgumentOutOfRangeException(nameof(rate),
- "Rate must be value between 0.1 and 2,000,000.0 ms");
-
- _rate = rate;
- }
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator float(ScanRate rate) => rate._rate;
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator ScanRate(float rate) => new(rate);
-
- ///
- /// Parses a string value into a .
- ///
- /// The string to parse.
- /// A value if the parse was successful; otherwise; the default value.
- public static ScanRate Parse(string str) =>
- float.TryParse(str, out var result) ? new ScanRate(result) : default;
-
- ///
- public override string ToString() => _rate.ToString(CultureInfo.CurrentCulture);
-
- ///
- public bool Equals(ScanRate other) => _rate.Equals(other._rate);
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- ScanRate other => _rate.Equals(other._rate),
- ValueType value => _rate.Equals(value),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => _rate.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(ScanRate left, ScanRate right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(ScanRate left, ScanRate right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/TagMap.cs b/src/L5Sharp/Common/TagMap.cs
deleted file mode 100644
index db52c29e..00000000
--- a/src/L5Sharp/Common/TagMap.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace L5Sharp.Core;
-
-public class TagMap : IEnumerable>
-{
- private readonly List> _map = new();
-
- ///
- /// Represents a mapping class for tags.
- ///
- public TagMap()
- {
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public void Map(TagName from, TagName to)
- {
- if (from is null) throw new ArgumentNullException(nameof(from));
- if (to is null) throw new ArgumentNullException(nameof(to));
- if (from.IsEmpty) throw new ArgumentException("Can not create mapping for empty tag.");
- if (to.IsEmpty) throw new ArgumentException("Can not create mapping for empty tag.");
- _map.Add(new KeyValuePair(from, to));
- }
-
- ///
- public IEnumerator> GetEnumerator() => _map.GetEnumerator();
-
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/TagName.cs b/src/L5Sharp/Common/TagName.cs
deleted file mode 100644
index 5a01be04..00000000
--- a/src/L5Sharp/Common/TagName.cs
+++ /dev/null
@@ -1,465 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace L5Sharp.Core;
-
-///
-/// A string wrapper representing a Logix TagName.
-///
-///
-/// This value type class make working with string tag name easier by providing
-/// methods fo analyzing and breaking the tag name into constituent parts (members).
-///
-public sealed class TagName : IComparable, IEquatable
-{
- private readonly string _tagName;
-
- private const char MemberSeparator = '.';
- private const char ArrayOpenSeparator = '[';
- private const char ArrayCloseSeparator = ']';
-
- ///
- /// A regex pattern for a Logix tag name with starting and ending anchors.
- /// Use this pattern to match a string and ensure it is only a tag name an nothing else.
- ///
- public const string AnchorPattern =
- @"^[A-Za-z_][\w+:]{1,39}(?:(?:\[\d+\]|\[\d+,\d+\]|\[\d+,\d+,\d+\])?(?:\.[A-Za-z_]\w{1,39})?)+(?:\.[0-9][0-9]?)?$";
-
- ///
- /// The regex pattern for Logix tag names without starting and ending anchors.
- /// This pattern also includes a negative lookahead for removing text prior to parenthesis (i.e. instruction keys)
- /// Use this pattern for tag names within text, such as longer
- ///
- public const string SearchPattern =
- @"(?!\w*\()[A-Za-z_][\w+:]{1,39}(?:(?:\[\d+\]|\[\d+,\d+\]|\[\d+,\d+,\d+\])?(?:\.[A-Za-z_]\w{1,39})?)+(?:\.[0-9][0-9]?)?";
-
- ///
- /// Creates a new object with the provided string tag name.
- ///
- /// The string that represents the tag name value.
- /// tagName is null.
- public TagName(string tagName)
- {
- _tagName = tagName ?? throw new ArgumentNullException(nameof(tagName));
- }
-
- ///
- /// Gets the root portion of the string.
- ///
- ///
- ///
- /// The root portion of a given tag name is simply the beginning part of the tag name up to the first
- /// member separator character '.' or '['. For Module defined tags, this includes the colon separator.
- ///
- ///
- /// This value can be swapped out easily using to return a new with the
- /// newly specified root tag name value.
- ///
- ///
- ///
- ///
- public string Root => GetRoot(_tagName);
-
- ///
- /// Gets the operand portion of the value.
- ///
- ///
- /// The Operand of a tag name represents the part of the name after . This value will always be
- /// the full tag name value without the leading root name. The operand will include the leading '.' character.
- ///
- ///
- public string Operand => !Root.IsEmpty() ? _tagName.Remove(0, Root.Length) : string.Empty;
-
- ///
- /// Gets the member path of the tag name value.
- ///
- ///
- /// The Path of a tag name represents a name relative to . The value will always be the full tag name
- /// without the leading root name. This is similar to , except that is also removes any
- /// leading member separator character ('.').
- ///
- ///
- public string Path => Operand.StartsWith(".") ? Operand.Remove(0, 1) : Operand;
-
- ///
- /// Gets the member name, or the last member of , of the tag name value.
- ///
- ///
- /// The Member of a tag name represents the last member name of the string. This is the string after the final
- /// member separator character.
- ///
- public string Member => GetMember(_tagName);
-
- ///
- /// Returns a collection of string names representing each individual member of the full tag name value.
- ///
- ///
- /// Each member of a tag name can be represented by a string, array bracket, or bit index value.
- /// For example, MyTag[1].MemberName.5 has 4 members.
- ///
- //public IEnumerable Members => Regex.Matches(_tagName, MembersPattern).Select(m => m.Value);
- public IEnumerable Members => GetMembers(_tagName);
-
- ///
- /// A zero-based number representing the depth of the tag name value. In other words, the number of members
- /// between this tag name and the root.
- ///
- ///
- /// This value represents the number of members between the root tag and last member name (i.e. one less than
- /// the number of members in the tag name). This is helpful for filtering tag descendents. Note that array
- /// indices are also considered a member. For example, 'MyTag[1].Value' has a depth of 2 since '[1]' and 'Value'
- /// are descendent member names of the root tag 'MyTag' member.
- ///
- public int Depth => GetDepth(_tagName);
-
- ///
- /// Gets a value indicating whether the current value is empty.
- ///
- public bool IsEmpty => _tagName.IsEmpty();
-
- ///
- /// Gets a value indicating whether the current is a valid representation of a tag name.
- ///
- public bool IsQualified => IsQualifiedTagName(_tagName);
-
- ///
- /// Determines if the provided string value is a valid tag name.
- ///
- /// The to test.
- /// true if the value is a valid qualified tag name; Otherwise, false.
- public static bool IsTag(string value) => IsQualifiedTagName(value);
-
- ///
- /// Gets the static empty value.
- ///
- public static TagName Empty => new(string.Empty);
-
- ///
- /// Concatenates two strings to produce a new value. This method will also insert the '.'
- /// member separator character if not found at the beginning of right.
- ///
- /// The first or left side of the tag name to concatenate.
- /// The second or right side of the tag name to concatenate.
- /// A representing the combination of left and right.
- ///
- /// This method would be more performant than , assuming there are just
- /// two strings to join together, as it does not iterate a collection and build a string with a string builder
- /// class. This method simply joins to strings using a string format syntax.
- ///
- public static TagName Concat(string left, string right)
- {
- if (string.IsNullOrEmpty(right)) return left;
-
- if (right[0] == ArrayOpenSeparator || right[0] == MemberSeparator)
- return new TagName($"{left}{right}");
-
- return new TagName($"{left}{MemberSeparator}{right}");
- }
-
- ///
- /// Combines a series of strings into a single value, inserting member separator
- /// characters as needed.
- ///
- /// The series of strings that, in order, comprise the full tag name value.
- /// A new value that represents the combination of all provided member names.
- /// If any provided member does not match the member pattern format.
- public static TagName Combine(params string[] members) => new(ConcatenateMembers(members.AsEnumerable()));
-
- ///
- /// Combines a collection of member names into a single value.
- ///
- /// The collection of strings that represent the member names of the tag name value.
- /// A new A new value that is the combination of all provided member names.
- /// If a provided name does not match the member pattern format.
- public static TagName Combine(IEnumerable members) => new(ConcatenateMembers(members));
-
- ///
- /// Converts a to a value.
- ///
- /// The value to convert.
- /// A new value representing the value of the tag name.
- public static implicit operator string(TagName tagName) => tagName is not null
- ? tagName._tagName
- : throw new ArgumentNullException(nameof(tagName));
-
- ///
- /// Converts a to a value.
- ///
- /// The value to convert.
- /// A new value representing the value of the tag name.
- public static implicit operator TagName(string tagName) => new(tagName);
-
- ///
- public int CompareTo(TagName? other)
- {
- return ReferenceEquals(this, other) ? 0
- : ReferenceEquals(null, other) ? 1
- : StringComparer.OrdinalIgnoreCase.Compare(_tagName, other._tagName);
- }
-
- ///
- /// Determines if the provided tagName is contained within the current value.
- ///
- /// The tag name to evaluate as a sub path or contained tag name path.
- /// true if tagName is contained within the current value; otherwise, false.
- /// tagName is null.
- public bool Contains(TagName tagName)
- {
- if (tagName is null)
- throw new ArgumentNullException(nameof(tagName));
-
- return _tagName.Contains(tagName);
- }
-
- ///
- /// Determines whether the specified objects are equal using the specified .
- ///
- /// A tag name object to compare.
- /// A tag name object to compare.
- /// The equality comparer to use for comparison.
- /// true if the tag name are equal according too the provided comparer; otherwise, false.
- /// Use the prebuilt class for several predefined comparer objects.
- public static bool Equals(TagName first, TagName second, IEqualityComparer comparer) =>
- comparer.Equals(first, second);
-
- ///
- public bool Equals(TagName? other)
- {
- if (ReferenceEquals(null, other)) return false;
- return ReferenceEquals(this, other) || StringComparer.OrdinalIgnoreCase.Equals(_tagName, other._tagName);
- }
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- TagName other => StringComparer.OrdinalIgnoreCase.Equals(_tagName, other._tagName),
- string other => StringComparer.OrdinalIgnoreCase.Equals(_tagName, other),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(_tagName);
-
- ///
- /// Returns a new tag name with the root value replaced with the provided string tag.
- ///
- /// The new root tag name value to replace.
- /// A new with the new root tag value.
- /// Note that this doesn't change the current tag name value, rather, returns a new object with the changed
- /// value. This ensures the immutability of .
- public TagName Rename(string tag) => Combine(tag, Operand);
-
- ///
- public override string ToString() => _tagName;
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(TagName? left, TagName? right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(TagName? left, TagName? right) => !Equals(left, right);
-
- ///
- /// Gets the first member of the tag name, or the portion of the string up to the first/next member separator.
- /// We are no longer using regex to make this as efficient as possible since there could realistically be millions
- /// of tag names this can get called on.
- ///
- private static string GetRoot(string tagName)
- {
- if (tagName.IsEmpty() || tagName.StartsWith(MemberSeparator)) return string.Empty;
- if (tagName.StartsWith(ArrayOpenSeparator))
- {
- return tagName[..tagName.IndexOf(ArrayCloseSeparator)];
- }
-
- var index = tagName.IndexOfAny(new[] {MemberSeparator, ArrayOpenSeparator});
- return index > 0 ? tagName[..index] : tagName;
- }
-
- ///
- /// Gets the last member of the tag name, or the portion of the string from the end to the last member separator.
- /// We are no longer using regex to make this as efficient as possible since there could realistically be millions
- /// of tag names this can get called on.
- ///
- private static string GetMember(string tagName)
- {
- var index = tagName.LastIndexOfAny(new[] {MemberSeparator, ArrayOpenSeparator});
- var length = tagName.Length - index;
- return index >= 0 ? tagName.Substring(index, length).TrimStart(MemberSeparator) : tagName;
- }
-
- ///
- /// Gets each member by iterating the tag name string.
- /// We are no longer using regex to make this as efficient as possible since there could realistically be millions
- /// of tag names this can get called on.
- ///
- private static IEnumerable GetMembers(string tagName) =>
- NormalizeDelimiter(tagName).Split(MemberSeparator, StringSplitOptions.RemoveEmptyEntries);
-
- ///
- /// Gets the zero-based depth or number of members between this member and the root.
- /// We are no longer using regex to make this as efficient as possible since there could realistically be millions
- /// of tag names this can get called on.
- ///
- private static int GetDepth(string tagName) => tagName.Count(c => c is MemberSeparator or ArrayOpenSeparator);
-
- ///
- /// Handles combining an enumerable containing string member names into a single value.
- ///
- private static string ConcatenateMembers(IEnumerable members)
- {
- var builder = new StringBuilder();
-
- foreach (var member in members)
- {
- if (!(member.StartsWith(ArrayOpenSeparator) || member.StartsWith(MemberSeparator)) && builder.Length > 1)
- builder.Append(MemberSeparator);
-
- builder.Append(member);
- }
-
- return builder.ToString();
- }
-
- private static bool IsQualifiedTagName(string value)
- {
- if (value.IsEmpty()) return false;
-
- var normalized = NormalizeDelimiter(value);
- var members = normalized.Split(MemberSeparator).ToList();
-
- for (var i = 0; i < members.Count; i++)
- {
- switch (i)
- {
- case 0 when !IsValidRoot(members[i]):
- case > 0 when members[i].StartsWith(ArrayOpenSeparator) && !IsValidIndex(members[i]):
- case > 0 when char.IsLetter(members[i][0]) && !IsValidMember(members[i]):
- return false;
- }
-
- if (i == members.Count - 1 && char.IsDigit(members[i][0]) && !IsValidBit(members[i])) return false;
- }
-
- return true;
-
- bool IsValidRoot(string member) => Regex.IsMatch(member, @"^[A-Za-a_][\w:]{0,39}$");
-
- bool IsValidMember(string member) => Regex.IsMatch(member, @"^[A-Za-a_][\w]{0,39}$");
-
- bool IsValidIndex(string member) => Regex.IsMatch(member, @"^\[[0-9]+(?:\,[0-9]+)?(?:\,[0-9]+)?\]$");
-
- bool IsValidBit(string member) =>
- member.All(char.IsDigit) && int.TryParse(member, out var bit) && bit is >= 0 and <= 63;
- }
-
- private static string NormalizeDelimiter(string value)
- {
- var builder = new StringBuilder();
-
- foreach (var character in value)
- {
- if (character == ArrayOpenSeparator)
- builder.Append(MemberSeparator);
- builder.Append(character);
- }
-
- return builder.ToString();
- }
-}
-
-///
-/// A for the object.
-///
-public class TagNameComparer : IEqualityComparer
-{
- private TagNameComparer()
- {
- }
-
- ///
- /// An that compares the full qualified value.
- ///
- public static TagNameComparer Qualified { get; } = new();
-
- ///
- /// An that compares the property of the
- /// value.
- ///
- public static TagNameComparer Root { get; } = new RootTagNameComparer();
-
- ///
- /// An that compares the property of the
- /// value.
- ///
- public static TagNameComparer Path { get; } = new PathTagNameComparer();
-
- ///
- /// An that compares the property of the
- /// value.
- ///
- public static TagNameComparer Member { get; } = new MemberTagNameComparer();
-
- ///
- public virtual bool Equals(TagName? x, TagName? y)
- {
- if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
- return string.Equals(x.ToString(), y.ToString(), StringComparison.OrdinalIgnoreCase);
- }
-
- ///
- public virtual int GetHashCode(TagName obj) => obj.GetHashCode();
-
-
- private class RootTagNameComparer : TagNameComparer
- {
- public override bool Equals(TagName? x, TagName? y)
- {
- if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
- return string.Equals(x.Root, y.Root, StringComparison.OrdinalIgnoreCase);
- }
-
- public override int GetHashCode(TagName obj) => StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Root);
- }
-
- private class PathTagNameComparer : TagNameComparer
- {
- public override bool Equals(TagName? x, TagName? y)
- {
- if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
- return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase);
- }
-
- public override int GetHashCode(TagName obj) => StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Path);
- }
-
- private class MemberTagNameComparer : TagNameComparer
- {
- public override bool Equals(TagName? x, TagName? y)
- {
- if (ReferenceEquals(x, y)) return true;
- if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) return false;
- return string.Equals(x.Member, y.Member, StringComparison.OrdinalIgnoreCase);
- }
-
- public override int GetHashCode(TagName obj) => StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Member);
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/TaskPriority.cs b/src/L5Sharp/Common/TaskPriority.cs
deleted file mode 100644
index 8a904cc1..00000000
--- a/src/L5Sharp/Common/TaskPriority.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-
-namespace L5Sharp.Core;
-
-///
-/// A configurable property of a that controls the order in which the Logix Controller
-/// will scan the given Task.
-///
-///
-/// is a simple byte value that must be between 1 and 15.
-/// Attempting to set the to a value outside that range will result in an
-/// .
-/// This parameter will control the scan order of task components as related to other tasks.
-///
-public readonly struct TaskPriority : IEquatable
-{
- private readonly byte _priority;
-
- ///
- /// Creates a new instance of with the provided value.
- ///
- /// The value of the priority. Must be a value between 1 and 15.
- /// priority is less than 1 -or- greater than 15.
- public TaskPriority(byte priority)
- {
- if (priority is < 1 or > 15)
- throw new ArgumentOutOfRangeException(nameof(priority), "Priority must be value between 1 and 15");
-
- _priority = priority;
- }
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator byte(TaskPriority priority) => priority._priority;
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator TaskPriority(byte priority) => new(priority);
-
- ///
- /// Parses a string value into a .
- ///
- /// The string to parse.
- /// A value if the parse was successful; otherwise; the default value.
- public static TaskPriority Parse(string str) =>
- byte.TryParse(str, out var result) ? new TaskPriority(result) : default;
-
- ///
- public bool Equals(TaskPriority other) => _priority == other._priority;
-
- ///
- public override string ToString() => _priority.ToString();
-
- ///
- public override bool Equals(object? obj) => obj is TaskPriority other && Equals(other);
-
- ///
- public override int GetHashCode() => _priority.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(TaskPriority left, TaskPriority right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(TaskPriority left, TaskPriority right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Vendor.cs b/src/L5Sharp/Common/Vendor.cs
deleted file mode 100644
index 80e55bc8..00000000
--- a/src/L5Sharp/Common/Vendor.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using System;
-
-namespace L5Sharp.Core;
-
-///
-/// An entity that represents the vendor of a given .
-///
-///
-/// This object is a simple entity type wrapper that groups the vendor id and name.
-/// Vendor's are defined by Rockwell and assigned unique Id and name.
-/// Use as it is the most common vendor for compatible devices.
-///
-public class Vendor
-{
- ///
- /// Creates a new value with the provided id and name.
- ///
- /// The unique Id of the Vendor.
- /// The name of the Vendor. Will default to empty if not provided.
- public Vendor(ushort id, string? name = null)
- {
- Id = id;
- Name = name ?? string.Empty;
- }
-
- ///
- /// Gets the value that uniquely identifies the .
- ///
- ///
- /// This value is exported in the L5X and is used for Vendor name lookups.
- ///
- public ushort Id { get; }
-
- ///
- /// Gets the value that represents the name.
- ///
- public string Name { get; }
-
- ///
- /// Represents an Unknown with no id or name.
- ///
- public static Vendor Unknown => new(0);
-
- ///
- /// Gets the Rockwell Automation Vendor instance (id=1).
- ///
- public static Vendor Rockwell => new(1, "Rockwell Automation/Allen-Bradley");
-
- ///
- /// Converts a object to a that represents the Id.
- ///
- /// The object to convert.
- /// A representing the value of the Vendor Id.
- public static implicit operator ushort(Vendor vendor) => vendor.Id;
-
- ///
- /// Converts a value to a object that represents the Id.
- ///
- /// The value to convert.
- /// A with the Id of the converted value.
- public static implicit operator Vendor(ushort vendorId) => new(vendorId);
-
- ///
- /// Creates a new using the provided vendor Id.
- ///
- /// The unique valid that identifies the Vendor.
- /// A new object with the provided Id.
- public static Vendor Parse(string vendorId) => ushort.TryParse(vendorId, out var id) ? new Vendor(id) : Unknown;
-
- ///
- public override string ToString() => Name;
-
- ///
- public override bool Equals(object? obj)
- {
- return obj switch
- {
- Vendor other => Id.Equals(other.Id),
- int other => ((int)Id).Equals(other),
- ushort other => Id.Equals(other),
- ValueType other => Id.Equals(other),
- _ => false
- };
- }
-
- ///
- public override int GetHashCode() => Id.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(Vendor? left, Vendor? right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(Vendor? left, Vendor? right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Common/Watchdog.cs b/src/L5Sharp/Common/Watchdog.cs
deleted file mode 100644
index 0a602ab3..00000000
--- a/src/L5Sharp/Common/Watchdog.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace L5Sharp.Core;
-
-///
-/// A configurable property of a that specified how long a task can rung before triggering a major fault.
-///
-///
-/// is a simple float value that must be between 0.1 and 2,000,000.0 ms.
-/// Attempting to set the to a value outside that range will result in an
-/// .
-/// This parameter will control how long a task can rung before triggering a major fault.
-///
-public readonly struct Watchdog : IEquatable
-{
- private readonly float _watchdog;
-
- ///
- /// Creates a new instance of Watchdog with the specified value.
- ///
- /// The value of the watchdog in milliseconds.
- /// Must be a value between 0.1 and 2M.
- /// Throw when the provided value is not within the
- /// specified range.
- public Watchdog(float watchdog)
- {
- if (watchdog is < 0.1f or > 2000000.0f)
- throw new ArgumentOutOfRangeException(nameof(watchdog),
- "Watchdog must be value between 0.1 and 2,000,000.0 ms");
-
- _watchdog = watchdog;
- }
-
- ///
- ///
- ///
- /// A new Watchdog value.
- public static Watchdog Default() => new(500);
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator float(Watchdog watchdog) => watchdog._watchdog;
-
- ///
- /// Converts a to a .
- ///
- /// The value to convert.
- /// A value.
- public static implicit operator Watchdog(float watchdog) => new(watchdog);
-
- ///
- /// Parses a string value into a .
- ///
- /// The string to parse.
- /// A value if the parse was successful; otherwise; the default value.
- public static Watchdog Parse(string str) =>
- float.TryParse(str, out var result) ? new Watchdog(result) : default;
-
- ///
- public override string ToString() => _watchdog.ToString(CultureInfo.CurrentCulture);
-
- ///
- public bool Equals(Watchdog other) => _watchdog.Equals(other._watchdog);
-
- ///
- public override bool Equals(object? obj) => obj is Watchdog other && Equals(other);
-
- ///
- public override int GetHashCode() => _watchdog.GetHashCode();
-
- ///
- /// Determines if the provided objects are equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are equal; otherwise, false.
- public static bool operator ==(Watchdog left, Watchdog right) => Equals(left, right);
-
- ///
- /// Determines if the provided objects are not equal.
- ///
- /// An object to compare.
- /// An object to compare.
- /// true if the provided objects are not equal; otherwise, false.
- public static bool operator !=(Watchdog left, Watchdog right) => !Equals(left, right);
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/AddOnInstruction.cs b/src/L5Sharp/Components/AddOnInstruction.cs
deleted file mode 100644
index 7768b1bc..00000000
--- a/src/L5Sharp/Components/AddOnInstruction.cs
+++ /dev/null
@@ -1,269 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix AddOnInstruction component. Contains the properties that comprise the L5X
-/// AddOnInstructionDefinition element.
-///
-///
-[L5XType(L5XName.AddOnInstructionDefinition)]
-public class AddOnInstruction : LogixComponent
-{
- ///
- /// Creates a new with default values.
- ///
- public AddOnInstruction() : base(new XElement(L5XName.AddOnInstructionDefinition))
- {
- Revision = new Revision();
- ExecutePreScan = false;
- ExecutePostScan = false;
- ExecuteEnableInFalse = false;
- CreatedDate = DateTime.Now;
- CreatedBy = Environment.UserName;
- EditedDate = DateTime.Now;
- EditedBy = Environment.UserName;
- IsEncrypted = false;
- Parameters = new LogixContainer();
- LocalTags = new LogixContainer(L5XName.LocalTags, L5XName.LocalTag);
- Routines = new LogixContainer();
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public AddOnInstruction(XElement element) : base(element)
- {
- }
-
- ///
- /// The revision of the instruction.
- ///
- /// A representing the version of the instruction.
- ///
- /// Specify the revision of the Add-On Instruction, in the form of MajorRevision.MinorRevision.
- /// Each revision number can be 1...65,535.
- /// If there is no period, the number is treated as a major revision only
- ///
- public Revision? Revision
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Additional text indicating or identifying the revision of the instruction.
- ///
- /// A containing text of the revision extension.
- public string? RevisionExtension
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Additional text describing release information or changes with the current revision(s).
- ///
- /// A containing the text of the revision note.
- public string? RevisionNote
- {
- get => GetProperty();
- set => SetProperty(value);
- }
-
- ///
- /// The vendor or creator of the instruction.
- ///
- /// A value representing the name of the vendor.
- public string? Vendor
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates that the instruction has and executes a pre scan routine.
- ///
- /// true if the instruction executes a pre scan routine; otherwise, false.
- public bool ExecutePreScan
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates that the instruction has and executes a post scan routine.
- ///
- /// true if the instruction executes a post scan routine; otherwise, false.
- public bool ExecutePostScan
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates that the instruction has and executes a enable in false routine.
- ///
- /// A - true if the instruction executes a enable in false routine; otherwise, false.
- public bool ExecuteEnableInFalse
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The date and time that the instruction was created.
- ///
- /// A representing the creation date and time.
- public DateTime? CreatedDate
- {
- get => GetDateTime();
- set => SetDateTime(value);
- }
-
- ///
- /// The name of the user that created the instruction.
- ///
- /// A representing the name of the user.
- public string? CreatedBy
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The date and time that the instruction was last edited.
- ///
- /// A representing the edit date and time.
- public DateTime? EditedDate
- {
- get => GetDateTime();
- set => SetDateTime(value);
- }
-
- ///
- /// The name of the user that last edited the instruction.
- ///
- /// A representing the name of the user.
- public string? EditedBy
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the revision of the application last used to edit the Add-On Instruction.
- /// The default is the currently open version of the application.
- ///
- /// A representing the version of the instruction.
- public Revision? SoftwareRevision
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The help text specific to the Add-On Instruction.
- ///
- /// A containing the help text.
- public string? AdditionalHelpText
- {
- get => GetProperty();
- set => SetProperty(value);
- }
-
- ///
- /// Indicates whether the Add-On Instruction is protected with license-based Source Protection and locked
- ///
- /// true if the instruction is encrypted; otherwise, false.
- public bool IsEncrypted
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The collection of that make up the structure of the instruction component.
- ///
- public LogixContainer Parameters
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- /// The collection of local objects used within the AoiBlock logic.
- ///
- public LogixContainer LocalTags
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- /// The collection of local objects that contain the logic for the instruction.
- ///
- public LogixContainer Routines
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- #region Extensions
-
- ///
- /// Returns the AoiBlock instruction logic with the parameters tag names replaced with the argument tag names of the
- /// provided instruction instance.
- ///
- /// The instruction instance for which to generate the underlying logic.
- ///
- /// A containing representing all the instruction's
- /// logic, with each instruction parameter tag name replaced with the arguments from the provided text.
- ///
- ///
- /// This is helpful when trying to perform deep analysis on logic. By "flattening" the logic we can
- /// reason or evaluate it as if it was written in line. Currently only supports
- /// content or code type.
- ///
- public IEnumerable LogicFor(Instruction instruction)
- {
- if (instruction is null)
- throw new ArgumentNullException(nameof(instruction));
-
- // All instructions primary logic is contained in the routine named 'Logic'
- var logic = Routines.FirstOrDefault(r => r.Name == "Logic");
-
- var rungs = logic?.Content();
- if (rungs is null) return Enumerable.Empty();
-
- //Skip first operand as it is always the AoiBlock tag, which does not have corresponding parameter within the logic.
- var arguments = instruction.Arguments.Select(a => a.ToString()).Skip(1).ToList();
-
- //Only required parameters are part of the instruction signature
- var parameters = Parameters.Where(p => p.Required is true).Select(p => p.Name).ToList();
-
- //Generate a mapping of the provided instructions arguments to instruction parameters.
- var mapping = arguments.Zip(parameters, (a, p) => new {Argument = a, Parameter = p}).ToList();
-
- //Replace all parameter names with argument names in the instruction logic text, and return the results.
- return rungs.Select(r => r.Text)
- .Select(t => mapping.Aggregate(t, (current, pair) =>
- {
- if (!pair.Argument.IsTag()) return current;
- var replace = $@"(?<=[^.]){pair.Parameter}\b";
- return Regex.Replace(current, replace, pair.Argument.ToString());
- }))
- .ToList();
- }
-
- #endregion
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Controller.cs b/src/L5Sharp/Components/Controller.cs
deleted file mode 100644
index 86d51b24..00000000
--- a/src/L5Sharp/Components/Controller.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-using System;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Controller component. Contains the properties that comprise the L5X Controller element.
-///
-///
-/// A controller component may or may not contains various properties depending on if the exported L5X file
-/// was a full project file or just a component export file. This is indicated in the by the property
-/// ContainsContext, which if true, means the controller element exists simply to contain other components that
-/// are needed by the TargetName for successful re-imports of the content, and therefore will typically only have
-/// a name, revision, and processor type.
-///
-/// Observe these guidelines when defining a controller:
-/// • All declarations must be ordered in the prescribed syntax.
-/// • The maximum number of tasks vary by the controller type.
-/// • There can be only one continuous task.
-/// • Programs can be scheduled under only one task.
-/// • There can be a maximum of 1000 programs under a task.
-/// • Scheduled programs must be defined.
-///
-///
-///
-public class Controller : LogixComponent
-{
- private const string DateTimeFormat = "ddd MMM d HH:mm:ss yyyy";
-
- ///
- /// Creates a new with default values.
- ///
- public Controller() : base(new XElement(L5XName.Controller))
- {
- Use = Use.Context;
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Controller(XElement element) : base(element)
- {
- }
-
- ///
- /// The catalog number representing the processor of the controller component.
- ///
- /// A representing the alpha numeric catalog number.
- public string? ProcessorType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Percentage of available CPU time (10...90) that is assigned to communication.
- ///
- public string? TimeSlice
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify whether to share an unused or not.
- ///
- public bool? ShareUnusedTimeSlice
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Name of the program to be executed upon restart after a power loss.
- ///
- /// A representing the name of the program.
- public string? PowerLossProgram
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Name of the program to be executed when a major fault occurs.
- ///
- /// A representing the name of the program.
- public string? MajorFaultProgram
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the devices in the communication path. The communication path ends with the
- /// controller (\Backplane\1). This is exported only if you select manual configuration of the
- /// communication path in RSLinx® software.
- ///
- public string? CommPath
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of communication driver. This is the name of the selected driver in
- /// RSLinx® software. This is exported only if you select manual configuration of the
- /// communication driver in RSLinx® software.
- ///
- public string? CommDriver
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The revision or hardware version of the controller.
- ///
- /// A value representing the major/minor version of the controller
- public Revision? Revision
- {
- get
- {
- var major = Element.Attribute(L5XName.MajorRev)?.Value;
- var minor = Element.Attribute(L5XName.MinorRev)?.Value;
- return major is not null && minor is not null ? new Revision($"{major}.{minor}") : default;
- }
- set
- {
- Element.SetAttributeValue(L5XName.MajorRev, value?.Major);
- Element.SetAttributeValue(L5XName.MinorRev, value?.Minor);
- }
- }
-
- ///
- /// The date/time the current project was created.
- ///
- /// A representing the date and time of creation.
- public DateTime ProjectCreationDate
- {
- get => GetDateTime(DateTimeFormat) ?? default;
- set => SetDateTime(value, DateTimeFormat);
- }
-
- ///
- /// The date/time the current project was last modified.
- ///
- /// A representing the date and time of modification.
- public DateTime LastModifiedDate
- {
- get => GetDateTime(DateTimeFormat) ?? default;
- set => SetDateTime(value, DateTimeFormat);
- }
-
- ///
- /// Specify whether the SFC executes the current active steps before returning control
- /// (CurrentActive) or whether the SFC executes all threads until reaching a false transition
- /// (UntilFalse).
- ///
- public SFCExecutionControl? SFCExecutionControl
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify whether the SFC restarts at the most recently executed step (MostRecent) or at the
- /// initial step (InitialStep).
- ///
- public SFCRestartPosition? SFCRestartPosition
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify how the SFC manages its state on a last scan. Select AutomaticReset,
- /// ProgrammaticReset, or DontScan.
- ///
- public SFCLastScan? SFCLastScan
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the serial number of the controller. If a serial number is specified, it is
- /// imported into the project regardless of the MatchProjectToController setting. Type a 32-bit,
- /// hexadecimal number with the 16# prefix, such as 16#0012_E2BC.
- ///
- // ReSharper disable once InconsistentNaming to match logix name.
- public string? ProjectSN
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify whether to be sure that the project matches the controller or not.
- ///
- public bool? MatchProjectToController
- {
- get => GetValue() is not null ? GetValue() == "Yes" : default;
- set => SetValue(value is true ? "Yes" : "No");
- }
-
- ///
- /// Specify whether to inhibit the automatic update of controller firmware.
- ///
- public bool? InhibitAutomaticFirmwareUpdate
- {
- get => GetValue() is not null ? GetValue() == 1 : default;
- set => SetValue(value is true ? 1 : 0);
- }
-
- ///
- /// Specify the current project language for a project documentation project.
- ///
- public string? CurrentProjectLanguage
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the default project language for a project document at on project.
- ///
- public string? DefaultProjectLanguage
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the controller project language for a project document at on project.
- ///
- public string? ControllerLanguage
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify whether the consumed tags in the controller can connect to the producer with an
- /// RPI provided by the producer (true or false)
- ///
- public bool? CanUseRPIFromProducer
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates the pass through state of documentation for the project.
- ///
- /// A representing the configured value.
- public PassThroughOption? PassThroughConfiguration
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates the download project documentation configuration setting of the project.
- ///
- public bool? DownloadProjectDocumentationAndExtendedProperties
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates the download custom properties configuration setting of the project.
- /// Only applies if the project is already configured to DownloadProjectDocumentation
- ///
- ///
- /// Rockwell Automation® recommends setting this attribute to false only during startup
- /// testing to improve download speeds during commissioning testing. It should be set to true
- /// for the normal operating state of a system.
- ///
- public bool? DownloadCustomProperties
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The EtherNet/IP™ Mode describes the relationship between the CIP™ EtherNet/IP™ ports
- /// and the physical Ethernet ports. The CIP™ EtherNet/IP™ port can be configured as one of two modes:
- /// Dual-IP, Linear/DLR
- ///
- public string? EtherNetIPMode
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The object that specifies the redundancy configuration of the controller.
- ///
- public RedundancyInfo? RedundancyInfo
- {
- get => GetComplex();
- set => SetComplex(value);
- }
-
- ///
- /// The object that specifies the security configuration of the controller.
- ///
- public Security? Security
- {
- get => GetComplex();
- set => SetComplex(value);
- }
-
- ///
- /// The object that specifies the safety configuration of the controller.
- ///
- public SafetyInfo? SafetyInfo
- {
- get => GetComplex();
- set => SetComplex(value);
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/DataType.cs b/src/L5Sharp/Components/DataType.cs
deleted file mode 100644
index a5db6112..00000000
--- a/src/L5Sharp/Components/DataType.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix DataType component. Contains the properties that comprise the L5X DataType element.
-///
-///
-/// Observe these guidelines when defining a DataType:
-/// • DataTypes must be defined first within the controller body.
-/// • DataTypes can be defined out of order. For example, if Type1 depends on Type2, Type2 can be defined first.
-/// • DataTypes can be unverified. For example if Type1 depends on Type2 and Type2 is never defined, then Type1
-/// will be accessible as an unverified type. Type2 will be typeless type. Tags of Type1 may be created but not of Type2.
-/// • Datatype members can be arrays but only one dimension is allowed.
-/// • These DataTypes cannot be used in a user-defined datatype:
-/// • ALARM_ANALOG
-/// • ALARM_DIGITAL
-/// • AXIS types
-/// • COORDINATE_SYSTEM
-/// • MOTION_GROUP
-/// • MESSAGE
-/// • MODULE
-/// • If one user-defined datatype references a second user-defined datatype defined in the file, the second
-/// user-defined datatype appears before the first one in the import/export file.
-///
-///
-public class DataType : LogixComponent
-{
- ///
- /// Creates a new with default values.
- ///
- public DataType()
- {
- Family = DataTypeFamily.None;
- Class = DataTypeClass.User;
- Members = new LogixContainer();
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public DataType(XElement element) : base(element)
- {
- }
-
- ///
- /// Creates a new initialized with the provided name.
- ///
- /// The name of the data type component.
- /// name is null.
- public DataType(string name) : this()
- {
- if (name is null) throw new ArgumentNullException(nameof(name));
- SetValue(L5XName.Name, name);
- }
-
- ///
- /// The family of the DataType component.
- ///
- ///
- /// A option indicating the family for which the current data type belongs.
- /// This is just string for string types and none for all others.
- ///
- public DataTypeFamily? Family
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The class of the DataType component.
- ///
- ///
- /// A option indicating the class for which the current data type belongs.
- /// L5X files will only ever contain class types.
- ///
- public DataTypeClass? Class
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The collection of that make up the structure of the DataType component.
- ///
- public LogixContainer Members
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- public override IEnumerable Dependencies()
- {
- if (L5X is null) return Enumerable.Empty();
-
- var dependencies = new List();
-
- foreach (var member in Members)
- {
- var dataType = L5X.Find(member.DataType);
- if (dataType is null) continue;
- dependencies.Add(dataType);
- dependencies.AddRange(dataType.Dependencies());
- }
-
- return dependencies.Distinct();
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Module.cs b/src/L5Sharp/Components/Module.cs
deleted file mode 100644
index b9095dae..00000000
--- a/src/L5Sharp/Components/Module.cs
+++ /dev/null
@@ -1,438 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Module component. Contains the properties that comprise the L5X Module element.
-///
-///
-public class Module : LogixComponent
-{
- ///
- public Module()
- {
- CatalogNumber = string.Empty;
- Vendor = Vendor.Unknown;
- ProductType = ProductType.Unknown;
- ProductCode = default;
- Revision = new Revision();
- ParentModule = string.Empty;
- ParentModPortId = default;
- Inhibited = default;
- MajorFault = default;
- SafetyEnabled = default;
- Keying = ElectronicKeying.CompatibleModule;
- Ports = new LogixContainer();
- Communications = new Communications();
- }
-
- ///
- public Module(XElement element) : base(element)
- {
- }
-
- ///
- ///
- /// Module components don't all have a name attribute (e.g. VFD peripheral modules). For this reason,
- /// the name property is overriden to not be a required field for this component type. If the name is not found,
- /// this property returns an empty string.
- ///
- public override string Name
- {
- get => GetValue() ?? string.Empty;
- set => SetValue(value);
- }
-
- ///
- /// Specify the catalog number that uniquely identifies the module. This is a rockwell defined convention,
- /// and represents the identity of the module type.
- ///
- /// A value containing the catalog number.
- public string? CatalogNumber
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The vendor or manufacturer of the module.
- ///
- /// A entity that contains the id and name of the vendor.
- ///
- /// All modules have a vendor representing the manufacturer of the module.
- ///
- public Vendor? Vendor
- {
- get => GetValue();
- set => SetValue(value?.Id);
- }
-
- ///
- /// The product type of the module, representing a category of the module.
- ///
- ///
- /// All modules have a product type representing the product category of the module.
- ///
- public ProductType? ProductType
- {
- get => GetValue();
- set => SetValue(value?.Id);
- }
-
- ///
- /// The unique product code value of the module.
- ///
- ///
- /// This is a unique value that identifies the module and is assigned by Logix.
- ///
- public ushort ProductCode
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The revision number or hardware version of the module.
- ///
- /// A object representing the major and minor version.
- ///
- /// All modules must have a specified revision number.
- ///
- public Revision? Revision
- {
- get
- {
- var major = Element.Attribute(L5XName.Major)?.Value;
- var minor = Element.Attribute(L5XName.Minor)?.Value;
- return major is not null && minor is not null ? new Revision($"{major}.{minor}") : default;
- }
- set
- {
- Element.SetAttributeValue(L5XName.Major, value?.Major);
- Element.SetAttributeValue(L5XName.Minor, value?.Minor);
- }
- }
-
- ///
- /// The name of the parent module, or module that the current module is connected to upstream.
- /// This specifies how the module is connected within the module tree.
- ///
- /// A representing the parent module name. Default is an empty string.
- public string? ParentModule
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The port id of the parent module that the current module is connected to.
- /// This specified how the module is connected within the module tree.
- ///
- /// A representing the id of the parent port. Default is zero.
- public int ParentModPortId
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// An indication of whether the module is inhibited or disabled.
- ///
- public bool Inhibited
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// An indication of whether the module the module will cause a major fault when faulted.
- ///
- public bool MajorFault
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// An indication of whether whether the module has safety features enabled.
- ///
- public bool SafetyEnabled
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The electronic keying mode of the module.
- ///
- /// A enum value representing the mode.
- public ElectronicKeying? Keying
- {
- get => Element.Element(L5XName.EKey)?.Attribute(L5XName.State)?.Value.Parse();
- set
- {
- if (value is null)
- {
- Element.Element(L5XName.EKey)?.Remove();
- return;
- }
-
- if (Element.Element(L5XName.EKey) is null)
- {
- Element.Add(new XElement(L5XName.EKey, new XAttribute(L5XName.State, value)));
- return;
- }
-
- Element.Element(L5XName.EKey)!.SetAttributeValue(L5XName.State, value);
- }
- }
-
- ///
- /// A collection of elements that define the module's connection within the module tree.
- ///
- /// A of objects.
- ///
- /// Ports define how a module's peripherals are connected to other module's, forming the network or tree of
- /// devices used to communicated with a controller and field equipment. Ports must have a unique id, a type,
- /// and address.
- ///
- public LogixContainer Ports
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- ///
- ///
- public Communications? Communications
- {
- get => GetComplex();
- set => SetComplex(value);
- }
-
- #region Extensions
-
- ///
- /// Gets the slot number of the current module if one exists. If the module does not have an slot, returns null.
- ///
- /// An representing the slot number of the module.
- ///
- /// This property is not directly part of the L5X structure, but is a helper to make accessing the slot number simple.
- /// This property looks for an upstream with a valid slot byte number.
- ///
- public byte? Slot => Ports.FirstOrDefault(p => p.Upstream && p.Address.IsSlot)?.Address.ToSlot();
-
- ///
- /// Gets the IP address of the current module if one exists. If the module does not have an IP, returns null.
- ///
- /// An representing the IP of the module.
- ///
- /// This property is not directly part of the L5X structure, but is a helper to make accessing the IP simple.
- /// This property looks for an Ethernet type with a valid IPv4 address.
- ///
- public IPAddress? IP =>
- Ports.FirstOrDefault(p => p is {Type: "Ethernet", Address.IsIPv4: true})?.Address.ToIPAddress();
-
- ///
- /// Gets the parent module of this module component defined in the current L5X document.
- ///
- /// A representing the parent of this module if it exists; otherwise, null.
- ///
- /// The L5X structure serializes modules in a flat list with each element having properties (ParentModule, ParentModPortId)
- /// defining the parent/child IO tree relationship. It would be nice to navigate this hierarchy programatically,
- /// hence the reason for this extension method. Of course, this requires the module is attached to the L5X content.
- /// In-memory created modules will inherently return an empty collection, as there is no L5X structure to introspect.
- ///
- public Module? Parent
- {
- get
- {
- var parent = Element.Parent?.Elements().FirstOrDefault(m => m.LogixName() == ParentModule);
- return parent is not null ? new Module(parent) : default;
- }
- }
-
- ///
- /// Gets the child modules of this module component defined in the current L5X content.
- ///
- ///
- /// A of components that have the ParentModule property
- /// configured as the name of this module.
- ///
- ///
- /// The L5X structure serializes modules in a flat list with each element having properties (ParentModule, ParentModPortId)
- /// defining the parent/child IO tree relationship. It would be nice to navigate this hierarchy programatically,
- /// hence the reason for this extension method. Of course, this requires the module is attached to the L5X content.
- /// In-memory created modules will inherently return an empty collection, as there is no L5X structure to introspect.
- ///
- public IEnumerable Modules
- {
- get
- {
- return Element.Parent?.Elements()
- .Where(m => m.Attribute(L5XName.ParentModule)?.Value == Name)
- .Select(e => new Module(e))
- ?? Enumerable.Empty();
- }
- }
-
- ///
- /// Returns a collection of all non-null objects for the current Module, including all
- /// config, input, and output tags.
- ///
- /// An containing the base tags for the Module.
- ///
- /// Since module tags are nested within different layers of complex types, it can be difficult to just
- /// get a single list of all module tags. This extension makes that easy by sifting through the object and returning
- /// a flat list containing all non-null config, input, and output tags defined for the component.
- ///
- public IEnumerable Tags
- {
- get
- {
- var tags = new List();
-
- if (Communications is null) return tags;
-
- if (Communications.ConfigTag is not null)
- tags.Add(Communications.ConfigTag);
-
- foreach (var connection in Communications.Connections)
- {
- if (connection.InputTag is not null)
- tags.Add(connection.InputTag);
-
- if (connection.OutputTag is not null)
- tags.Add(connection.OutputTag);
- }
-
- return tags;
- }
- }
-
- ///
- /// Returns the module's config tag object contained in the communications element.
- ///
- /// A containing the module's config tag data.
- /// This is a simple helper to make accessing the module config data more concise.
- public Tag? Config => Communications?.ConfigTag;
-
- ///
- /// Adds a child module to the current module object by updating the parent module properties, configuring the
- /// child module upstream port, and adding the component to the underlying L5X content.
- ///
- /// The module to add.
- /// The optional (slot or IP) of the module to add.
- /// parent does not have a downstream port for which to connect
- /// child modules.
- ///
- /// This extension gives us an easy way to add modules hierarchically to the underlying L5X content.
- /// If the parent module is attached to a L5X content file, this will add child module. Otherwise, this method only
- ///
- ///
- public void Add(Module child, Address? address = default)
- {
- var parentPort = Ports.FirstOrDefault(p => p.Upstream is false);
-
- if (parentPort is null)
- throw new InvalidOperationException(
- $"The module '{Name}' does not have a port for downstream module connections.");
-
- if (parentPort.Type == "Ethernet" && address is null) address = Address.DefaultIP();
- if (parentPort.Address.IsSlot && IsAttached && address is null) address = NextSlot();
- address ??= Address.DefaultSlot();
-
- var childPort = new Port {Id = 1, Type = parentPort.Type, Address = address, Upstream = true};
-
- child.ParentModule = Name;
- child.ParentModPortId = parentPort.Id;
- child.Ports.Add(childPort);
-
- var container = Element.Parent;
-
- if (container is null)
- throw new InvalidOperationException($"The module '{Name}' is not attached to and L5X content file.");
-
- container.Add(child.Serialize());
- }
-
- ///
- /// Creates a new with the provided name and catalog number.
- ///
- /// The name of the module
- /// The catalog number to lookup a catalog entry for.
- ///
- /// A new object initialized with data return by the catalog service.
- /// The module catalog service could not load the installed catalog
- /// database file -or- catalog number does not exist in the catalog database.
- /// catalogNumber is null or empty.
- /// This factory method uses the service to lookup info for the specified
- /// catalog number. If RSLogix is not installed on the current environment, this will throw an exception.
- public static Module Add(string name, string catalogNumber, Address? address = null)
- {
- var catalog = new ModuleCatalog();
- var entry = catalog.Lookup(catalogNumber);
-
- return new Module
- {
- Name = name,
- CatalogNumber = entry.CatalogNumber,
- Revision = entry.Revisions.Max(),
- Vendor = entry.Vendor,
- ProductType = entry.ProductType,
- ProductCode = entry.ProductCode,
- Ports = new LogixContainer(
- entry.Ports.Select(p => new Port
- {
- Id = p.Number,
- Type = p.Type,
- Address = p.Type == "Ethernet" ? Address.DefaultIP() : Address.DefaultSlot(),
- Upstream = !p.DownstreamOnly
- }).ToList()),
- Description = entry.Description
- };
- }
-
- ///
- /// Gets the next largest slot number for the current module by introspecting the slot numbers of all other
- /// child modules of this parent module.
- ///
- private Address NextSlot()
- {
- var children = Element.Parent?.Elements()
- .Where(m => m.Attribute(L5XName.ParentModule)?.Value == Name);
-
- var next = children?.Select(c => c.Descendants(L5XName.Port)
- .FirstOrDefault(p => p.Attribute(L5XName.Upstream)?.Value.Parse() is true &&
- byte.TryParse(p.Attribute(L5XName.Address)?.Value, out _))
- ?.Attribute(L5XName.Address)?.Value.Parse())
- .OrderByDescending(b => b)
- .FirstOrDefault();
-
- return next.HasValue ? Address.Slot(next.Value) : Address.DefaultSlot();
- }
-
- #endregion
-}
-
-///
-/// Extensions methods for a single or collection of components.
-///
-public static class ModuleExtensions
-{
- ///
- /// Gets the Local module or module that represents the controller of the module collection.
- ///
- /// A collection of modules.
- /// A single which is named local if found; Otherwise, null.
- /// This is a helper to concisely get the controller or root local module from the modules collection.
- public static Module? Local(this IEnumerable modules) => modules.SingleOrDefault(m => m.Name == "Local");
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Program.cs b/src/L5Sharp/Components/Program.cs
deleted file mode 100644
index 3688428d..00000000
--- a/src/L5Sharp/Components/Program.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Program component. Contains the properties that comprise the L5X Program element.
-///
-///
-public class Program : LogixComponent
-{
- ///
- /// Creates a new with default values.
- ///
- public Program()
- {
- Type = ProgramType.Normal;
- TestEdits = default;
- Disabled = default;
- MainRoutineName = default;
- FaultRoutineName = default;
- UseAsFolder = default;
- Tags = new LogixContainer();
- Routines = new LogixContainer();
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Program(XElement element) : base(element)
- {
- }
-
- ///
- /// Gets the type of the program (Normal, Equipment Phase).
- ///
- /// A enum representing the type of the program.
- public ProgramType Type
- {
- get => GetValue() ?? ProgramType.Normal;
- set => SetValue(value);
- }
-
- ///
- /// The value indicating whether the program has current test edits pending.
- ///
- /// >A ; trueif the program has test edits; otherwise false.
- public bool TestEdits
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The value indicating whether the program is disabled (or inhibited).
- ///
- /// A ; true if the program is disabled; otherwise false.
- public bool Disabled
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The name of the routine that serves as the entry point for the program (i.e. main routine).
- ///
- /// A representing the name of the main routine for the program.
- public string? MainRoutineName
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The name of the routine that serves as the fault routine for the program.
- ///
- /// A representing the name of the fault routine for the program.
- public string? FaultRoutineName
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// A flag indicating whether the program is used as a folder or container for other programs,
- /// as opposed to a container of tags and logix.
- ///
- /// A ; true if the program is a folder; otherwise, false.
- public bool UseAsFolder
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The collection of objects for the program component.
- ///
- public LogixContainer Tags
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- /// The collection of objects for the program component.
- ///
- public LogixContainer Routines
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-
- ///
- /// The collection of program names that are children of this component.
- /// This defines the structure of the program tree in the logical organizer.
- ///
- /// A containing the string program names.
- ///
- ///
- /// This member just returns the read only list of child program names. To modify the list, use the local
- /// and methods. This list is what is serialized and defines the collection
- /// of child programs for a given program in the logical organizer.
- ///
- ///
- /// To get access to the actual child
- /// programs, use , which is a built in helper that uses the parent L5X
- /// to retrieve the child program components.
- ///
- ///
- public IEnumerable Children =>
- Element.Descendants(L5XName.ChildProgram).Select(e => e.LogixName());
-
- ///
- /// Gets a collection of Program components that are children of this component.
- ///
- /// A of component elements.
- ///
- /// This is a helper to retrieve the other program component objects as children of this Program.
- /// This allows the caller to travers down the logical hierarchy of programs. This requires an attached L5X as
- /// it reaches back up the document tree and back down to down to find the child programs. If this component is not
- /// attached to an L5X or as no configured, then this will return an empty collection.
- ///
- public IEnumerable Programs =>
- L5X?.Programs.Where(p => Children.Any(c => c == p.Name)) ?? Enumerable.Empty();
-
- ///
- /// Finds the in which this is scheduled.
- ///
- /// If this component is attached and is scheduled to a defined Task, then the
- /// component instance, Otherwise, null.
- ///
- /// This is a helper for retrieving the parent Task for this program.
- /// This requires an attached L5X as it traverses the L5X document tree to find the target component(s).
- ///
- public Task? Task => L5X?.Tasks.FirstOrDefault(t => t.Scheduled.Any(p => p.IsEquivalent(Name)));
-
- ///
- /// Adds the specified program name as a child of this component.
- ///
- /// The name of the program to add as a child.
- /// programName is null or empty.
- public void AddChild(string programName)
- {
- if (string.IsNullOrEmpty(programName))
- throw new ArgumentException("Can not remove program with null or empty name.", nameof(programName));
-
- var element = new XElement(L5XName.ChildProgram, new XAttribute(L5XName.Name, programName));
-
- if (Element.Element(L5XName.ChildProgram) is null)
- Element.Add(new XElement(L5XName.ChildProgram));
-
- Element.Element(L5XName.ChildProgram)!.Add(element);
- }
-
- ///
- /// Removes the program with the specified name from the children collection of this
- /// component.
- ///
- /// The name of the child program to remove.
- /// programName is null or empty.
- public void RemoveChild(string programName)
- {
- if (string.IsNullOrEmpty(programName))
- throw new ArgumentException("Can not remove program with null or empty name.", nameof(programName));
-
- Element.Element(L5XName.ChildPrograms)?.Elements().Where(e => e.LogixName().IsEquivalent(programName)).Remove();
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Routine.cs b/src/L5Sharp/Components/Routine.cs
deleted file mode 100644
index eed62049..00000000
--- a/src/L5Sharp/Components/Routine.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Routine component. Contains the properties for a generic Routine element. This type does not
-/// include content property. More specific routine types are derived from this base class.
-///
-///
-public class Routine : LogixComponent
-{
- ///
- /// Creates a new with default values.
- ///
- ///
- /// By default this will be a RLL routine type.
- /// To specify a different type, use the constructor.
- ///
- public Routine()
- {
- Element.Add(new XAttribute(L5XName.Type, RoutineType.RLL));
- Element.Add(new XElement(L5XName.RLLContent));
- }
-
- ///
- /// Creates a new of the specified .
- ///
- /// The of the routine.
- /// type is null.
- public Routine(RoutineType type)
- {
- if (type is null) throw new ArgumentNullException(nameof(type));
- Element.Add(new XAttribute(L5XName.Type, type));
- Element.Add(new XElement(type.ContentName));
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Routine(XElement element) : base(element)
- {
- }
-
- ///
- /// The type of the component.
- ///
- /// A enum specifying the type content the routine contains.
- public RoutineType Type
- {
- get => GetRequiredValue();
- set => SetRequiredValue(value);
- }
-
- ///
- /// The online edit type for the ST/FBD/SFC type.
- ///
- ///
- /// If the routine is a ST, FBD, or SFC type, then the value;
- /// Otherwise, null for RLL routines.
- ///
- public OnlineEditType? OnlineEditType
- {
- get => GetValue(e => e.Element(Type.ContentName));
- set => SetValue(value, e => e.Element(Type.ContentName));
- }
-
- ///
- /// The sheet size for the FBD or SFC type.
- ///
- ///
- /// If the routine is a FBD or SFC type, then the value;
- /// Otherwise, null for RLL or ST routines.
- ///
- public SheetSize? SheetSize
- {
- get => GetValue(e => e.Element(Type.ContentName));
- set => SetValue(value, e => e.Element(Type.ContentName));
- }
-
- ///
- /// The sheet orientation for the FBD or SFC type.
- ///
- ///
- /// If the routine is a FBD or SFC type, then the value;
- /// Otherwise, null for RLL or ST routines.
- ///
- public SheetOrientation? SheetOrientation
- {
- get => GetValue(e => e.Element(Type.ContentName));
- set => SetValue(value, e => e.Element(Type.ContentName));
- }
-
- ///
- /// Gets the routine content as a containing elements of the specified type.
- ///
- /// The content element type to return.
- /// A with access to the root content and specified element types.
- /// No content element corresponding to the specified exists for the
- /// underlying . This can happen if the provided element is not valid.
- ///
- /// This method offers a dynamic interface for accessing content of any routine type. If the underlying routine
- /// content does not match the specified, a L5XException will be thrown.
- ///
- public LogixContainer Content() where TCode : LogixCode
- {
- var content = Element.Element(Type.ContentName);
-
- return content is not null
- ? new LogixContainer(content)
- : throw Element.L5XError(Type.ContentName);
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Tag.cs b/src/L5Sharp/Components/Tag.cs
deleted file mode 100644
index e3c7dc15..00000000
--- a/src/L5Sharp/Components/Tag.cs
+++ /dev/null
@@ -1,759 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Tag component. Contains the properties that comprise the L5X Tag element.
-///
-///
-[L5XType(L5XName.Tag)]
-[L5XType(L5XName.LocalTag)]
-[L5XType(L5XName.ConfigTag)]
-[L5XType(L5XName.InputTag)]
-[L5XType(L5XName.OutputTag)]
-public class Tag : LogixComponent
-{
- private readonly LogixMember _member;
-
- ///
- /// Creates a new with default values.
- ///
- public Tag()
- {
- _member = new LogixMember(Element);
- _member.DataChanged += OnDataChanged;
-
- Root = this;
- TagType = TagType.Base;
- ExternalAccess = ExternalAccess.ReadWrite;
- Constant = false;
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Tag(XElement element) : base(element)
- {
- _member = new LogixMember(Element);
- _member.DataChanged += OnDataChanged;
-
- Root = this;
- }
-
- ///
- /// Creates a new nested member initialized with the root tag, underlying member,
- /// and optional parent tag.
- ///
- /// The root or base tag of this tag member.
- /// The underlying member that this tag wraps.
- /// The parent tag of this tag member.
- ///
- /// This constructor is used internally for methods like to return new
- /// tag member objects.
- ///
- private Tag(Tag root, LogixMember member, Tag parent) : base(root.Element)
- {
- _member = member ?? throw new ArgumentNullException(nameof(member));
- Root = root ?? throw new ArgumentNullException(nameof(root));
- Parent = parent ?? throw new ArgumentNullException(nameof(parent));
- }
-
- ///
- ///
- ///
- /// The name of a Tag component is unique in that not all elements that we consider Tag objects
- /// have the Name attribute (namely module tags like config, input, and output).
- /// For this reason, the Tag component contains special code that will detect and determine a module tag name.
- /// If the underlying element represents a normal tag element, this simply returns the Name attribute,
- /// similar to other components. Setting the Name property will always update the name attribute of the
- /// underlying element.
- ///
- /// Note that this property will always represent the name of the root tag component. This is true even for
- /// nested tag objects. To get the full tag name for any given tag object, use the property.
- ///
- ///
- public override string Name
- {
- get => GetTagName();
- set => SetValue(value);
- }
-
- ///
- /// The description (either root, comment, or parent) for the tag or tag member.
- ///
- /// A containing the text description for the tag.
- ///
- ///
- /// If this is the root tag, this will return the root/base description.
- /// If this is a nested tag member, this will look for a configured comment (as comments are stored in a different
- /// element in the L5X), and return the value if found. If the comment is not found for the tag member,
- /// this will return the parent description, which mimics the pass through feature of logix tag documentation.
- ///
- ///
- /// Setting this value for a nested tag member will update the underlying comments element for the tag.
- /// Setting this value for the root tag will simply update the root tag description element.
- ///
- ///
- public override string? Description
- {
- get => GetTagDescription();
- set => SetTagDescription(value);
- }
-
- ///
- /// The name of the data type the tag represents.
- ///
- /// A representing the name of the tag data type.
- ///
- /// This property simply points to the name property of .
- /// This keeps the properties in sync. By initializing value, you are setting the data type name.
- /// Once initialized, the data type won't change. To change the tag's type, use .
- ///
- public string DataType => Value.Name;
-
- ///
- /// The dimensions of the tag, indicating the length and dimensions of it's array.
- ///
- /// A value representing the array dimensions of the tag.
- ///
- /// This value will always point to the dimensions property of , assuming it is an
- /// .
- /// If Value is not an array type, this property will always return .
- ///
- public Dimensions Dimensions => Value is ArrayType array ? array.Dimensions : Dimensions.Empty;
-
- ///
- /// The radix format of Value. Only applies if the tag is an .
- ///
- /// A option representing data format of the tag value.
- ///
- /// This value will always point to the radix of , assuming it is an .
- /// If Value is not an atomic type, this property will always return .
- ///
- public Radix Radix => Value is AtomicType atomic ? atomic.Radix : Radix.Null;
-
- ///
- /// The value or data of the .
- ///
- /// A containing the tag data.
- ///
- ///
- /// The is the basis for all tag data types. This property may represent the atomic
- /// value (bool, integer, float), string, complex structure, or array. LogixType has built in implicit operators
- /// to convert .NET types to LogixType objects so to make setting Value more concise.
- ///
- ///
- /// Since the type can not be known at compile time when deserializing, we treat it as the abstract base class.
- /// However, the will attempt to create concrete instances of types that are available,
- /// allowing the user to cast Value down to more derived types.
- ///
- ///
- public LogixType Value
- {
- get => _member.DataType;
- set => _member.DataType = value;
- }
-
- ///
- /// The external access option indicating the read/write access of the tag.
- ///
- /// A option representing read/write access of the tag.
- public ExternalAccess? ExternalAccess
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// A type indicating whether the current tag component is a base tag, or alias for another tag instance.
- ///
- /// A option representing the type of tag component.
- public TagType? TagType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The usage option indicating the scope in which the tag is visible or usable from.
- ///
- /// A option representing the tag scope.
- public TagUsage? Usage
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The tag name of the tag that is the alias of the current tag object.
- ///
- /// A string representing the full tag name of the alias tag.
- public TagName? AliasFor
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Indicates whether the tag is a constant.
- ///
- /// true if the tag is constant; otherwise, false.
- /// Only value type tags have the ability to be set as a constant. Default is false.
- public bool? Constant
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The configured unit value of the tag.
- ///
- /// A representing the defined units of the tag.
- /// This appears only used for module defined tags.
- public string? Unit
- {
- get => GetUnit();
- set => SetUnit(value);
- }
-
- ///
- /// The parent tag of this member.
- ///
- ///
- /// A representing the immediate parent tag of the this tag member. Will be null
- /// for all root tag objects.
- ///
- ///
- /// This property helps model the hierarchical structure of a tag object. Tags has a
- /// which can represent a nested complex data type. This class models this by keeping references to the Root
- /// and Parent tags for each tag object. Only nested tag members should have a Parent.
- ///
- ///
- public Tag? Parent { get; }
-
- ///
- /// The root tag of this member.
- ///
- /// A representing the root tag.
- ///
- /// This property helps model the hierarchical structure of a tag object. Tags has a
- /// which can represent a nested complex data type. This class models this by keeping references to the Root
- /// and Parent tags for each tag object. All tags should have a Root.
- ///
- ///
- public Tag Root { get; }
-
- ///
- ///
- ///
- public Tag? Alias => AliasFor is not null ? L5X?.Find(AliasFor) : default;
-
- ///
- /// The full tag name path of the .
- ///
- /// A containing the full dot-down path of the tag member name.
- ///
- ///
- /// This property will always represent the fully qualified tag name path, which includes nested tag
- /// member object. This property is determined using the hierarchical structure of the tag component.
- ///
- ///
- public TagName TagName => Parent is not null ? TagName.Concat(Parent.TagName, _member.Name) : new TagName(Name);
-
- ///
- /// Gets the tag member having the provided tag name value. The tag name can represent either an immediate member
- /// or a nested member in the tag hierarchy.
- ///
- /// The relative to the current tag member for which to retrieve.
- /// tagName is null.
- /// tagName does not represent a valid member for the tag member data structure.
- /// A child component represented by the provided tag name value.
- ///
- /// Note that tagName can be a path to a member more than one layer down the hierarchical structure
- /// of the tag. However, it must start with a member of the current tag, and not the
- /// actual name of this tag object. The difference between this indexer property and
- /// is that this will throw and exception if a member with tagName is not found
- /// (i.e. returns non-nullable reference type).
- ///
- public Tag this[TagName tagName]
- {
- get
- {
- if (tagName is null) throw new ArgumentNullException(nameof(tagName));
- if (tagName.IsEmpty) return this;
-
- var member = Value.Member(tagName.Root);
- if (member is null)
- throw new ArgumentException(
- $"No member with name '{tagName.Root}' exists in the tag data structure for type {DataType}.");
-
- var tag = new Tag(Root, member, this);
- var remaining = TagName.Combine(tagName.Members.Skip(1));
- return remaining.IsEmpty ? tag : tag[remaining];
- }
- }
-
- ///
- /// Adds a new member to the tag's complex data structure.
- ///
- /// The name of the member to add to the tag's data structure.
- /// The of the member to add to the tag's data structure.
- /// The current tag does not contain a mutable complex logix type.
- ///
- /// This will operate relative to the current tag member object, and is simply a call to the underlying
- /// Add method. Therefore this is simply a helper to make mutating tag structures
- /// more concise.
- ///
- public void Add(string name, LogixType value)
- {
- var member = new LogixMember(name, value);
- if (Value is not ComplexType complexType)
- throw new InvalidOperationException("Can only mutate ComplexType tags.");
- complexType.Add(member);
- }
-
- ///
- /// Gets a descendent tag member relative to the current tag member.
- ///
- /// The full path of the member to get.
- /// A representing the child member instance.
- ///
- /// Note that tagName can be a path to a member more than one layer down the hierarchical structure
- /// of the tag or tag member. However, it must start with a member of the current tag or tag member, and not the
- /// actual name of the current tag or tag member.
- ///
- ///
- /// var member = tag.Member("Array[1].SubType.Member.0");
- ///
- public Tag? Member(TagName tagName)
- {
- if (tagName is null) throw new ArgumentNullException(nameof(tagName));
- if (tagName.IsEmpty) return this;
-
- var member = Value.Member(tagName.Root);
- if (member is null) return default;
-
- var tag = new Tag(Root, member, this);
- var remaining = TagName.Combine(tagName.Members.Skip(1));
- return remaining.IsEmpty ? tag : tag.Member(remaining);
- }
-
- ///
- /// Gets this and all descendent tag members of the tag data structure.
- ///
- /// A containing objects.
- ///
- /// This recursively traverses the hierarchical data structure of tag's and returns all
- /// descendant tags, as well as this tag.
- ///
- public IEnumerable Members()
- {
- var members = Parent is null ? new List {this} : new List();
-
- foreach (var member in Value.Members)
- {
- var tagMember = new Tag(Root, member, this);
- members.Add(tagMember);
- members.AddRange(tagMember.Members());
- }
-
- return members;
- }
-
- ///
- /// Gets this and all descendent tag members of the tag data structure that satisfy the specified tag name predicate.
- ///
- /// A predicate expression specifying the tag name filter.
- /// A containing objects that satisfy the predicate.
- ///
- /// This recursively traverses the hierarchical data structure of tag's and returns all
- /// tags that satisfy the specified predicate.
- ///
- public IEnumerable Members(Predicate predicate)
- {
- if (predicate is null) throw new ArgumentNullException(nameof(predicate));
-
- var members = Parent is null && predicate.Invoke(TagName) ? new List {this} : new List();
-
- foreach (var member in Value.Members)
- {
- var tag = new Tag(Root, member, this);
-
- if (predicate.Invoke(tag.TagName))
- members.Add(tag);
-
- members.AddRange(tag.Members(predicate));
- }
-
- return members;
- }
-
- ///
- /// Gets this and all descendent tag members of the tag data structure that that satisfy the specified tag predicate.
- ///
- /// A predicate expression specifying the tag filter.
- /// A containing objects that satisfy the predicate.
- ///
- /// This recursively traverses the hierarchical data structure of tag's and returns all
- /// tags that satisfy the specified predicate.
- ///
- public IEnumerable Members(Predicate predicate)
- {
- if (predicate is null) throw new ArgumentNullException(nameof(predicate));
-
- var members = Parent is null && predicate.Invoke(this) ? new List {this} : new List();
-
- foreach (var member in Value.Members)
- {
- var tag = new Tag(Root, member, this);
-
- if (predicate.Invoke(tag))
- members.Add(tag);
-
- members.AddRange(tag.Members(predicate));
- }
-
- return members;
- }
-
- ///
- /// Gets all descendent tags of the tag specified by the provided tag name.
- ///
- /// A tag name path to the tag member for which to get members of.
- /// A containing objects.
- /// This recursively traverses the hierarchical data structure of the tag and returns all
- /// child/descendant members.
- public IEnumerable MembersOf(TagName tagName)
- {
- if (tagName is null) throw new ArgumentNullException(nameof(tagName));
- if (tagName.IsEmpty) return Members();
-
- var member = Value.Member(tagName.Root);
- if (member is null) return Enumerable.Empty();
-
- var tag = new Tag(Root, member, this);
- var remaining = TagName.Combine(tagName.Members.Skip(1));
- return remaining.IsEmpty ? tag.Members() : tag.MembersOf(remaining);
- }
-
- ///
- /// Creates a new with the provided name and specified type parameter.
- ///
- /// The name of the tag.
- /// The logix data type of the tag. Type must have parameterless constructor to create.
- /// A new object with specified parameters.
- public static Tag New(string name) where TLogixType : LogixType, new() =>
- new() {Name = name, Value = new TLogixType()};
-
- ///
- /// Removes a member with the specified name from the tag's complex data structure.
- ///
- /// The name of the member to remove.
- /// The current tag does not contain a mutable complex logix type.
- ///
- /// This will operate relative to the current tag member object, and is simply a call to the underlying
- /// Remove method. Therefore this is simply a helper to make mutating tag structures
- /// more concise.
- ///
- public void Remove(string name)
- {
- if (Value is not ComplexType complexType)
- throw new InvalidOperationException("Can only mutate ComplexType tags.");
- complexType.Remove(name);
- }
-
- ///
- /// Returns a collection of all descendent tag names of the current Tag, including the tag name of the
- /// this Tag.
- ///
- ///
- /// A of containing the this tag name and all child tag names.
- ///
- public IEnumerable TagNames() => Members().Select(t => t.TagName);
-
- ///
- public override string ToString() => TagName;
-
- ///
- /// Returns as new with the updated data type value provided.
- ///
- /// The value to change to.
- ///
- /// A with the same underlying and corresponding properties with
- /// changed to the provided .
- ///
- /// When this tag is a nested tag member and it's parent tag's
- /// property is not a object.
- ///
- ///
- /// This is meant to be a concise way to change the data type of tag while leaving all else the same, since setting
- /// should only ever update the value and not change the data type.
- ///
- ///
- /// If this is called for the Root tag object, then the entire data element is replaced and a new instance
- /// is returned. The Tag will still be attached as we are mutating the underlying element object in place.
- /// If this is called for a nested tag member, then this method checks if the parent tag is a complex type, and if so,
- /// calls the underlying Replace method for the current member name. Therefore, calls to this method for nested tags
- /// will fail if for the parent tag is not a complex type object.
- ///
- ///
- public Tag With(LogixType value)
- {
- if (Parent is null)
- {
- SetData(value);
- return new Tag(Element);
- }
-
- if (Parent.Value is not ComplexType complexType)
- throw new InvalidOperationException(
- $"Can not mutate tag data for parent type {Parent.DataType} as it is not a complex type instance.");
-
- complexType.Replace(TagName.Member, value);
- return Root[TagName.Path];
- }
-
- #region Internal
-
- ///
- /// Triggers when a nested data type value of this tag's changes.
- ///
- private void OnDataChanged(object sender, EventArgs e) => SetData(Root.Value);
-
- ///
- /// Handles setting the data of the root tag and updating the root properties
- ///
- private void SetData(LogixType value)
- {
- var data = Element.Elements().FirstOrDefault(e =>
- DataFormat.Supported.Any(f => f == e.Attribute(L5XName.Format)?.Value));
-
- if (data is null)
- Element.Add(GenerateData(value));
- else
- data.ReplaceWith(GenerateData(value));
-
- SetTagAttributes(value);
- }
-
- ///
- /// Handles setting the , , and of the underlying
- /// element for the tag.
- ///
- private void SetTagAttributes(LogixType value)
- {
- Element.SetAttributeValue(L5XName.DataType, value.Name);
-
- var radix = value is AtomicType atomicType ? atomicType.Radix
- : value is ArrayType arrayType && arrayType.Radix != Radix.Null ? arrayType.Radix
- : null;
- Element.SetAttributeValue(L5XName.Radix, radix);
-
- var dimensions = value is ArrayType array ? array.Dimensions : null;
- Element.SetAttributeValue(L5XName.Dimensions, dimensions);
- }
-
- ///
- /// Generates the root data element for a tag component provided a logix type.
- ///
- private static XElement GenerateData(LogixType type)
- {
- return type switch
- {
- StringType stringType => stringType.Serialize(),
- ALARM_ANALOG alarmAnalog => GenerateFormatted(alarmAnalog, DataFormat.Alarm),
- ALARM_DIGITAL alarmDigital => GenerateFormatted(alarmDigital, DataFormat.Alarm),
- MESSAGE message => GenerateFormatted(message, DataFormat.Message),
- ILogixSerializable serializable => GenerateFormatted(serializable, DataFormat.Decorated)
- };
- }
-
- ///
- /// Generates data element with provided format value and serializable type.
- ///
- private static XElement GenerateFormatted(ILogixSerializable type, DataFormat format)
- {
- var data = new XElement(L5XName.Data, new XAttribute(L5XName.Format, format));
- data.Add(type.Serialize());
- return data;
- }
-
- ///
- /// Handles determining the tag name of the current object from the underlying XElement. This handles module
- /// tag elements (ConfigTag, InputTag, OutputTag) as well as normal component elements (Tag, LocalTag).
- ///
- private string GetTagName()
- {
- var xName = Element.Name;
-
- if (xName == L5XName.ConfigTag || xName == L5XName.InputTag || xName == L5XName.OutputTag)
- return ModuleTagName(Element);
-
- return Element.Attribute(L5XName.Name)?.Value ?? string.Empty;
- }
-
- ///
- /// A helper for determining a module tag name for an input, output, or config tag element. This involves getting
- /// the tag suffix, module name, parent module name, and configured slot number.
- ///
- private static string ModuleTagName(XElement element)
- {
- var suffix = DetermineModuleSuffix(element);
-
- var moduleName = element.Ancestors(L5XName.Module)
- .FirstOrDefault()?.Attribute(L5XName.Name)?.Value;
-
- var parentName = element.Ancestors(L5XName.Module)
- .FirstOrDefault()?.Attribute(L5XName.ParentModule)?.Value;
-
- var slot = element
- .Ancestors(L5XName.Module)
- .Descendants(L5XName.Port)
- .Where(p => bool.TryParse(p.Attribute(L5XName.Upstream)?.Value!, out _)
- && p.Attribute(L5XName.Type)?.Value != "Ethernet"
- && int.TryParse(p.Attribute(L5XName.Address)?.Value, out _))
- .Select(p => p.Attribute(L5XName.Address)?.Value)
- .FirstOrDefault();
-
- return slot is not null ? $"{parentName}:{slot}:{suffix}" : $"{moduleName}:{suffix}";
- }
-
- private static string DetermineModuleSuffix(XElement element)
- {
- if (element.Name == L5XName.ConfigTag) return "C";
-
- if (element.Name == L5XName.InputTag)
- return element.Parent?.Attribute(L5XName.InputTagSuffix)?.Value ?? "I";
-
- if (element.Name == L5XName.OutputTag)
- return element.Parent?.Attribute(L5XName.OutputTagSuffix)?.Value ?? "O";
-
- throw new ArgumentException($"Module tag element name {element.Name} not valid.");
- }
-
- ///
- /// Handles getting a comment value for the current tag.
- ///
- private string? GetTagDescription()
- {
- if (Parent is null) return Element.Element(L5XName.Description)?.Value;
-
- var comment = Element.Descendants(L5XName.Comment)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase));
-
- //logix descriptions propagates to their children when not overriden. This mimics that.
- return comment is not null ? comment.Value : Parent.Description;
- }
-
- ///
- /// Handles setting a comment element of the root tag structure for the current tag name operand.
- ///
- private void SetTagDescription(string? value)
- {
- //If the parent is null forward set to base description implementation which is essentially
- //setting the description element of the root tag component.
- if (Parent is null)
- {
- base.Description = value;
- return;
- }
-
- //Child descriptions are set in the comments element of a tag.
- if (string.IsNullOrEmpty(value))
- {
- Element.Descendants(L5XName.Comment)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase))?.Remove();
- return;
- }
-
- var comments = Element.Element(L5XName.Comments);
- if (comments is null)
- {
- comments = new XElement(L5XName.Comments);
-
- //This is to place comments right after description if it exists, otherwise as the first element.
- if (Element.FirstNode is XElement element && element.Name == L5XName.Description)
- Element.FirstNode.AddAfterSelf(comments);
- else
- Element.AddFirst(comments);
- }
-
- var comment = comments.Elements(L5XName.Comment)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase));
-
- if (comment is not null)
- {
- comment.Value = value;
- return;
- }
-
- comments.Add(GenerateDescriptor(value, L5XName.Comment));
- }
-
- ///
- /// Handles getting a unit value for the current tag name operand.
- ///
- private string? GetUnit()
- {
- return Element.Descendants(L5XName.EngineeringUnit)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase))?.Value;
- }
-
- ///
- /// Handles setting a unit element of the root tag structure for the current tag name operand.
- ///
- private void SetUnit(string? value)
- {
- if (string.IsNullOrEmpty(value))
- {
- Element.Descendants(L5XName.EngineeringUnit)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase))?.Remove();
- return;
- }
-
- var units = Element.Element(L5XName.EngineeringUnits);
- if (units is null)
- {
- units = new XElement(L5XName.EngineeringUnits);
- Element.Add(units);
- }
-
- var unit = units.Elements(L5XName.EngineeringUnit)
- .FirstOrDefault(e => string.Equals(e.Attribute(L5XName.Operand)?.Value, TagName.Operand,
- StringComparison.OrdinalIgnoreCase));
-
- if (unit is not null)
- {
- unit.Value = value;
- return;
- }
-
- units.Add(GenerateDescriptor(value, L5XName.EngineeringUnit));
- }
-
- ///
- /// Generates a new comment/unit descriptor element with the provided value and name.
- ///
- private XElement GenerateDescriptor(string value, string name)
- {
- var element = new XElement(name);
- element.Add(new XAttribute(L5XName.Operand, TagName.Operand.ToUpper()));
- element.Add(new XCData(value));
- return element;
- }
-
- #endregion
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Task.cs b/src/L5Sharp/Components/Task.cs
deleted file mode 100644
index dc4bccc9..00000000
--- a/src/L5Sharp/Components/Task.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Task component. Contains the properties that comprise the L5X Task element.
-///
-///
-/// Observe these guidelines when defining a task:
-/// • Tasks must be defined after programs and before controller objects.
-/// • There is a maximum of 32 tasks.
-/// • There is one continuous task only.
-/// • A program can be scheduled under one task only.
-/// • Scheduled programs must be defined (must exist).
-///
-///
-public class Task : LogixComponent
-{
- ///
- /// Creates a new with default values.
- ///
- /// By default uses , 10ms , 10ms ,
- /// and 500ms .
- public Task()
- {
- Type = TaskType.Periodic;
- Priority = new TaskPriority(10);
- Rate = new ScanRate(10);
- Watchdog = new Watchdog(500);
- InhibitTask = false;
- DisableUpdateOutputs = false;
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Task(XElement element) : base(element)
- {
- }
-
- ///
- /// Gets the type of the task component (Continuous, Periodic, Event).
- ///
- /// A enum representing the type of the task.
- public TaskType Type
- {
- get => GetRequiredValue();
- set => SetRequiredValue(value);
- }
-
- ///
- /// The scan priority of the task component. Default of 10.
- ///
- /// >A value type representing the priority of the task.
- public TaskPriority Priority
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The scan rate (ms) of the task component. Default of 10.
- ///
- /// >A value type representing the rate of the task.
- public ScanRate? Rate
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The watchdog rate (ms) of the task component. Default of 500.
- ///
- /// A value type representing the watchdog of the task.
- public Watchdog Watchdog
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The value indicating whether the task is inhibited.
- ///
- /// true if the task is inhibited; otherwise false.
- public bool InhibitTask
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The value indicating whether the task is set to disable updating output values.
- ///
- /// true if the task has disabled update outputs; otherwise false.
- public bool DisableUpdateOutputs
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The trigger for the event task. Only used for event tasks.
- ///
- ///
- /// A value indicating what triggers the task. Returns null for non-event tasks.
- ///
- public TaskEventTrigger? EventTrigger
- {
- get => GetValue(L5XName.EventInfo.XName());
- set => SetValue(value, L5XName.EventInfo.XName());
- }
-
- ///
- /// The tag name that the event task consumes. Only used for event tasks.
- ///
- ///
- /// A value indicating what tag to consume. Returns null for non-event tasks.
- ///
- /// Only used for event tasks with a Consumed Tag trigger or a Module Input Data State Change trigger.
- public TagName? EventTag
- {
- get => GetValue(L5XName.EventInfo.XName());
- set => SetValue(value, L5XName.EventInfo.XName());
- }
-
- ///
- /// The value indicating whether timeouts are enabled for the event task. Only used for event tasks.
- ///
- ///
- /// If the task is an event type task, true indicating that timeouts are enabled, false to indicate
- /// they are disabled. Returns null for non-event tasks.
- ///
- public bool? EnableTimeout
- {
- get => GetValue(L5XName.EventInfo.XName());
- set => SetValue(value, L5XName.EventInfo.XName());
- }
-
- ///
- /// Retrieves a collection of components that are scheduled to this .
- ///
- /// A containing component objects schedule to this task.
- ///
- /// This is an extension to the type and uses the attached L5X file to retrieve the program components.
- /// Therefore if this task is not attached it will return and empty collection. Also if no program exists with the
- /// scheduled name, this will return an empty collection.
- ///
- public IEnumerable Programs =>
- L5X?.Programs.Where(p => Scheduled.Any(s => s == p.Name)) ?? Enumerable.Empty();
-
- ///
- /// The collection of program names that are scheduled to the task.
- ///
- /// A containing the string program names.
- /// This member just returns the read only list of scheduled programs. To modify the list, use
- public IEnumerable Scheduled =>
- Element.Descendants(L5XName.ScheduledProgram).Select(e => e.LogixName());
-
- ///
- public override L5X Export(Revision? softwareRevision = null)
- {
- throw new NotSupportedException("Task components do not support export function.");
- }
-
- ///
- public override void Delete()
- {
- if (Element.Parent is null || !IsAttached) return;
-
- foreach (var program in Programs)
- {
- program.Delete();
- }
-
- Element.Remove();
- }
-
- ///
- /// Adds the provided program name to the underlying list of .
- ///
- /// The name of the program to schedule.
- public void Schedule(string program)
- {
- var element = new XElement(L5XName.ScheduledProgram, new XAttribute(L5XName.Name, program));
-
- if (Element.Element(L5XName.ScheduledPrograms) is null)
- Element.Add(new XElement(L5XName.ScheduledPrograms));
-
- Element.Element(L5XName.ScheduledPrograms)!.Add(element);
- }
-
- ///
- /// Removes the specified program name from the underlying list of programs.
- ///
- /// The name of the program to cancel.
- public void Cancel(string program)
- {
- var scheduled = Element.Element(L5XName.ScheduledPrograms);
-
- if (scheduled is null) return;
-
- scheduled.Elements(L5XName.ScheduledProgram).FirstOrDefault(p => p.LogixName() == program)?.Remove();
-
- if (!scheduled.Elements().Any())
- scheduled.Remove();
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/Trend.cs b/src/L5Sharp/Components/Trend.cs
deleted file mode 100644
index 7e38dd59..00000000
--- a/src/L5Sharp/Components/Trend.cs
+++ /dev/null
@@ -1,381 +0,0 @@
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix Trend component. Contains the properties that comprise the L5X Trend element.
-///
-///
-/// Observe these guidelines when defining a trend:
-/// • A trend can support as many as eight pen declarations.
-///
-///
-public class Trend : LogixComponent
-{
- ///
- public Trend()
- {
- SamplePeriod = 1;
- CaptureSizeType = CaptureSizeType.Samples;
- }
-
- ///
- public Trend(XElement element) : base(element)
- {
- }
-
- ///
- /// Specify how often trending tags are collected in milliseconds (1 msec...30 minutes).
- ///
- public int SamplePeriod
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specifies the maximum number of captures allowed (1...100).
- ///
- public int NumberOfCaptures
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Define how the capture size is specified.
- ///
- /// A representing the capture size option. Type Samples, TimePeriod, or NoLimit.
- public CaptureSizeType? CaptureSizeType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the number of samples for each capture.
- ///
- ///
- /// Rockwell: The maximum number of samples is 2-hours worth of data samples or 1000 samples,
- /// whichever is greater. If the CaptureSizeType is Samples, the range is 1...(2 hours/SamplePeriod) or 1000 samples,
- /// whichever is greater. If the CaptureSizeType is TimePeriod, the range is SamplePeriod...2 hours or
- /// (SamplePeriod * 1000), whichever is greater
- ///
- public int CaptureSize
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the start trigger
- ///
- ///
- public TriggerType? StartTriggerType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the tag name of the first start trigger. The name must be one of the pen names.
- ///
- public TagName? StartTriggerTag1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the operation that is applied on ,
- /// and or .
- ///
- public TriggerOperation? StartTriggerOperation1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the first start trigger target.
- ///
- ///
- /// If you type TargetValue, is expected.
- /// Otherwise, is expected.
- ///
- public TriggerTargetType? StartTriggerTargetType1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target value if the is TargetValue.
- ///
- /// Type a binary, octal, decimal, or hexadecimal integer number or type a floating point number.
- public AtomicType? StartTriggerTargetValue1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target tag if the StartTriggerTargetType is TargetTag.
- ///
- /// The tag must be one of the pen names.
- public TagName? StartTriggerTargetTag1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a logical operation (AND or OR) that is performed on StartTriggerXXX1 and StartTriggerXXX2.
- ///
- /// StartTriggerXXX1 consists of StartTriggerTag1, StartTriggerOperation1, StartTriggerTargetType1, and
- /// StartTriggerTargetValue1 or StartTriggerTargetTag1. StartTriggerXXX2 consists of StartTriggerTag2,
- /// StartTriggerOperation2, StartTriggerTargetType2, and StartTriggerTargetValue2 or StartTriggerTargetTag2.
- public Operator? StartTriggerLogicalOperation
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the tag name of the second start trigger. The name must be one of the pen names.
- ///
- public TagName? StartTriggerTag2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the operation that is applied on ,
- /// and or .
- ///
- public TriggerOperation? StartTriggerOperation2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the first start trigger target.
- ///
- ///
- /// If you type TargetValue, is expected.
- /// Otherwise, is expected.
- ///
- public TriggerTargetType? StartTriggerTargetType2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target value if the is TargetValue.
- ///
- /// Type a binary, octal, decimal, or hexadecimal integer number or type a floating point number.
- public AtomicType? StartTriggerTargetValue2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target tag if the StartTriggerTargetType is TargetTag.
- ///
- /// The tag must be one of the pen names.
- public TagName? StartTriggerTargetTag2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Define how pre-samples are specified. Type Samples or TimePeriod.
- ///
- public SamplesType? PreSamplesType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the number of pre-samples (0...1000) if the PreSampleType is Samples. Specify a time period
- /// (0...(SamplePeriod ∗ 1000)) that covers pre-samples if the PreSampleType is TimePeriod.
- ///
- public int? PreSamples
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the stop trigger
- ///
- /// A representing the value NoTrigger or Event Trigger.
- public TriggerType? StopTriggerType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the tag name of the first start trigger. The name must be one of the pen names.
- ///
- public TagName? StopTriggerTag1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the operation that is applied on ,
- /// and or .
- ///
- public TriggerOperation? StopTriggerOperation1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the first start trigger target.
- ///
- ///
- /// If you type TargetValue, is expected.
- /// Otherwise, is expected.
- ///
- public TriggerTargetType? StopTriggerTargetType1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target value if the is TargetValue.
- ///
- /// Type a binary, octal, decimal, or hexadecimal integer number or type a floating point number.
- public AtomicType? StopTriggerTargetValue1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target tag if the StopTriggerTargetType is TargetTag.
- ///
- /// The tag must be one of the pen names.
- public TagName? StopTriggerTargetTag1
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a logical operation (AND or OR) that is performed on StopTriggerXXX1 and StopTriggerXXX2.
- ///
- /// StopTriggerXXX1 consists of StopTriggerTag1, StopTriggerOperation1, StopTriggerTargetType1, and
- /// StopTriggerTargetValue1 or StopTriggerTargetTag1. StopTriggerXXX2 consists of StopTriggerTag2,
- /// StopTriggerOperation2, StopTriggerTargetType2, and StopTriggerTargetValue2 or StopTriggerTargetTag2.
- public Operator? StopTriggerLogicalOperation
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the tag name of the second start trigger. The name must be one of the pen names.
- ///
- public TagName? StopTriggerTag2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the operation that is applied on ,
- /// and or .
- ///
- public TriggerOperation? StopTriggerOperation2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the type of the first start trigger target.
- ///
- ///
- /// If you type TargetValue, is expected.
- /// Otherwise, is expected.
- ///
- public TriggerTargetType? StopTriggerTargetType2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target value if the is TargetValue.
- ///
- /// Type a binary, octal, decimal, or hexadecimal integer number or type a floating point number.
- public AtomicType? StopTriggerTargetValue2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify a target tag if the StopTriggerTargetType is TargetTag.
- ///
- /// The tag must be one of the pen names.
- public TagName? StopTriggerTargetTag2
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Define how post-samples are specified. Type Samples or TimePeriod.
- ///
- public SamplesType? PostSamplesType
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the number of post-samples (0...1000) if the PostSampleType is Samples. Specify a time period
- /// (0...(SamplePeriod ∗ 1000)) that covers post-samples if the PostSampleType is TimePeriod.
- ///
- public int? PostSamples
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// Specify the version of the Trend feature.
- ///
- public int? TrendxVersion
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The collection of components the Trend is configured with.
- ///
- /// Only supports up to 8 pens per trend.
- public LogixContainer Pens
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Components/WatchList.cs b/src/L5Sharp/Components/WatchList.cs
deleted file mode 100644
index c2cbdec0..00000000
--- a/src/L5Sharp/Components/WatchList.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A logix WatchList component. Contains the properties that comprise the L5X QuickWatchList element.
-///
-///
-[L5XType(L5XName.QuickWatchList)]
-public class WatchList : LogixComponent
-{
- ///
- public WatchList() : base(new XElement(L5XName.QuickWatchList))
- {
- }
-
- ///
- public WatchList(XElement element) : base(element)
- {
- }
-
- ///
- /// Accesses a at the specified index of the .
- ///
- /// The zer0-based index of the .
- public WatchTag this[int index]
- {
- get => new(Element.Elements(L5XName.WatchTag).ElementAt(index));
- set => Element.Elements(L5XName.WatchTag).ElementAt(index).ReplaceWith(value.Serialize());
- }
-
- ///
- /// Accesses a of the with the specifier tag name.
- ///
- /// The tag specifier of the to access.
- public WatchTag this[string specifier]
- {
- get
- {
- var tag = Element.Elements(L5XName.WatchTag)
- .FirstOrDefault(e => e.Attribute(L5XName.Specifier)?.Value == specifier);
- return tag is not null ? new WatchTag(tag) : throw Element.L5XError(specifier!);
- }
- set
- {
- if (value is null) throw new ArgumentNullException(nameof(value));
-
- var tag = Element.Elements(L5XName.WatchTag)
- .FirstOrDefault(e => e.Attribute(L5XName.Specifier)?.Value == specifier);
-
- if (tag is null)
- {
- Element.Add(value.Serialize());
- return;
- }
-
- tag.ReplaceWith(value.Serialize());
- }
- }
-
- ///
- /// Adds a to the end of the .
- ///
- /// The tag to add.
- /// tag is null.
- public void Add(WatchTag tag)
- {
- if (tag is null) throw new ArgumentNullException(nameof(tag));
- Element.Add(tag.Serialize());
- }
-
- ///
- /// Removes the first found in the with the provided specifier name.
- ///
- /// The tag specifier to remove.
- public void Remove(string specifier)
- {
- if (string.IsNullOrEmpty(specifier)) throw new ArgumentNullException(nameof(specifier));
-
- Element.Elements(L5XName.WatchTag)
- .FirstOrDefault(e => e.Attribute(L5XName.Specifier)?.Value == specifier)?.Remove();
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Elements/Block.cs b/src/L5Sharp/Elements/Block.cs
deleted file mode 100644
index 595d17cd..00000000
--- a/src/L5Sharp/Elements/Block.cs
+++ /dev/null
@@ -1,1056 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-// ReSharper disable InconsistentNaming
-// ReSharper disable IdentifierTypo
-// ReSharper disable CommentTypo
-
-namespace L5Sharp.Core;
-
-///
-/// A DiagramElement type that defines the properties for nested function block elements in a
-/// Function Block Diagram (FBD).
-///
-///
-/// A Block represents a function block within the FBD. These are blocks that represent
-/// specific logix built-in instructions as opposed to AOIs. A Block differs from a Function
-/// in that it requires a backing tag to operate over, whereas a Function represents a simple logic gate or
-/// operation that takes inputs and produces an output without the need for a backing tag.
-///
-///
-[L5XType(L5XName.IRef, L5XName.Sheet)]
-[L5XType(L5XName.ORef, L5XName.Sheet)]
-[L5XType(L5XName.ICon, L5XName.Sheet)]
-[L5XType(L5XName.OCon, L5XName.Sheet)]
-[L5XType(L5XName.Block, L5XName.Sheet)]
-[L5XType(L5XName.Function, L5XName.Sheet)]
-[L5XType(L5XName.AddOnInstruction, L5XName.Sheet)]
-[L5XType(L5XName.JSR, L5XName.Sheet)]
-[L5XType(L5XName.SBR, L5XName.Sheet)]
-[L5XType(L5XName.RET, L5XName.Sheet)]
-public class Block : DiagramElement
-{
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Block(XElement element) : base(element)
- {
- }
-
- ///
- /// The descriptive indication of the location of this within the containing Diagram.
- ///
- /// A indicating the cell and optional sheet or chart number where the block is located.
- ///
- /// This is an internally defined value so that we can identify instructions when referencing components.
- ///
- public override string Location =>
- Sheet is not null ? $"Sheet {Sheet.Number} {Cell} ({X}, {Y})" : $"{Cell} ({X}, {Y})";
-
- ///
- /// Represents the instuction, function, or element type name of the element.
- ///
- /// A containing the block type name.
- ///
- public string Type
- {
- get
- {
- return L5XType switch
- {
- L5XName.Block => Element.Attribute(L5XName.Type)?.Value ?? throw Element.L5XError(L5XName.Type),
- L5XName.Function => Element.Attribute(L5XName.Type)?.Value ?? throw Element.L5XError(L5XName.Type),
- L5XName.AddOnInstruction => Element.Attribute(L5XName.Name)?.Value ??
- throw Element.L5XError(L5XName.Name),
- _ => Element.L5XType(),
- };
- }
- }
-
- ///
- /// Represents the Operand property of a generic function block element. This can be the backing tag name,
- /// reference name, connector name, or routine name depending on the block type.
- ///
- /// Thrown when attempting to set the operand for an unsupported block type.
- /// An object containing the value, which could be a tag name, immediate value, or simple string name.
- ///
- /// Since this class models all the different function block types, this proprty has to determine which attribute
- /// to read/write to internally depending on the type. For IRef, ORef, Block, and AOI blocks, this represents the
- /// Operand tag name. For an ICon and OCOn, this represents the connector Name. For a routine blocks (JSR, SBR, RET),
- /// this represents the Routine name. Note that this is nullable since a Function
- /// block does not have an operand or backing tag property, and therefore attempting to set a value for that block type
- /// will result in an exception.
- ///
- public Argument? Operand
- {
- get
- {
- return L5XType switch
- {
- L5XName.ICon => Element.Attribute(L5XName.Name)?.Value.Parse(),
- L5XName.OCon => Element.Attribute(L5XName.Name)?.Value.Parse(),
- L5XName.JSR => Element.Attribute(L5XName.Routine)?.Value.Parse(),
- L5XName.SBR => Element.Attribute(L5XName.Routine)?.Value.Parse(),
- L5XName.RET => Element.Attribute(L5XName.Routine)?.Value.Parse(),
- _ => Element.Attribute(L5XName.Operand)?.Value.Parse()
- };
- }
- set
- {
- switch (L5XType)
- {
- case L5XName.IRef:
- case L5XName.ORef:
- case L5XName.Block:
- case L5XName.AddOnInstruction:
- Element.SetAttributeValue(L5XName.Operand, value);
- break;
- case L5XName.ICon:
- case L5XName.OCon:
- Element.SetAttributeValue(L5XName.Name, value);
- break;
- case L5XName.JSR:
- case L5XName.SBR:
- case L5XName.RET:
- Element.SetAttributeValue(L5XName.Routine, value);
- break;
- default:
- throw new NotSupportedException($"Block type '{L5XType}' does not support Operand.");
- }
- }
- }
-
- ///
- /// Whether or not to hide the description for the block element.
- ///
- /// true if the description is hidden; Otherwise; false.
- /// This property is only found on IREF, OREF, and Block type elements.
- public bool? HideDesc
- {
- get => GetValue();
- set => SetValue(value);
- }
-
- ///
- /// The pins
- ///
- ///
- public IEnumerable Pins
- {
- get
- {
- return L5XType switch
- {
- L5XName.Block => GetValues(L5XName.VisiblePins),
- L5XName.AddOnInstruction => GetValues(L5XName.VisiblePins),
- L5XName.JSR => GetValues(L5XName.In).Concat(GetValues(L5XName.Ret)),
- L5XName.SBR => GetValues(L5XName.In),
- L5XName.RET => GetValues(L5XName.Ret),
- _ => Enumerable.Empty()
- };
- }
- }
-
- ///
- /// The that this block is contained within.
- ///
- /// A
- public Sheet? Sheet => Element.Parent is not null ? new Sheet(Element.Parent) : default;
-
- ///
- /// Retrieves a collection of tag names that the function block contains.
- ///
- /// A collection of values.
- ///
- /// This is not a underlying block property of the XML but rather a helper that combins the
- /// and to form a set of tag names that can be references by the block.
- ///
- public IEnumerable Tags
- {
- get
- {
- if (Operand is null || !Operand.IsTag) return Enumerable.Empty();
- var tags = new List { (TagName)Operand };
- tags.AddRange(Pins.Select(p => TagName.Concat(Operand.ToString(), p)));
- return tags;
- }
- }
-
- ///
- public override IEnumerable References()
- {
- var references = new List { new(Element, L5XName.Instruction, Type) };
-
- if (Operand is null || !Operand.IsTag)
- return references;
-
- references.Add(new CrossReference(Element, L5XName.Tag, Operand.ToString(), Type));
- references.AddRange(Tags.Select(t => new CrossReference(Element, L5XName.Tag, t, Type)));
- return references;
- }
-
- #region Elements
-
- ///
- /// Creates a new IREF function block element initialized with appropriate values.
- ///
- /// The optional to pass as the operand for the reference. This should
- /// be a tag name or immediate atomic value.
- /// A instance representing the IREF block type.
- public static Block IREF(Argument? operand = null) => NewReference(L5XName.IRef, operand);
-
- ///
- /// Creates a new OREF function block element initialized with appropriate values.
- ///
- /// The optional to pass as the operand for the reference. This should
- /// be a tag name or immediate atomic value.
- /// A instance representing the OREF block type.
- public static Block OREF(Argument? operand = null) => NewReference(L5XName.ORef, operand);
-
- ///
- /// Creates a new ICON function block element initialized with appropriate values.
- ///
- /// The required name of the connector element.
- /// A instance representing the ICON block type.
- public static Block ICON(string name) => NewConnector(L5XName.ICon, name);
-
- ///
- /// Creates a new OCON function block element initialized with appropriate values.
- ///
- /// The required name of the connector element.
- /// A instance representing the OCON block type.
- public static Block OCON(string name) => NewConnector(L5XName.OCon, name);
-
- ///
- /// Creates a new AOI with the provided name, operand, and pins
- ///
- /// The name of the AOI block.
- /// The operand of the block.
- /// The set of pins for the block.
- /// A new instance representing the AOI block type.
- public static Block AOI(string name, TagName? operand = null, params string[] pins) => NewAoi(name, operand, pins);
-
- ///
- /// Creates a new AOI with the provided definition and operand tag name.
- ///
- /// The definition to initialize the block.
- /// The backing tag operand for the block.
- /// A new instance representing the AOI block type.
- public static Block AOI(AddOnInstruction definition, TagName? operand = null) => NewAoi(definition, operand);
-
- ///
- /// Creates a new JSR routine with the provided routine name and optional parmaeters.
- ///
- /// The name of the routine the block calls.
- /// The set of input parmaeters to the routine.
- /// The set of output parmaeters from the routine.
- /// A new instance representing the JSR block type.
- public static Block JSR(string routine, string[]? inputs = null, string[]? outputs = null) =>
- NewRoutine(routine, inputs, outputs);
-
- ///
- /// Creates a new SBR routine with the provided routine name and input parmaeters.
- ///
- /// The name of the routine the block calls.
- /// The set of input parameters to the routine.
- /// A new instance representing the SBR block type.
- public static Block SBR(string routine, params string[] parameters) => NewRoutine(L5XName.SBR, routine, parameters);
-
- ///
- /// Creates a new SBR routine with the provided routine name and input parmaeters.
- ///
- /// The name of the routine the block calls.
- /// The set of output parameters from the routine.
- /// A new instance representing the RET block type.
- public static Block RET(string routine, params string[] parameters) => NewRoutine(L5XName.RET, routine, parameters);
-
- #endregion
-
- #region Blocks
-
- ///
- /// Creates a new ABS function block element with the optional operand tag name.
- ///
- /// The optional tag name to initialize the block with. This will default to the function
- /// name with '_01' appended if not provided.
- /// A object representing the ABS function.
- public static Block ABS(TagName? operand = null) =>
- NewBlock(nameof(ABS), operand, "Source Destination");
-
- ///
- /// Returns a ne ACS Block element with the type initialized.
- ///
- public static Block ACS(TagName? operand = null) =>
- NewBlock(nameof(ACS), operand, "Source Destination");
-
- ///
- /// Returns a ne ADD Block element with the type initialized.
- ///
- public static Block ADD(TagName? operand = null) =>
- NewBlock(nameof(ADD), operand, "SourceA SourceB Destination");
-
- ///
- /// Returns a ne ALM Block element with the type initialized.
- ///
- public static Block ALM(TagName? operand = null) => NewBlock(nameof(ALM), operand,
- "In HHAlarm HAlarm LAlarm LLAlarm ROCPosAlarm ROCNegAlarm");
-
- ///
- /// Returns a new ALMA Block element with the type initialized.
- ///
- public static Block ALMA(TagName? operand = null) => NewBlock(nameof(ALMA), operand,
- "In HHInAlarm HInAlarm LInAlarm LLInAlarm ROCPosInAlarm ROCNegInAlarm HHAcked HAcked LAcked LLAcked ROCPosAcked ROCNegAcked Suppressed Disabled");
-
- ///
- /// Returns a new ALMD Block element with the type initialized.
- ///
- public static Block ALMD(TagName? operand = null) =>
- NewBlock(nameof(ALMD), operand, "In InAlarm Acked Suppressed Disabled");
-
- ///
- /// Returns a ne AND Block element with the type initialized.
- ///
- public static Block AND(TagName? operand = null) =>
- NewBlock(nameof(AND), operand, "SourceA SourceB Destination");
-
- ///
- /// Returns a ne ASN Block element with the type initialized.
- ///
- public static Block ASN(TagName? operand = null) =>
- NewBlock(nameof(ASN), operand, "Source Destination");
-
- ///
- /// Returns a ne ATN Block element with the type initialized.
- ///
- public static Block ATN(TagName? operand = null) =>
- NewBlock(nameof(ATN), operand, "Source Destination");
-
- ///
- /// Returns a new BAND Block element with the type initialized.
- ///
- public static Block BAND(TagName? operand = null) =>
- NewBlock(nameof(BAND), operand, "In1 In2 In3 In4 Out");
-
- ///
- /// Returns a new BNOT Block element with the type initialized.
- ///
- public static Block BNOT(TagName? operand = null) => NewBlock(nameof(BNOT), operand, "In Out");
-
- ///
- /// Returns a ne BOR Block element with the type initialized.
- ///
- public static Block BOR(TagName? operand = null) =>
- NewBlock(nameof(BOR), operand, "In1 In2 In3 In4 Out");
-
- ///
- /// Returns a new BTDT Block element with the type initialized.
- ///
- public static Block BTDT(TagName? operand = null) => NewBlock(nameof(BTDT), operand,
- "Source SourceBit Length DestBit Target Dest");
-
- ///
- /// Returns a new BXOR Block element with the type initialized.
- ///
- public static Block BXOR(TagName? operand = null) => NewBlock(nameof(BXOR), operand, "In1 In2 Out");
-
- ///
- /// Returns a ne COS Block element with the type initialized.
- ///
- public static Block COS(TagName? operand = null) => NewBlock(nameof(COS), operand, "Source Dest");
-
- ///
- /// Returns a new CTUD Block element with the type initialized.
- ///
- public static Block CTUD(TagName? operand = null) =>
- NewBlock(nameof(CTUD), operand, "CUEnable CDEnable PRE Reset ACC DN");
-
- ///
- /// Returns a new D2SD Block element with the type initialized.
- ///
- public static Block D2SD(TagName? operand = null) => NewBlock(nameof(D2SD), operand,
- "ProgCommand State0Perm State1Perm FB0 FB1 HandFB ProgProgReq ProgOperReq ProgOverrideReq ProgHandReq Out Device0State Device1State CommandStatus FaultAlarm ModeAlarm ProgOper Override Hand");
-
- ///
- /// Returns a new D3SD Block element with the type initialized.
- ///
- public static Block D3SD(TagName? operand = null) => NewBlock(nameof(D3SD), operand,
- "Prog0Command Prog1Command Prog2Command State0Perm State1Perm State2Perm FB0 FB1 FB2 FB3 HandFB0 HandFB1 HandFB2 ProgProgReq ProgOperReq ProgOverrideReq ProgHandReq Out0 Out1 Out2 Device0State Device1State Device2State Command0Status Command1Status Command2Status FaultAlarm ModeAlarm ProgOper Override Hand");
-
- ///
- /// Returns a new DEDT Block element with the type initialized.
- ///
- public static Block DEDT(TagName? operand = null) => NewBlock(nameof(DEDT), operand, "In Out");
-
- ///
- /// Returns a ne DEG Block element with the type initialized.
- ///
- public static Block DEG(TagName? operand = null) => NewBlock(nameof(DEG), operand, "Source Dest");
-
- ///
- /// Returns a new DERV Block element with the type initialized.
- ///
- public static Block DERV(TagName? operand = null) =>
- NewBlock(nameof(DERV), operand, "In ByPass Out");
-
- ///
- /// Returns a ne DFF Block element with the type initialized.
- ///
- public static Block DFF(TagName? operand = null) =>
- NewBlock(nameof(DFF), operand, "D Clear Clock Q QNot");
-
- ///
- /// Returns a ne DIV Block element with the type initialized.
- ///
- public static Block DIV(TagName? operand = null) =>
- NewBlock(nameof(DIV), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a new ESEL Block element with the type initialized.
- ///
- public static Block ESEL(TagName? operand = null) => NewBlock(nameof(ESEL), operand,
- "In1 In2 In3 In4 In5 In6 ProgSelector ProgProgReq ProgOperReq ProgOverrideReq Out SelectedIn ProgOper Override");
-
- ///
- /// Returns a ne EQU Block element with the type initialized.
- ///
- public static Block EQU(TagName? operand = null) => NewBlock(nameof(EQU), operand, "SourceA SourceB");
-
- ///
- /// Returns a new FGEN Block element with the type initialized.
- ///
- public static Block FGEN(TagName? operand = null) => NewBlock(nameof(FGEN), operand, "In Out");
-
- ///
- /// Returns a ne FRD Block element with the type initialized.
- ///
- public static Block FRD(TagName? operand = null) => NewBlock(nameof(FRD), operand, "Source Dest");
-
- ///
- /// Returns a ne GEQ Block element with the type initialized.
- ///
- public static Block GEQ(TagName? operand = null) => NewBlock(nameof(GEQ), operand, "SourceA SourceB");
-
- ///
- /// Returns a ne GRT Block element with the type initialized.
- ///
- public static Block GRT(TagName? operand = null) => NewBlock(nameof(GRT), operand, "SourceA SourceB");
-
- ///
- /// Returns a ne HLL Block element with the type initialized.
- ///
- public static Block HLL(TagName? operand = null) =>
- NewBlock(nameof(HLL), operand, "In Out HighAlarm LowAlarm");
-
- ///
- /// Returns a ne HPF Block element with the type initialized.
- ///
- public static Block HPF(TagName? operand = null) => NewBlock(nameof(HPF), operand, "In Out");
-
- ///
- /// Returns a new INTG Block element with the type initialized.
- ///
- public static Block INTG(TagName? operand = null) => NewBlock(nameof(INTG), operand, "In Out");
-
- ///
- /// Returns a new JKFF Block element with the type initialized.
- ///
- public static Block JKFF(TagName? operand = null) =>
- NewBlock(nameof(JKFF), operand, "Clear Clock Q QNot");
-
- ///
- /// Returns a ne LEQ Block element with the type initialized.
- ///
- public static Block LEQ(TagName? operand = null) => NewBlock(nameof(LEQ), operand, "SourceA SourceB");
-
- ///
- /// Returns a ne LES Block element with the type initialized.
- ///
- public static Block LES(TagName? operand = null) => NewBlock(nameof(LES), operand, "SourceA SourceB");
-
- ///
- /// Returns a ne LIM Block element with the type initialized.
- ///
- public static Block LIM(TagName? operand = null) =>
- NewBlock(nameof(LIM), operand, "LowLimit Test HighLimit");
-
- ///
- /// Returns a n LN Block element with the type initialized.
- ///
- public static Block LN(TagName? operand = null) => NewBlock(nameof(LN), operand, "Source Dest");
-
- ///
- /// Returns a ne LOG Block element with the type initialized.
- ///
- public static Block LOG(TagName? operand = null) => NewBlock(nameof(LOG), operand, "Source Dest");
-
- ///
- /// Returns a ne LPF Block element with the type initialized.
- ///
- public static Block LPF(TagName? operand = null) => NewBlock(nameof(LPF), operand, "In Out");
-
- ///
- /// Returns a new MAVE Block element with the type initialized.
- ///
- public static Block MAVE(TagName? operand = null) => NewBlock(nameof(MAVE), operand, "In Out");
-
- ///
- /// Returns a new MAXC Block element with the type initialized.
- ///
- public static Block MAXC(TagName? operand = null) =>
- NewBlock(nameof(MAXC), operand, "In Reset ResetValue Out");
-
- ///
- /// Returns a ne MEQ Block element with the type initialized.
- ///
- public static Block MEQ(TagName? operand = null) =>
- NewBlock(nameof(MEQ), operand, "Source Mask Compare");
-
- ///
- /// Returns a new MINC Block element with the type initialized.
- ///
- public static Block MINC(TagName? operand = null) =>
- NewBlock(nameof(MINC), operand, "In Reset ResetValue Out");
-
- ///
- /// Returns a ne MOD Block element with the type initialized.
- ///
- public static Block MOD(TagName? operand = null) =>
- NewBlock(nameof(MOD), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a new MSTD Block element with the type initialized.
- ///
- public static Block MSTD(TagName? operand = null) =>
- NewBlock(nameof(MSTD), operand, "In SampleEnable Out");
-
- ///
- /// Returns a ne MUL Block element with the type initialized.
- ///
- public static Block MUL(TagName? operand = null) =>
- NewBlock(nameof(MUL), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a ne MUX Block element with the type initialized.
- ///
- public static Block MUX(TagName? operand = null) => NewBlock(nameof(MUX), operand,
- "In1 In2 In3 In4 In5 In6 In7 In8 Selector Out");
-
- ///
- /// Returns a new MVMT Block element with the type initialized.
- ///
- public static Block MVMT(TagName? operand = null) =>
- NewBlock(nameof(MVMT), operand, "Source Mask Target Dest");
-
- ///
- /// Returns a ne NEG Block element with the type initialized.
- ///
- public static Block NEG(TagName? operand = null) => NewBlock(nameof(NEG), operand, "Source Dest");
-
- ///
- /// Returns a ne NEQ Block element with the type initialized.
- ///
- public static Block NEQ(TagName? operand = null) => NewBlock(nameof(NEQ), operand, "SourceA SourceB");
-
- ///
- /// Returns a ne NOT Block element with the type initialized.
- ///
- public static Block NOT(TagName? operand = null) => NewBlock(nameof(NOT), operand, "Source Dest");
-
- ///
- /// Returns a new NTCH Block element with the type initialized.
- ///
- public static Block NTCH(TagName? operand = null) => NewBlock(nameof(NTCH), operand, "In Out");
-
- ///
- /// Returns a n OR Block element with the type initialized.
- ///
- public static Block OR(TagName? operand = null) =>
- NewBlock(nameof(OR), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a new OSFI Block element with the type initialized.
- ///
- public static Block OSFI(TagName? operand = null) =>
- NewBlock(nameof(OSFI), operand, "InputBit OutputBit");
-
- ///
- /// Returns a new OSRI Block element with the type initialized.
- ///
- public static Block OSRI(TagName? operand = null) =>
- NewBlock(nameof(OSRI), operand, "InputBit OutputBit");
-
- ///
- /// Returns a n PI Block element with the type initialized.
- ///
- public static Block PI(TagName? operand = null) => NewBlock(nameof(PI), operand, "In Out");
-
- ///
- /// Returns a new PIDE Block element with the type initialized.
- ///
- public static Block PIDE(TagName? operand = null) => NewBlock(nameof(PIDE), operand,
- "PV SPProg SPCascade RatioProg CVProg FF HandFB ProgProgReq ProgOperReq ProgCasRatReq ProgAutoReq ProgManualReq ProgOverrideReq ProgHandReq CVEU SP PVHHAlarm PVHAlarm PVLAlarm PVLLAlarm PVROCPosAlarm PVROCNegAlarm DevHHAlarm DevHAlarm DevLAlarm DevLLAlarm ProgOper CasRat Auto Manual Override Hand");
-
- ///
- /// Returns a new PMUL Block element with the type initialized.
- ///
- public static Block PMUL(TagName? operand = null) => NewBlock(nameof(PMUL), operand, "In Multiplier Out");
-
- ///
- /// Returns a new POSP Block element with the type initialized.
- ///
- public static Block POSP(TagName? operand = null) => NewBlock(nameof(POSP), operand,
- "SP Position OpenedFB ClosedFB OpenOut CloseOut");
-
- ///
- /// Returns a ne RAD Block element with the type initialized.
- ///
- public static Block RAD(TagName? operand = null) => NewBlock(nameof(RAD), operand, "Source Dest");
-
- ///
- /// Returns a new RESD Block element with the type initialized.
- ///
- public static Block RESD(TagName? operand = null) =>
- NewBlock(nameof(RESD), operand, "Set Reset Out OutNot");
-
- ///
- /// Returns a new RLIM Block element with the type initialized.
- ///
- public static Block RLIM(TagName? operand = null) =>
- NewBlock(nameof(RLIM), operand, "In ByPass Out");
-
- ///
- /// Returns a new RMPS Block element with the type initialized.
- ///
- public static Block RMPS(TagName? operand = null) => NewBlock(nameof(RMPS), operand,
- "PV CurrentSegProg OutProg SoakTimeProg ProgProgReq ProgOperReq ProgAutoReq ProgManualReq ProgHoldReq Out CurrentSeg SoakTimeLeft GuarRampOn GuarSoakOn ProgOper Auto Manual Hold");
-
- ///
- /// Returns a new RTOR Block element with the type initialized.
- ///
- public static Block RTOR(TagName? operand = null) =>
- NewBlock(nameof(RTOR), operand, "TimerEnable PRE Reset ACC DN");
-
- ///
- /// Returns a ne SCL Block element with the type initialized.
- ///
- public static Block SCL(TagName? operand = null) => NewBlock(nameof(SCL), operand, "In Out");
-
- ///
- /// Returns a new SCRV Block element with the type initialized.
- ///
- public static Block SCRV(TagName? operand = null) => NewBlock(nameof(SCRV), operand, "In Out");
-
- ///
- /// Returns a ne SEL Block element with the type initialized.
- ///
- public static Block SEL(TagName? operand = null) =>
- NewBlock(nameof(SEL), operand, "In1 In2 SelectorIn Out");
-
- ///
- /// Returns a new SETD Block element with the type initialized.
- ///
- public static Block SETD(TagName? operand = null) =>
- NewBlock(nameof(SETD), operand, "Set Reset Out OutNot");
-
- ///
- /// Returns a ne SIN Block element with the type initialized.
- ///
- public static Block SIN(TagName? operand = null) =>
- NewBlock(nameof(SIN), operand, "Source Destination");
-
- ///
- /// Returns a new SNEG Block element with the type initialized.
- ///
- public static Block SNEG(TagName? operand = null) =>
- NewBlock(nameof(SNEG), operand, "In NegateEnable Out");
-
- ///
- /// Returns a ne SOC Block element with the type initialized.
- ///
- public static Block SOC(TagName? operand = null) => NewBlock(nameof(SOC), operand, "In Out");
-
- ///
- /// Returns a ne SQR Block element with the type initialized.
- ///
- public static Block SQR(TagName? operand = null) => NewBlock(nameof(SQR), operand, "Source Dest");
-
- ///
- /// Returns a new SRTP Block element with the type initialized.
- ///
- public static Block SRTP(TagName? operand = null) => NewBlock(nameof(SRTP), operand,
- "In HeatOut CoolOut HeatTimePercent CoolTimePercent");
-
- ///
- /// Returns a new SSUM Block element with the type initialized.
- ///
- public static Block SSUM(TagName? operand = null) => NewBlock(nameof(SSUM), operand,
- "In1 Select1 In2 Select2 In3 Select3 In4 Select4 Out");
-
- ///
- /// Returns a ne SUB Block element with the type initialized.
- ///
- public static Block SUB(TagName? operand = null) =>
- NewBlock(nameof(SUB), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a ne TAN Block element with the type initialized.
- ///
- public static Block TAN(TagName? operand = null) => NewBlock(nameof(TAN), operand, "Source Dest");
-
- ///
- /// Returns a ne TOD Block element with the type initialized.
- ///
- public static Block TOD(TagName? operand = null) => NewBlock(nameof(TOD), operand, "Source Dest");
-
- ///
- /// Returns a new TOFR Block element with the type initialized.
- ///
- public static Block TOFR(TagName? operand = null) =>
- NewBlock(nameof(TOFR), operand, "TimerEnable PRE Reset ACC DN");
-
- ///
- /// Returns a new TONR Block element with the type initialized.
- ///
- public static Block TONR(TagName? operand = null) =>
- NewBlock(nameof(TONR), operand, "TimerEnable PRE Reset ACC DN");
-
- ///
- /// Returns a ne TOT Block element with the type initialized.
- ///
- public static Block TOT(TagName? operand = null) => NewBlock(nameof(TOT), operand,
- "In ProgProgReq ProgOperReq ProgStartReq ProgStopReq ProgResetReq Total OldTotal ProgOper RunStop ProgResetDone TargetFlag TargetDev1Flag TargetDev2Flag");
-
- ///
- /// Returns a ne TRN Block element with the type initialized.
- ///
- public static Block TRN(TagName? operand = null) => NewBlock(nameof(TRN), operand, "Source Dest");
-
- ///
- /// Returns a new UPDN Block element with the type initialized.
- ///
- public static Block UPDN(TagName? operand = null) =>
- NewBlock(nameof(UPDN), operand, "InPlus InMinus Out");
-
- ///
- /// Returns a ne XOR Block element with the type initialized.
- ///
- public static Block XOR(TagName? operand = null) =>
- NewBlock(nameof(XOR), operand, "SourceA SourceB Dest");
-
- ///
- /// Returns a ne XPY Block element with the type initialized.
- ///
- public static Block XPY(TagName? operand = null) =>
- NewBlock(nameof(XPY), operand, "SourceA SourceB Dest");
-
- #endregion
-
- #region Functions
-
- ///
- /// Creates a new ABS__F function block element initialized with appropriate values.
- ///
- /// A instance representing the ABS__F function block.
- public static Block ABS__F() => NewFunction(nameof(ABS__F));
-
- ///
- /// Creates a new ADD__F function block element initialized with appropriate values.
- ///
- /// A instance representing the ADD__F function block.
- public static Block ADD__F() => NewFunction(nameof(ADD__F));
-
- ///
- /// Creates a new BAND__F function block element initialized with appropriate values.
- ///
- /// A instance representing the BAND__F function block.
- public static Block BAND__F() => NewFunction(nameof(BAND__F));
-
- ///
- /// Creates a new BNOT__F function block element initialized with appropriate values.
- ///
- /// A instance representing the BNOT__F function block.
- public static Block BNOT__F() => NewFunction(nameof(BNOT__F));
-
- ///
- /// Creates a new BXOR__F function block element initialized with appropriate values.
- ///
- /// A instance representing the BXOR__F function block.
- public static Block BXOR__F() => NewFunction(nameof(BXOR__F));
-
- ///
- /// Creates a new DIV__F function block element initialized with appropriate values.
- ///
- /// A instance representing the DIV__F function block.
- public static Block DIV__F() => NewFunction(nameof(DIV__F));
-
- ///
- /// Creates a new EQU__F function block element initialized with appropriate values.
- ///
- /// A instance representing the EQU__F function block.
- public static Block EQU__F() => NewFunction(nameof(EQU__F));
-
- ///
- /// Creates a new GEQ__F function block element initialized with appropriate values.
- ///
- /// A instance representing the GEQ__F function block.
- public static Block GEQ__F() => NewFunction(nameof(GEQ__F));
-
- ///
- /// Creates a new GRT__F function block element initialized with appropriate values.
- ///
- /// A instance representing the GRT__F function block.
- public static Block GRT__F() => NewFunction(nameof(GRT__F));
-
- ///
- /// Creates a new LEQ__F function block element initialized with appropriate values.
- ///
- /// A instance representing the LEQ__F function block.
- public static Block LEQ__F() => NewFunction(nameof(LEQ__F));
-
- ///
- /// Creates a new LES__F function block element initialized with appropriate values.
- ///
- /// A instance representing the LES__F function block.
- public static Block LES__F() => NewFunction(nameof(LES__F));
-
- ///
- /// Creates a new LIM__F function block element initialized with appropriate values.
- ///
- /// A instance representing the LIM__F function block.
- public static Block LIM__F() => NewFunction(nameof(LIM__F));
-
- ///
- /// Creates a new MEQ__F function block element initialized with appropriate values.
- ///
- /// A instance representing the MEQ__F function block.
- public static Block MEQ__F() => NewFunction(nameof(MEQ__F));
-
- ///
- /// Creates a new MOD__F function block element initialized with appropriate values.
- ///
- /// A instance representing the MOD__F function block.
- public static Block MOD__F() => NewFunction(nameof(MOD__F));
-
- ///
- /// Creates a new MUL__F function block element initialized with appropriate values.
- ///
- /// A instance representing the MUL__F function block.
- public static Block MUL__F() => NewFunction(nameof(MUL__F));
-
- ///
- /// Creates a new NEG__F function block element initialized with appropriate values.
- ///
- /// A instance representing the NEG__F function block.
- public static Block NEG__F() => NewFunction(nameof(NEG__F));
-
- ///
- /// Creates a new NEQ__F function block element initialized with appropriate values.
- ///
- /// A instance representing the NEQ__F function block.
- public static Block NEQ__F() => NewFunction(nameof(NEQ__F));
-
- ///
- /// Creates a new SQR__F function block element initialized with appropriate values.
- ///
- /// A instance representing the SQR__F function block.
- public static Block SQR__F() => NewFunction(nameof(SQR__F));
-
- ///
- /// Creates a new SUB__F function block element initialized with appropriate values.
- ///
- /// A instance representing the SUB__F function block.
- public static Block SUB__F() => NewFunction(nameof(SUB__F));
-
- #endregion
-
- #region Internal
-
- private static Block NewReference(string type, Argument? operand = null)
- {
- var element = new XElement(type);
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Operand, operand ?? Argument.Empty));
- return new Block(element);
- }
-
- private static Block NewConnector(string type, string name)
- {
- var element = new XElement(type);
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Name, name));
- return new Block(element);
- }
-
- private static Block NewBlock(string type, TagName? operand = null, string? pins = null)
- {
- var element = new XElement(L5XName.Block);
- element.Add(new XAttribute(L5XName.Type, type));
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Operand, operand ?? $"{type}_01"));
- element.Add(new XAttribute(L5XName.VisiblePins, pins ?? string.Empty));
- return new Block(element);
- }
-
- private static Block NewFunction(string type)
- {
- var element = new XElement(L5XName.Function);
- element.Add(new XAttribute(L5XName.Type, type));
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- return new Block(element);
- }
-
- private static Block NewAoi(string type, TagName? operand = null, params string[] pins)
- {
- var element = new XElement(L5XName.AddOnInstruction);
- element.Add(new XAttribute(L5XName.Name, type));
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Operand, operand ?? Argument.Empty));
- element.Add(new XAttribute(L5XName.VisiblePins, string.Join(' ', pins) ?? string.Empty));
- return new Block(element);
- }
-
- private static Block NewAoi(AddOnInstruction definition, TagName? operand = null)
- {
- var element = new XElement(L5XName.AddOnInstruction);
- element.Add(new XAttribute(L5XName.Name, definition.Name));
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Operand, operand ?? Argument.Empty));
-
- var pins = string.Join(' ', definition.Parameters.Where(p => p.Visible == true).Select(p => p.Name));
- element.Add(new XAttribute(L5XName.VisiblePins, pins));
-
- return new Block(element);
- }
-
- private static Block NewRoutine(string routine, string[]? inputs = null, string[]? outputs = null)
- {
- var element = new XElement(L5XName.JSR);
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Routine, routine));
- element.Add(new XAttribute(L5XName.In, string.Join(' ', inputs) ?? string.Empty));
- element.Add(new XAttribute(L5XName.Ret, string.Join(' ', outputs) ?? string.Empty));
- return new Block(element);
- }
-
- private static Block NewRoutine(string type, string routine, params string[] parameters)
- {
- var element = new XElement(type);
- element.Add(new XAttribute(L5XName.ID, 0));
- element.Add(new XAttribute(L5XName.X, 0));
- element.Add(new XAttribute(L5XName.Y, 0));
- element.Add(new XAttribute(L5XName.Routine, routine));
- element.Add(new XAttribute(L5XName.VisiblePins, string.Join(' ', parameters) ?? string.Empty));
- return new Block(element);
- }
-
- private IEnumerable> Endpoints(string? param = null)
- {
- if (Sheet is null) return Enumerable.Empty>();
-
- var arguments = new List>();
-
- arguments.AddRange(GetInputs(Sheet, param));
- arguments.AddRange(GetOutputs(Sheet, param));
-
- return arguments;
- }
-
- private IEnumerable> GetInputs(Sheet sheet, string? param)
- {
- var arguments = new List>();
-
- var inputs = sheet.Wires().Where(w => w.IsTo(ID, param));
-
- foreach (var wire in inputs)
- {
- var block = sheet.Block(wire.FromID);
- if (block is null) continue;
-
- if (block.Type == L5XName.OCon)
- {
- arguments.AddRange(GetPair()?.Endpoints() ?? Enumerable.Empty>());
- continue;
- }
-
- var arg = block.GetArguments(wire.FromParam);
- arguments.Add(new KeyValuePair(arg, block.Type));
- }
-
- return arguments;
- }
-
- private IEnumerable> GetOutputs(Sheet sheet, string? param)
- {
- var arguments = new List>();
-
- var wires = sheet.Wires().Where(w => w.IsFrom(ID, param));
-
- foreach (var wire in wires)
- {
- var block = sheet.Block(wire.ToID);
- if (block is null) continue;
-
- if (block.Type == L5XName.ICon)
- {
- arguments.AddRange(GetPair()?.Endpoints() ?? Enumerable.Empty>());
- continue;
- }
-
- var arg = block.GetArguments(wire.ToParam);
- arguments.Add(new KeyValuePair(arg, block.Type));
- }
-
- return arguments;
- }
-
- private TagName GetArguments(string? param = null)
- {
- var operand = Operand is not null && Operand.IsTag ? new TagName(Operand.ToString()) : TagName.Empty;
- var parameter = param is not null ? new TagName(param) : TagName.Empty;
- return TagName.Concat(operand, parameter);
-
- /*return L5XType switch
- {
- L5XName.IRef => Operand is not null && Operand.IsTag ? (TagName)Operand : TagName.Empty,
- L5XName.ORef => Operand is not null && Operand.IsTag ? (TagName)Operand : TagName.Empty,
- L5XName.Block => Operand is not null && param is not null ? TagName.Concat(Operand.ToString(), param) : TagName.Empty,
- L5XName.Function => param is not null ? new TagName(param) : Argument.Empty,
- L5XName.AddOnInstruction => new[]
- {
- Operand is not null && param is not null ? TagName.Concat(Operand.ToString(), param) : Argument.Empty
- },
- L5XName.JSR => new[] { param is not null ? new TagName(param) : Argument.Empty },
- L5XName.SBR => new[] { param is not null ? new TagName(param) : Argument.Empty },
- L5XName.RET => new[] { param is not null ? new TagName(param) : Argument.Empty },
- _ => new[] { Argument.Empty }
- };*/
- }
-
- ///
- /// Gets the connector block (ICON/OCON) that is the pair/compliment to this connector block.
- ///
- private Block? GetPair() => Sheet?.Blocks().FirstOrDefault(b => b.ID != ID && Equals(b.Operand, Operand));
-
- #endregion
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Elements/Chart.cs b/src/L5Sharp/Elements/Chart.cs
deleted file mode 100644
index 98b3f682..00000000
--- a/src/L5Sharp/Elements/Chart.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// Represents the containing element for Sequential Function Chart (SFC) block elements. This class inherits
-/// the common logic and allows easier manipulation for SFC elements
-/// within a SFC type routine.
-///
-public class Chart : Diagram
-{
- ///
- /// Creates a new with default values.
- ///
- public Chart()
- {
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// block is null.
- public Chart(XElement element) : base(element)
- {
- }
-
- ///
- public override int Number => 0;
-
- ///
- public override IEnumerable References() => Enumerable.Empty();
-
- ///
- protected override IEnumerable Ordering()
- {
- return new List
- {
- L5XName.Step,
- L5XName.Transition,
- L5XName.Condition,
- L5XName.SbrRet,
- L5XName.Stop,
- L5XName.Branch,
- L5XName.DirectedLink,
- L5XName.TextBox,
- L5XName.Attachment
- };
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Elements/Communications.cs b/src/L5Sharp/Elements/Communications.cs
deleted file mode 100644
index 99e2616b..00000000
--- a/src/L5Sharp/Elements/Communications.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///
-/// A component of a that represents the properties and data of the connection to the field device.
-///
-public class Communications : LogixElement
-{
- ///
- /// Creates a new with default values.
- ///
- public Communications()
- {
- Element.Add(new XElement(L5XName.ConfigTag));
- Connections = new LogixContainer();
- }
-
- ///
- /// Creates a new initialized with the provided .
- ///
- /// The to initialize the type with.
- /// element is null.
- public Communications(XElement element) : base(element)
- {
- }
-
- ///
- /// A Tag component containing the configuration data for the module.
- ///
- /// A component representing the complex module defined data structure.
- public Tag? ConfigTag
- {
- get => GetComplex();
- set => SetComplex(value);
- }
-
- ///
- /// A collection of defining the input and output connection specific to the module.
- ///
- /// A of objects.
- ///
- /// Each connection may contain input or output tag structures, as well as several other configuration properties.
- ///
- public LogixContainer Connections
- {
- get => GetContainer();
- set => SetContainer(value);
- }
-}
\ No newline at end of file
diff --git a/src/L5Sharp/Elements/Connection.cs b/src/L5Sharp/Elements/Connection.cs
deleted file mode 100644
index 8201ec62..00000000
--- a/src/L5Sharp/Elements/Connection.cs
+++ /dev/null
@@ -1,197 +0,0 @@
-using System;
-using System.Xml.Linq;
-
-namespace L5Sharp.Core;
-
-///