public int Compare(object o1, object o2) { Level2Map level2Map = (Level2Map)o1; Level2Map level2Map2 = (Level2Map)o2; return((int)(level2Map.Source - level2Map2.Source)); }
public int Compare (object o1, object o2) { Level2Map m1 = (Level2Map) o1; Level2Map m2 = (Level2Map) o2; return (m1.Source - m2.Source); }
unsafe public static void BuildTailoringTables (CultureInfo culture, TailoringInfo t, ref Contraction [] contractions, ref Level2Map [] diacriticals) { // collect tailoring entries. ArrayList cmaps = new ArrayList (); ArrayList dmaps = new ArrayList (); fixed (char* tarr = tailoringArr){ int idx = t.TailoringIndex; int end = idx + t.TailoringCount; while (idx < end) { int ss = idx + 1; char [] src = null; switch (tarr [idx]) { case '\x1': // SortKeyMap idx++; while (tarr [ss] != 0) ss++; src = new char [ss - idx]; // Array.Copy (tarr, idx, src, 0, ss - idx); Marshal.Copy ((IntPtr) (tarr + idx), src, 0, ss - idx); byte [] sortkey = new byte [4]; for (int i = 0; i < 4; i++) sortkey [i] = (byte) tarr [ss + 1 + i]; cmaps.Add (new Contraction ( src, null, sortkey)); // it ends with 0 idx = ss + 6; break; case '\x2': // DiacriticalMap dmaps.Add (new Level2Map ( (byte) tarr [idx + 1], (byte) tarr [idx + 2])); idx += 3; break; case '\x3': // ReplacementMap idx++; while (tarr [ss] != 0) ss++; src = new char [ss - idx]; // Array.Copy (tarr, idx, src, 0, ss - idx); Marshal.Copy ((IntPtr) (tarr + idx), src, 0, ss - idx); ss++; int l = ss; while (tarr [l] != 0) l++; string r = new string (tarr, ss, l - ss); cmaps.Add (new Contraction ( src, r, null)); idx = l + 1; break; default: throw new NotImplementedException (String.Format ("Mono INTERNAL ERROR (Should not happen): Collation tailoring table is broken for culture {0} ({1}) at 0x{2:X}", culture.LCID, culture.Name, idx)); } } } cmaps.Sort (ContractionComparer.Instance); dmaps.Sort (Level2MapComparer.Instance); contractions = cmaps.ToArray (typeof (Contraction)) as Contraction []; diacriticals = dmaps.ToArray (typeof (Level2Map)) as Level2Map []; }