Subversion Repositories Kolibri OS

Rev

Rev 7188 | Go to most recent revision | 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.         debugval("sizeof(files_mas)", sizeof(files_mas));
  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)
  24.                 || (strcmpi(end_pointer-4,".wav")==0)
  25.                 || (strcmpi(end_pointer-3,".xm")==0)
  26.                 {
  27.                         cur = list.count;
  28.                         files_mas[cur]=j;
  29.                         list.count++;
  30.                         if (list.count>=sizeof(files_mas)*sizeof(int)) break;                  
  31.                 }
  32.         }
  33.         SortByName(0, list.count-1);
  34. }
  35.  
  36. void SortByName(int a, b)
  37. {
  38.         int j, i = a;
  39.         if (a >= b) return;
  40.         for (j = a; j <= b; j++)
  41.                 if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j];   i++;}
  42.         SortByName(a, i-2);
  43.         SortByName(i, b);
  44. }
  45.  
  46. void SetOpenedFileFirst(dword in_name)
  47. {
  48.         int i;
  49.         dword opened_filename = in_name + strrchr(in_name, '/');
  50.         for (i=0; i<list.count; i++)
  51.         {
  52.                 if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
  53.         }
  54. }
  55.  
  56. dword Getcur_yItemName() {
  57.         return files_mas[current_playing_file_n]*304 + buf+72;
  58. }
  59.