Subversion Repositories Kolibri OS

Rev

Rev 5465 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. int files_mas[2000];
  2. dword buf;
  3.  
  4.  
  5. void OpenDirectory(dword folder_path)
  6. {
  7.         int cur;
  8.         char temp_filename[4096];
  9.         dword j, filesnum, end_pointer;
  10.  
  11.         list.count = 0;
  12.         if (buf) free(buf);
  13.         if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0)
  14.         if (filesnum==0)
  15.         {
  16.                 notify("'Error opening folder' -E");
  17.         }
  18.        
  19.         for (j=0; j<filesnum; j++)
  20.         {
  21.                 strcpy(#temp_filename, j*304 + buf+72);
  22.                 end_pointer = #temp_filename+strlen(#temp_filename);
  23.                 if (strcmpi(end_pointer-4,".mp3")!=0) continue;
  24.                 cur = list.count;
  25.                 files_mas[cur]=j;
  26.                 list.count++;
  27.         }
  28.         SortByName(0, list.count-1);
  29. }
  30.  
  31. void SortByName(int a, b)
  32. {
  33.         int j, i = a;
  34.         if (a >= b) return;
  35.         for (j = a; j <= b; j++)
  36.                 if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j];   i++;}
  37.         SortByName(a, i-2);
  38.         SortByName(i, b);
  39. }
  40.  
  41. void SetOpenedFileFirst(dword in_name)
  42. {
  43.         int i;
  44.         dword opened_filename = in_name + strrchr(in_name, '/');
  45.         for (i=0; i<list.count; i++)
  46.         {
  47.                 if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
  48.         }
  49. }
  50.  
  51. dword GetCurrentItemName() {
  52.         return files_mas[list.current]*304 + buf+72;
  53. }
  54.