tools/profiler/csharp/Comparators.cs
author Nicholas Hastings <skamonkey@gmail.com>
Tue May 14 11:27:06 2013 -0400 (2013-05-14)
changeset 3918 312fa627bf21
parent 1908 318e0a01aef9
permissions -rw-r--r--
Fixed SDKTools dota build.
     1 using System;
     2 using System.Collections;
     3 using System.Text;
     4 using System.Windows.Forms;
     5 
     6 namespace profviewer
     7 {
     8     class LIStringComparator : IComparer
     9     {
    10         private int m_col;
    11 
    12         public LIStringComparator(int col)
    13         {
    14             m_col = col;
    15         }
    16 
    17         public int Compare(object x, object y)
    18         {
    19             ListViewItem a = (ListViewItem)x;
    20             ListViewItem b = (ListViewItem)y;
    21 
    22             return String.Compare(a.SubItems[m_col].Text, b.SubItems[m_col].Text);
    23         }
    24     }
    25 
    26     class LIIntComparator : IComparer
    27     {
    28         private int m_col;
    29 
    30         public LIIntComparator(int col)
    31         {
    32             m_col = col;
    33         }
    34 
    35         public int Compare(object x, object y)
    36         {
    37             ListViewItem a = (ListViewItem)x;
    38             ListViewItem b = (ListViewItem)y;
    39 
    40             int num1 = Int32.Parse(a.SubItems[m_col].Text);
    41             int num2 = Int32.Parse(b.SubItems[m_col].Text);
    42 
    43             if (num1 > num2)
    44             {
    45                 return -1;
    46             }
    47             else if (num1 < num2)
    48             {
    49                 return 1;
    50             }
    51 
    52             return 0;
    53         }
    54     }
    55 
    56     class LIDoubleComparator : IComparer
    57     {
    58         private int m_col;
    59 
    60         public LIDoubleComparator(int col)
    61         {
    62             m_col = col;
    63         }
    64 
    65         public int Compare(object x, object y)
    66         {
    67             ListViewItem a = (ListViewItem)x;
    68             ListViewItem b = (ListViewItem)y;
    69 
    70             double num1 = Double.Parse(a.SubItems[m_col].Text);
    71             double num2 = Double.Parse(b.SubItems[m_col].Text);
    72 
    73             if (num1 > num2)
    74             {
    75                 return -1;
    76             }
    77             else if (num1 < num2)
    78             {
    79                 return 1;
    80             }
    81 
    82             return 0;
    83         }
    84     }
    85 }