public CableInfo(WireCore wire, string lengthAttribute) { Id = wire.Id; Name = wire.Name; Type = String.Intern(wire.WireType); Length = wire.GetAttributeValue(lengthAttribute); Length = String.IsNullOrEmpty(Length) ? "0 м" : Length + " м"; Signals = new List<string>(); }
public ConnectionInfo(int startPinId, int endPinId, string signal, NormalDevice device, DevicePin devicePin, Core core, WireCore wire) { devicePin.Id = startPinId; pinFrom = String.Intern(devicePin.Name); this.signal = signal; List<int> startPinCoreIds = devicePin.CoreIds; device.Id = startPinId; deviceFrom = device.Name; assignmentFrom = String.Intern(device.Assignment); locationFrom = device.Location; devicePin.Id = endPinId; pinTo = String.Intern(devicePin.Name); List<int> endPinCoreIds = devicePin.CoreIds; device.Id = endPinId; deviceTo = device.Name; assignmentTo = String.Intern(device.Assignment); locationTo = device.Location; conductorName = String.Empty; type = String.Empty; if (startPinCoreIds.Count > 0 && endPinCoreIds.Count > 0) { List<int> intersection = startPinCoreIds.Intersect<int>(endPinCoreIds).ToList<int>(); if (intersection.Count == 1) { core.Id = intersection[0]; device.Id = intersection[0]; if (device.IsCable()) { conductorName = device.Name; type = String.Intern(device.ComponentName); } if (device.IsWireGroup()) { wire.Id = intersection[0]; conductorName = wire.Name; type = String.Intern(wire.WireType); } } } }