private int calcLength(ISegmentItem aItem, int aMax, int aStart, int aLength) { int lResult = aItem.SegAddress - aStart + aItem.SegLength; int lDiv = lResult / (int)mFrameSize; if ((lResult % mFrameSize) > 0) { lDiv = lDiv + 1; } lResult = (int)mFrameSize * lDiv; if (aStart + lResult - 1 > aMax) { lResult = aMax - aStart + 1; } return(lResult); }
public void addItem(string aArea, ISegmentItem aItem) { if (Enabled == false) { return; } int lStart = aItem.SegAddress; int lLength = aItem.SegLength; int lMax = lStart + lLength - 1; if (mAreas.ContainsKey(aArea) == false) { mAreas.Add(aArea, new SortedDictionary <int, List <ISegmentItem> >()); mCount.Add(aArea, 0); mMax.Add(aArea, lMax); } if (mAreas[aArea].ContainsKey(lStart) == false) { mAreas[aArea].Add(lStart, new List <ISegmentItem>()); } mAreas[aArea][lStart].Add(aItem); mCount[aArea] = mCount[aArea] + 1; if (mMax[aArea] < lMax) { mMax[aArea] = lMax; } }