private void Resort()
{
Array.Sort(Entries, 0, EntryCnt, new GenericComparer <DirCacheEntry>(DirCache.EntryComparer));
for (int entryIdx = 1; entryIdx < EntryCnt; entryIdx++)
{
DirCacheEntry pe = Entries[entryIdx - 1];
DirCacheEntry ce = Entries[entryIdx];
int cr = DirCache.Compare(pe, ce);
if (cr == 0)
{
// Same file path; we can only allow this if the stages
// are 1-3 and no 0 exists.
//
int peStage = pe.getStage();
int ceStage = ce.getStage();
if (peStage == ceStage)
{
throw Bad(ce, "Duplicate stages not allowed");
}
if (peStage == 0 || ceStage == 0)
{
throw Bad(ce, "Mixed stages not allowed");
}
}
}
_sorted = true;
}