Пример #1
0
        private static IEnumerable <OffsetMark> GetOffsetMarks(IEnumerable <DeviceGroupDef> deviceGroupDefs,
                                                               DeviceDef deviceDef)
        {
            if (!deviceDef.OffsetDefCollection.Any())
            {
                var total = deviceGroupDefs.Single(x => x.Name == deviceDef.GroupName).Total;
                return(new[]
                {
                    new OffsetMark()
                    {
                        Total = total,
                        Prefix = 0,
                        Suffix = 0,
                    }
                });
            }

            var offsetMarks = from def in deviceDef.OffsetDefCollection
                              let total = deviceGroupDefs.Single(x => x.Name == def.GroupName).Total
                                          select new OffsetMark()
            {
                Total  = total,
                Prefix = def.Prefix,
                Suffix = def.Suffix,
            };

            return(offsetMarks.ToList());
        }
Пример #2
0
 public IList <int> GetOffsets(DeviceDef deviceDef)
 {
     return(_offsetsSet[deviceDef]);
 }
Пример #3
0
 public int GetOffset(DeviceDef deviceDef, int globalIndex)
 {
     return(_offsetsSet[deviceDef][globalIndex]);
 }