Subversion Repositories Kolibri OS

Rev

Rev 7196 | Blame | Compare with Previous | 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.         for (j=0; j<filesnum; j++)
  19.         {
  20.                 strcpy(#temp_filename, j*304 + buf+72);
  21.                 end_pointer = #temp_filename+strlen(#temp_filename);
  22.                 if (strcmpi(end_pointer-4,".mp3")==0)
  23.                 || (strcmpi(end_pointer-4,".wav")==0)
  24.                 || (strcmpi(end_pointer-3,".xm")==0)
  25.                 {
  26.                         cur = list.count;
  27.                         files_mas[cur]=j;
  28.                         list.count++;
  29.                         if (list.count>=sizeof(files_mas)*sizeof(int)) break;                  
  30.                 }
  31.         }
  32.         SortByName(0, list.count-1);
  33. }
  34.  
  35. void SortByName(int a, b)
  36. {
  37.         int j, i = a;
  38.         if (a >= b) return;
  39.         for (j = a; j <= b; j++)
  40.                 if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j];   i++;}
  41.         SortByName(a, i-2);
  42.         SortByName(i, b);
  43. }
  44.  
  45. void SetOpenedFileFirst(dword in_name)
  46. {
  47.         int i;
  48.         dword opened_filename = in_name + strrchr(in_name, '/');
  49.         for (i=0; i<list.count; i++)
  50.         {
  51.                 if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
  52.         }
  53. }
  54.  
  55. dword GetPlayingItemName() {
  56.         return files_mas[current_playing_file_n]*304 + buf+72;
  57. }
  58.  
  59. dword GetSelectedItemName() {
  60.         int cury = list.cur_y;
  61.         return files_mas[cury]*304 + buf+72;
  62. }
  63.