MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / ResourceListViewSorter

Class ResourceListViewSorter

PerformanceMonitor/MainForm.cs:16–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 public partial class MainForm : Form
15 {
16 class ResourceListViewSorter : System.Collections.IComparer
17 {
18 public bool Descending { get; set; }
19
20 public int Column { get; set; }
21
22 public int Compare(object x, object y)
23 {
24 int tempInt;
25
26 ListViewItem lx = (ListViewItem)x;
27 ListViewItem ly = (ListViewItem)y;
28
29 if (Column == 3)
30 {
31 double dx = Convert.ToDouble(lx.SubItems[Column].Text);
32 double dy = Convert.ToDouble(ly.SubItems[Column].Text);
33 if (dx < dy)
34 tempInt = -1;
35 else if (dx == dy)
36 tempInt = 0;
37 else
38 tempInt = 1;
39 }
40 else
41 tempInt = String.Compare(lx.SubItems[Column].Text, ly.SubItems[Column].Text);
42
43 if (Descending)
44 return -tempInt;
45 else
46 return tempInt;
47 }
48
49 public ResourceListViewSorter()
50 {
51 Column = 0;
52 }
53
54 public ResourceListViewSorter(int column)
55 {
56 Column = column;
57 Descending = true;
58 }
59 }
60
61 struct PerformanceData
62 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected