[fixed] Sort by Size problem (1 Viewer)

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    code is
    Code:
            case SortMethod.Size:
              if (item1.FileInfo == null || item2.FileInfo == null)
              {
                if (sortAscending)
                {
                  return (int)(item1.Duration - item2.Duration);
                }
                else
                {
                  return (int)(item2.Duration - item1.Duration);
                }
              }
              else
              {
                if (sortAscending)
                {
                  return (int)(item1.FileInfo.Length - item2.FileInfo.Length);
                }
                else
                {
                  return (int)(item2.FileInfo.Length - item1.FileInfo.Length);
                }
              }
    so if there is no file info available it will sort by duration

    way down in the depths of the virtual directory code you have

    Code:
            Win32API.WIN32_FIND_DATA fd = new Win32API.WIN32_FIND_DATA();
            fd.cFileName = new String(' ', 256);
            fd.cAlternate = new String(' ', 14);
    ...
            fi.Length = (((long)fd.nFileSizeHigh) << 32) + fd.nFileSizeLow;

    then even deeper down you have
    Code:
    private long length = 0;
    in FileInformation

    we define the two Win32 attributes as
    Code:
          public uint nFileSizeHigh;
          public uint nFileSizeLow;

    looks like an issue with calculating fi.length ??

    Edit: Damn you silent... do you ever stop fixing things ;)
     

    greybox

    MP Donator
  • Premium Supporter
  • January 23, 2009
    621
    132
    Home Country
    Canada Canada
    Thank you for confirming the bug. I wonder if same code is used for sorting the files in My Pictures, music and other modules, and if yes, then you know what to do! ;)
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Thank you for confirming the bug. I wonder if same code is used for sorting the files in My Pictures, music and other modules, and if yes, then you know what to do! ;)

    Silent has already fixed it... he is too quick for me ;)
     

    Seidelin

    Retired Team Member
  • Premium Supporter
  • August 14, 2006
    1,755
    652
    Kgs. Lyngby
    Home Country
    Denmark Denmark
    Thank you for confirming the bug. I wonder if same code is used for sorting the files in My Pictures, music and other modules, and if yes, then you know what to do! ;)

    SE already fixed that as well. If you want to test, try the attached binary.
     

    Attachments

    • WindowPlugins.zip
      396.5 KB

    greybox

    MP Donator
  • Premium Supporter
  • January 23, 2009
    621
    132
    Home Country
    Canada Canada
    Installed the dll, everything works fine now. Good job! Thank you very much!!
     

    Users who are viewing this thread

    Top Bottom