// Decompiled with JetBrains decompiler
// Type: ListViewSorter.ListViewColumnSorter
// Assembly: FileCash_v3.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 1DECC99D-34C5-4E02-A85D-DC744B5C555A
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Constructor.MSIL.ArchSMS.a-33cc8dceb24ed9df287e1f92d02773477af42b8d2b6de53a45bb9b5a3ead070b.exe

using System.Collections;
using System.Windows.Forms;

namespace ListViewSorter
{
  public class ListViewColumnSorter : IComparer
  {
    private int ColumnToSort;
    private SortOrder OrderOfSort;
    private NumberCaseInsensitiveComparer ObjectCompare;
    private ImageTextComparer FirstObjectCompare;

    public ListViewColumnSorter()
    {
      this.ColumnToSort = 0;
      this.OrderOfSort = SortOrder.Ascending;
      this.ObjectCompare = new NumberCaseInsensitiveComparer();
      this.FirstObjectCompare = new ImageTextComparer();
    }

    public int Compare(object x, object y)
    {
      ListViewItem listViewItem1 = (ListViewItem) x;
      ListViewItem listViewItem2 = (ListViewItem) y;
      int num = this.ColumnToSort != 0 ? this.ObjectCompare.Compare((object) listViewItem1.SubItems[this.ColumnToSort].Text, (object) listViewItem2.SubItems[this.ColumnToSort].Text) : this.FirstObjectCompare.Compare(x, y);
      if (this.OrderOfSort == SortOrder.Ascending)
        return num;
      return this.OrderOfSort == SortOrder.Descending ? -num : 0;
    }

    public int SortColumn
    {
      set => this.ColumnToSort = value;
      get => this.ColumnToSort;
    }

    public SortOrder Order
    {
      set => this.OrderOfSort = value;
      get => this.OrderOfSort;
    }
  }
}
