Skip to content

Instantly share code, notes, and snippets.

@Grigorov-
Created November 12, 2015 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grigorov-/d98e2a872e4241e65ca2 to your computer and use it in GitHub Desktop.
Save Grigorov-/d98e2a872e4241e65ca2 to your computer and use it in GitHub Desktop.
var devices = this.ToXTypedElementBooking();
var devicePairs = this.EnumerateAllDevicePairs().ToArray();
var xmlData = new IGEXAO_PIN_BOOKING()
{
Device = this.ConnectorPairsByTag
.SelectMany(connectorPair =>
{
return connectorPair.Value.DevicePairs
.SelectMany(dp =>
{
var pair = (dp.Value as DevicePair);
var pairRecord = new[] { pair.Side1, pair.Side2 };
return pairRecord.Select(device =>
{
return new ctDevice()
{
FullTag = device.Tag,
Pin = device.PinsByName.Select(pin =>
{
var deviceSide = pairRecord[0] == device ? DeviceSide.Left : DeviceSide.Right;
var pinID = FullDeviceIdManipulations.GetConnectorPairId(this.Tag, connectorPair.Value.Tag)
.Concat(new[] { FullDeviceIdManipulations.ToPartIdFragment(device, deviceSide) })
.Concat(new[] { FullDeviceIdManipulations.ToPartIdFragment(pin.Value, deviceSide) });
var assignNets = GetAssignedNetsToPin(pinID);
return new ctPin()
{
Name = pin.Value.Name,
Rule = new List<ctRule>()
{
new ctRule()
{
Status = RuleStatus,
Validity = validity,
Criteria = new ctCriteria()
{
FunctionalGroup = assignNets.Select(assNet =>
new tCriteriaType()
{
Value = string.Format("{0};{1}",
assNet.Key.FunctionGroupLevel1, assNet.Key.FunctionGroupLevel2)
}).ToList()
}
},
}
};
}).ToList(),
};
}).ToList();
});
}).ToList(),
};
return xmlData.Untyped;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment