T_uezError IMSLoadDirectoryINI(TUInt32 aDrive)
{
    T_uezINISession ini;
    TInt32 numShows;
    char filename[40];
    char title[7];
    char dir[5];
    TUInt8 i;
    T_slideshowDefinition *p_list = G_ws->iSlideshowList.iList;

    sprintf(filename, "%d:/SLIDES/SLIDES.INI" , aDrive);
    if(UEZINIOpen(filename, &ini) == UEZ_ERROR_NONE){
        if (UEZINIGotoSection(ini, UEZ_SLIDESHOW_NAME) == UEZ_ERROR_NONE){
          UEZINIGetInteger32(ini, "numShows", 0, &numShows);
          if(!numShows){
              UEZINIGotoSection(ini, "default");
              UEZINIGetInteger32(ini, "numShows", 0, &numShows);
          }
        }
        if(numShows){
            for( i = 1; i <= numShows; i++){
                sprintf(title, "Title%d", i);
                if(UEZINIGetString(ini, title, "",p_list->iName, MAX_SLIDESHOW_DEF_NAME_LEN) == UEZ_ERROR_NONE){
                    sprintf(dir, "Dir%d", i);
                    if(UEZINIGetString(ini, dir, "",p_list->iDirectory, MAX_SLIDESHOW_DEF_DIR_LEN) == UEZ_ERROR_NONE){
                        p_list->iDrive = aDrive;
                        p_list++;
                        G_ws->iSlideshowList.iCount++;
                    }
                }
                else
                   return UEZ_ERROR_EMPTY;
            }
        }
        else{
            UEZINIClose(ini);
            return UEZ_ERROR_EMPTY;
        }
        return UEZINIClose(ini);
    }
    return UEZ_ERROR_EMPTY;
}
示例#2
0
T_uezError AudioPlayerSelectionLoad(TUInt32 aDrive)
{
    T_uezINISession ini;
    char key[10];
    char section[64];
    char filename[40];
    char type[20];
    TUInt8 i=0;
    T_uezError error = UEZ_ERROR_NONE;

    G_topFileIndex = 0;
    G_ws->iNumVideos = 0;
    
    sprintf(filename, "%d:/VIDEOS.INI" , aDrive);
    if(UEZINIOpen(filename, &ini) == UEZ_ERROR_NONE){

        for(i=0; i<MAX_VIDEOS; i++) {
            error = UEZINIGotoSection(ini, "Videos");
            
            if(!error) {
                sprintf(key, "video%d", i+1);
                if(UEZINIGetString(ini, key, "", section, 63) != UEZ_ERROR_NONE)
                    break; // Reached the end of the video list
            }
            
            if(!error)
                error = UEZINIGotoSection(ini, section);
            
            if(!error)
                error = UEZINIGetString(ini, "title", "", G_ws->iVideos[i].iTitle, 63);
            
            if(!error) {
                error = UEZINIGetString(ini, "type", "", type, 19);
                
                if(strcmp("BIN",type) == 0) {
                    G_ws->iVideos[i].iType = VIDEO_TYPE_BIN;
                } else {
                    G_ws->iVideos[i].iType = VIDEO_TYPE_FRAMES;
                }
            }
            
            if(!error) {
                if(UEZ_LCD_DEFAULT_COLOR_DEPTH == UEZLCD_COLOR_DEPTH_I15_BIT)
                    error = UEZINIGetString(ini, "video555", "", G_ws->iVideos[i].iVideoPath, 127);
                else
                    error = UEZINIGetString(ini, "video565", "", G_ws->iVideos[i].iVideoPath, 127);
            }
            
            if(!error)
                error = UEZINIGetString(ini, "audio", "", G_ws->iVideos[i].iAudioPath, 127);
            
            if(!error)
                error = UEZINIGetInteger32(ini, "fps", 10, (TInt32*)&G_ws->iVideos[i].iFPS);
            
            if(!error)
                error = UEZINIGetInteger32(ini, "height", 10, (TInt32*)&G_ws->iVideos[i].iVideoHeight);
            
            if(!error)
                error = UEZINIGetInteger32(ini, "width", 10, (TInt32*)&G_ws->iVideos[i].iVideoWidth);
            
            // Check for text lines. Ignore error.
            UEZINIGetString(ini, "TextLine1", "", G_ws->iVideos[i].iTextLine1, 127);
            UEZINIGetString(ini, "TextLine2", "", G_ws->iVideos[i].iTextLine2, 127);
            
            if(error != UEZ_ERROR_NONE)
                break;
            
            G_ws->iNumVideos++;
        }
        
        UEZINIClose(ini);
    }
    return error;
}