⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filemode_pub.c

📁 dvd里面的一个文件系统的代码
💻 C
📖 第 1 页 / 共 4 页
字号:
    }
    for(i = 0; i < pFsJpeg->iso9660_file_cnt; i++)
    {
        if((FS_GetFileProperty(i,FILE_PROPERTY_PARENT_FOLDER) == iDirIndex ))
        //if((iso9660_file[i].parent_dir == iDirIndex ))
        {
            if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
            {
                DirFileCount1[j] = i ;//flag as path to parent dir
                current_dir_size += FS_GetFileProperty(i,FILE_PROPERTY_SIZE);
                //current_dir_size += iso9660_file[i].size;
            }
            else if(pFsJpeg->ControlArea == CNT_AREA_DEST) 
            {
                DirFileCount2[j]= i;
                printf("=====2====DirFileCount2[%d]:%d=============\n",j,DirFileCount2[j]);
            }
			j++;
        }
    }  
    return j;    
}
/****************************************************************************************\
 *                                                                                       *
 *  Function Name : JudgeDelDir                                                          *
 *                                                                                       *
 *  Purposes      : Calculate the deleted dir contain the count of dir and files.        *
 *                                                                                       *
 *  Descriptions  :                                                                      *
 *                                                                                       *
 *  Arguments     : (none)                                                               *
 *                                                                                       *
 *  Returns       : (none)                                                               *
 *                                                                                       *
 *  See also      :                                                                      *
 *                                                                                       *
\****************************************************************************************/
UINT16 JudgeDelDir(UINT16 iDirIndex ,UINT16 del_file_index)
{
    UINT16 i,j ;
    j = del_file_index;
    printf("\n================JudgeDelDir==============================\n");

    for (i = 0; i < pFsJpeg->iso9660_dir_cnt; i++)
    {
        if(iso9660_dir[i].parent_dir == iDirIndex)//find the sub-dir in the current dir
        {
                DirFileCount2[j] = i + ISO_FILE_MAX;
            printf("dir-----DirFileCount2[%d]= %d\n",j,(i+ISO_FILE_MAX));
            j++;
            j = JudgeDelDir( i, j );
        }
    }

    for(i = 0; i < pFsJpeg->iso9660_file_cnt; i++)
    {
        if((FS_GetFileProperty(i,FILE_PROPERTY_PARENT_FOLDER) == iDirIndex ))//find the files in the current dir
        //if((iso9660_file[i].parent_dir == iDirIndex ))//find the files in the current dir
        {
                DirFileCount2[j]= i;
			printf("file-----DirFileCount2[%d]= %d\n",j,i);
			j++;
        }
    }
    return j;

}
/****************************************************************************************\
 *                                                                                       *
 *  Function Name : FATCopy                                                              *
 *                                                                                       *
 *  Purposes      : Calculate the deleted dir contain the count of dir and files.        *
 *                                                                                       *
 *  Descriptions  :                                                                      *
 *                                                                                       *
 *  Arguments     : (none)                                                               *
 *                                                                                       *
 *  Returns       : (none)                                                               *
 *                                                                                       *
 *  See also      :                                                                      *
 *                                                                                       *
\****************************************************************************************/
void FATCopy(void)
{
    UINT16 dircount;
    UINT64 dirsize;
    int i;
    
    printf("=================FATCopy()=================\n");  
    UINT16 src_file_index,des_dir_index,current_dir_index;      
    BYTE   UdiskWP; 
    int Res;            
    if(storage_type == USB_DEVICE)
	{
	    UdiskWP=DetectUdiskIsProtect();
	    if(UdiskWP)   
	    {
	        printf("=================udisk protect=================\n");  
	        ShowWarning("UDISK PROTECTED");      
	        return; 
	    }  
		 
	}
    media_type = MEDIA_CD ;//lijd 2005-1-18 17:11 
    //switch to des pFsJpeg,fs9660dir and fs9660file buf      
    Switch2SrcDesBuf(DEST);
    des_dir_index = pFsJpeg->dir_current;
    printf("+++++++++ pFsJpeg->dir_current = %x+++++++++\n",pFsJpeg->dir_current);
    
    //switch to src pFsJpeg,fs9660dir and fs9660file buf         
    Switch2SrcDesBuf(SRCE);
    
    //get the file/dir index of card we will copy
    src_file_index = pFsJpeg->file_current_in_page + PER_PAGE*( pFsJpeg->file_page_index);
    src_file_index = DirFileCount1[src_file_index];
	
    if(src_file_index> ISO_FILE_MAX)//copy dir 
    {
	//whb modified
     /* judge dir and get remain capacity of U disk:
            dir is empty: do not copy & ShowWarning
            dir is not empty:
                total size of dir is less than remain capacity of U disk:  copy 
                else:  do not cooy & ShowWarning
     */
     
        dircount = JudgeDir( (src_file_index-ISO_FILE_MAX) );    
        if(dircount==1)
        {
            ShowWarning("EMPTY DIR."); 
        }
        else
        {
            dirsize = 0;
            for(i = 1; i < dircount; i++)
            {
            if(DirFileCount1[i] < ISO_FILE_MAX)
                dirsize += (FS_GetFileProperty(DirFileCount1[i],FILE_PROPERTY_SIZE));
                //dirsize += (iso9660_file[ DirFileCount1[i] ].size);
            }
        
            FSGetRoot();
            FSJudgeFAT();
         
            if( dirsize < (zeroFAT_cnt * cardP.secPerClus * 512) )
    {
        ShowWarning("COPYING DIR...");        
        current_dir_size = 0;
        dir_copied_size = 0;
        copy_dir_or_file = COPY_DIR;
        SrcCopyDir2Des((src_file_index-ISO_FILE_MAX), des_dir_index);       
        current_dir_size = 0;
        dir_copied_size = 0;
        copy_dir_or_file = 0;
        ShowWarning("COPYING DIR IS OK.");                                      
                FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START, FS_BOTTOM_AREA_Y_START,FS_BOTTOM_AREA_X_SIZE, FS_BOTTOM_AREA_Y_SIZE, BK_GROUNDY, BK_CRCB);
        Switch2SrcDesBuf(SRCE);
        FileModeGUI_Refresh();
        FileMode_DirList(iso9660_dir[src_file_index - ISO_FILE_MAX].parent_dir);
            }
            else
            {
            	FileMode_DirList(iso9660_dir[src_file_index - ISO_FILE_MAX].parent_dir);
                ShowWarning("SORRY. NO ENOUGH CAPACITY");
            }
        }
        
    }
    else if(src_file_index < ISO_FILE_MAX)//copy file
    {
//whb modified          
/*
get remain capacity of U disk:
    file size is less than remain capacity of U disk:  copy 
    else:  do not cooy & ShowWarning
*/       
       FSGetRoot();
       FSJudgeFAT();
       
       if( (FS_GetFileProperty(src_file_index,FILE_PROPERTY_SIZE)) < (zeroFAT_cnt * cardP.secPerClus * 512) )
       //if( (iso9660_file[ src_file_index ].size) < (zeroFAT_cnt * cardP.secPerClus * 512) )
       {
            ShowWarning("COPYING FILE...");      
            copy_dir_or_file = COPY_FILE;
            printf("========src_file_index=%d\n",src_file_index); 
            printf("========des_dir_index=%d\n",des_dir_index);     
            SrcCopyFile2Des(src_file_index, des_dir_index);     
            ShowWarning("COPYING FILE IS OK.");
            FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START, FS_BOTTOM_AREA_Y_START,FS_BOTTOM_AREA_X_SIZE, FS_BOTTOM_AREA_Y_SIZE, BK_GROUNDY, BK_CRCB);
        }
        else
            ShowWarning("SORRY. NO ENOUGH CAPACITY");
    }
    else
    {
        invalid_key();
        return;  
    }

    Switch2SrcDesBuf(DEST);
    
    FileModeJudgeSelMedia();
    if(media_type == MEDIA_CARD)
    {
        BYTE n;
        n = pFsJpeg->media_will;     //to avoid pFsJpeg->media_will being changed
        CardTestReady();             
        FileModeGetInfo();
        pFsJpeg->media_will = n;
    }
    else if(media_type == MEDIA_CD)
    {
        media_type = MEDIA_CD;
        LoadModual(MODUAL_CDROM);
        sys_cmd=(CMD_FUNC|CMD_FUNC_CLOSE);
        ReadCDTitle();
        system_state=SYSTEM_SETUP_BROWSER;          
    }             
    current_dir_index = pFsJpeg->dir_current;
    ReadFile(&Res);
    pFsJpeg->dir_current = current_dir_index;
      
    FileModeGUI_Refresh();
    show_fat_dir_file_info();
    FileMode_DirList(des_dir_index);                                   
}

/****************************************************************************************\
*                                                                                        *
*  Function Name : StorageGetCapacityInfo                                                *
*                                                                                        *
*  Purposes      : get the the capacity informations of the storage.                     *
*                                                                                        *
*  Descriptions  : get the the capacity informations of the storage.                     *
*                                                                                        *
*  Arguments     : (none)                                                                *
*                                                                                        *
*  Returns       : (none)                                                                *
*                                                                                        *
*  See also      : Creator : wangwei,2004-11-15 21:07                                    *
*                                                                                        *
\****************************************************************************************/
void StorageGetCapacityInfo(void)
{
    if(storage_type == USB_DEVICE)
    {
        MaxLUN=0;
        UsbTestReady();
    }
    else
        CardTestReady();

    FSGetRoot();
    FSJudgeFAT();

    if(storage_type == USB_DEVICE)
    {
        uiTotalCapacity  = uiTotalCapacity>>20;//in Mega
        uiRemainCapacity = (zeroFAT_cnt * cardP.secPerClus * 512) >> 20;//in Mega
    }

    #ifdef SPHE8202_ALL_TYPE_CARD_WRITE	//dingzhy
    uiTotalCapacity  = card_uiTotalCapacity;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -