8
8
*/
9
9
#endregion
10
10
11
- using System . Collections . Generic ;
11
+ using System . Collections . Generic ;
12
+ using System ;
13
+ using System . Drawing ;
12
14
13
15
namespace OpenRA . FileFormats
14
16
{
@@ -23,8 +25,8 @@ public Pair(T first, U second)
23
25
Second = second ;
24
26
}
25
27
26
- static IEqualityComparer < T > tc = EqualityComparer < T > . Default ;
27
- static IEqualityComparer < U > uc = EqualityComparer < U > . Default ;
28
+ internal static IEqualityComparer < T > tc = EqualityComparer < T > . Default ;
29
+ internal static IEqualityComparer < U > uc = EqualityComparer < U > . Default ;
28
30
29
31
public static bool operator == ( Pair < T , U > a , Pair < T , U > b )
30
32
{
@@ -55,16 +57,26 @@ public override int GetHashCode()
55
57
public static T AsFirst ( Pair < T , U > p ) { return p . First ; }
56
58
public static U AsSecond ( Pair < T , U > p ) { return p . Second ; }
57
59
58
- public Pair < U , T > Swap ( ) { return Pair . New ( Second , First ) ; }
59
-
60
60
public override string ToString ( )
61
61
{
62
62
return "({0},{1})" . F ( First , Second ) ;
63
63
}
64
64
}
65
65
66
66
public static class Pair
67
- {
68
- public static Pair < T , U > New < T , U > ( T t , U u ) { return new Pair < T , U > ( t , u ) ; }
67
+ {
68
+ public static Pair < T , U > New < T , U > ( T t , U u ) { return new Pair < T , U > ( t , u ) ; }
69
+
70
+ static Pair ( )
71
+ {
72
+ Pair < char , Color > . uc = new ColorEqualityComparer ( ) ;
73
+ }
74
+
75
+ // avoid the default crappy one
76
+ class ColorEqualityComparer : IEqualityComparer < Color >
77
+ {
78
+ public bool Equals ( Color x , Color y ) { return x . ToArgb ( ) == y . ToArgb ( ) ; }
79
+ public int GetHashCode ( Color obj ) { return obj . GetHashCode ( ) ; }
80
+ }
69
81
}
70
82
}
0 commit comments