Exemplo n.º 1
0
        /// <summary>
        /// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison.
        /// </summary>
        /// <param name="x">First object to be compared</param>
        /// <param name="y">Second object to be compared</param>
        /// <returns>The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y'</returns>
        public int Compare(object x, object y)
        {
            //int compareResult;
            ListViewItemExtended listviewX, listviewY;

            // Cast the objects to be compared to ListViewItem objects
            listviewX = (ListViewItemExtended)x;
            listviewY = (ListViewItemExtended)y;

            // Compare the two items

            CustomFileItem cashItemX = listviewX.CustomFileItem;
            CustomFileItem cashItemY = (CustomFileItem)listviewY.CustomFileItem;


            //TODO
            //If dir then return -1
            //if file
            //  if both x and y are files, and if  asc return 1, if desc return -1
            //if(OrderOfSort == SortOrder.Ascending)
            //{
            //    if (cashItemY.IsFolder) return 1;
            //}

            //if (OrderOfSort == SortOrder.Descending)
            //{
            if (cashItemX.IsFolder)
            {
                return(-1);
            }
            //}
            return(1);
        }
 private String[] GetFileObjectDetails(CustomFileItem fileObj)
 {
     return(new string[] {
         fileObj.GetCustomFileName,                                                             //file name
         fileObj.LastWriteTime.ToString(),                                                      //date modified
         (fileObj.IsFolder) ? "" : ConverterUtils.HumanReadableFileSize(fileObj.FileLength, 2), //file size
         fileObj.CreationTime.ToString(),                                                       // created date time
         fileObj.TypeName                                                                       //file type
     });
 }
Exemplo n.º 3
0
 private void GenerateCustomeFileItem()
 {
     try
     {
         this.customFileItem = new CustomFileItem(this.CshItemObj.DisplayName, this.CshItemObj);
     }
     catch (Exception)
     {
         this.customFileItem = null;
     }
 }
Exemplo n.º 4
0
 public ListViewItemExtended(CustomFileItem customFileItem, string[] items) : base(items)
 {
     this.customFileItem = customFileItem;
     SetDefaultIcon();
 }
Exemplo n.º 5
0
 public ListViewItemExtended(CustomFileItem customFileItem) : base(customFileItem.GetCustomFileName)
 {
     this.customFileItem = customFileItem;
     SetDefaultIcon();
 }
 public void RemoveItem(CustomFileItem customFileItem)
 {
     this.masterListFilesDir.Remove(customFileItem);
     this.RemoveSubNode(customFileItem.GetCustomFileName);
 }
 public void AddItem(CustomFileItem customFileItem)
 {
     this.masterListFilesDir.Add(customFileItem);
 }
Exemplo n.º 8
0
 static bool FilterFunction(CustomFileItem file)
 {
     return(file.FullName.ToLower().EndsWith(".cs"));
 }