707 {
709 int indexMax = list.Count() - 1;
710 int indexMin = 0;
711 int targetIndex = Math.Floor( indexMax / 2 );
712 int comparisonMultiplier = 1;
713
714
715 if (isDescending == true)
716 {
717 comparisonMultiplier = -1;
718 }
719
720 if ( indexMax == -1 )
721 {
722 list.Insert( entry );
723 return 0;
724 }
725
726 while ( true )
727 {
728 int comparisonResult = comparisonMultiplier * entry.
CompareTo(list[targetIndex], sortType);
729
730 if ((indexMax - indexMin) <= 1)
731 {
732 for (int i = indexMin; i <= indexMax; i++ )
733 {
734 comparisonResult = comparisonMultiplier * entry.
CompareTo(list[i], sortType);
735
736 if ( comparisonResult > 0 )
737 {
738 list.InsertAt( entry, i );
739 return i;
740 }
741 }
742
743
744 targetIndex = Math.Min(indexMax + 1, list.Count());
745 list.InsertAt(entry, targetIndex);
746 return targetIndex;
747 }
748
749 if (comparisonResult == 0)
750 {
751 list.InsertAt(entry, targetIndex);
752 return targetIndex;
753 }
754
755 if (comparisonResult > 0)
756 {
757 indexMax = targetIndex;
758 }
759
760 else if (comparisonResult < 0)
761 {
762 indexMin = targetIndex;
763 }
764
765 targetIndex = indexMin + Math.Floor((indexMax - indexMin) / 2);
766 }
767
768 return 0;
769 }
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
int CompareTo(GetServersResultRow other, ESortType sortType)