internal static GXSNInfo FindSNObject(GXDLMSObjectCollection items, int sn)
{
GXSNInfo i = new GXSNInfo();
int offset, count;
foreach (GXDLMSObject it in items)
{
if (sn >= it.ShortName)
{
//If attribute is accessed.
if (sn < it.ShortName + (it as IGXDLMSBase).GetAttributeCount() * 8)
{
i.IsAction = false;
i.Item = it;
i.Index = ((sn - i.Item.ShortName) / 8) + 1;
break;
}
else
{
//If method is accessed.
GXDLMS.GetActionInfo(it.ObjectType, out offset, out count);
if (sn < it.ShortName + offset + (8 * count))
{
i.Item = it;
i.IsAction = true;
i.Index = (sn - it.ShortName - offset) / 8 + 1;
break;
}
}
}
}
return i;
}