Server.Gumps.AdminGump.AccountComparer.Compare C# (CSharp) Méthode

Compare() public méthode

public Compare ( object x, object y ) : int
x object
y object
Résultat int
			public int Compare( object x, object y )
			{
				if ( x == null && y == null )
					return 0;
				else if ( x == null )
					return -1;
				else if ( y == null )
					return 1;

				Account a = x as Account;
				Account b = y as Account;

				if ( a == null || b == null )
					throw new ArgumentException();

				AccessLevel aLevel, bLevel;
				bool aOnline, bOnline;

				GetAccountInfo( a, out aLevel, out aOnline );
				GetAccountInfo( b, out bLevel, out bOnline );

				if ( aOnline && !bOnline )
					return -1;
				else if ( bOnline && !aOnline )
					return 1;
				else if ( aLevel > bLevel )
					return -1;
				else if ( aLevel < bLevel )
					return 1;
				else
					return Insensitive.Compare( a.Username, b.Username );
			}
		}
AdminGump.AccountComparer