📄 filemode_pub.c
字号:
* *
* Purposes : Copy dir from source media to destination media . *
* *
* Descriptions : *
* *
* Arguments : (none) *
* *
* Returns : (none) *
* *
* See also : *
* *
\****************************************************************************************/
void SrcCopyDir2Des(UINT16 iSrcDirIndex, UINT16 iDesDirIndex)
{
printf("===============SrcCopyDir2Des()================================\n");
UINT32 lba;
UINT16 count;
char *dirname;
int i;
UINT16 srcdirindex[MAX_SUBDIR_NUM];//frankhuang add to store subdir index to copy
UINT16 subdirnum=0;
//switch to src pFsJpeg,fs9660dir and fs9660file buf
Switch2SrcDesBuf(SRCE);
pFsJpeg->file_array[pFsJpeg->dir_current]=iSrcDirIndex;//frank.huang add to support copy dir with date&time info 050905
dirname=iso9660_dir[iSrcDirIndex].name;
printf("======FSCreateDir=========dirname===%s====================\n",dirname);
//switch to des pFsJpeg,fs9660dir and fs9660file buf
Switch2SrcDesBuf(DEST);
lba=FSGetRoot();
printf("======lba=FSGetRoot()=========lba %d==========================\n",lba );
//*cardDes = cardP;//important!
printf("===============iDesDirIndex %d======================\n",iDesDirIndex );
//get the location of dir we will copy to
if(iDesDirIndex != 0)
{
//lba = iso9660_dir[iDesDirIndex].loc;
lba = msf2l(iso9660_dir[iDesDirIndex].loc);
printf("======msf2l(====lba %d===================================\n",lba );
}
if(FSSearchDir(lba,dirname))
{
printf("===============FSSearchDir()================================\n");
ShowWarning("THE DIR IS ALREADY EXISTED.");
return;
}
else
{
printf("===============FSCreateDir()================================\n");
//create the copied dir and get the new dir's location
lba = FSCreateDir(lba, dirname);
iDesDirIndex = AddDesDirStru(l2msf(lba), iDesDirIndex, dirname);
}
//added by wangwei,2004-12-21 11:05(to avoid the back rut of the progress bar blinking.)
DrawProgressBarInit();
//switch to src pFsJpeg,fs9660dir and fs9660file buf
Switch2SrcDesBuf(SRCE);
pFsJpeg->ControlArea = CNT_AREA_SRCE;
count = JudgeDir(iSrcDirIndex);
//whb move to FATCopy() in order not to copy empty dir
//if(count==1) //sunzhh add for copying empty dir 2005-1-27
//{
// BYTE copy_process = 100;
// Refresh(copy_process);
//}
//else
//write the subdir and file in dir
for(i = 1; i < count; i++)
{
if(DirFileCount1[i] < ISO_FILE_MAX)
{
printf("===============FSCreateDir()=======file=========================\n");
SrcCopyFile2Des(DirFileCount1[i], iDesDirIndex);
}
else if(DirFileCount1[i] > ISO_FILE_MAX)
{
printf("===============FSCreateDir()========dir========================\n");
if(iso9660_dir[DirFileCount1[i]-ISO_FILE_MAX].dir)
{
srcdirindex[subdirnum]=(DirFileCount1[i]-ISO_FILE_MAX);
if(subdirnum<MAX_SUBDIR_NUM)
subdirnum++;
}
else
{
//SrcCopyDir2Des((DirFileCount1[i]-ISO_FILE_MAX),iDesDirIndex);//frank.huang 050905 mark bucause subdir will be copied after files copied
srcdirindex[subdirnum]=(DirFileCount1[i]-ISO_FILE_MAX);
if(subdirnum<MAX_SUBDIR_NUM)
subdirnum++;
}
}
}
if(subdirnum)//frank.huang add 050905 to copy subdir
{
for(i=0;i<subdirnum;i++)
{
SrcCopyDir2Des(srcdirindex[i],iDesDirIndex);
}
}
}
/****************************************************************************************\
* *
* Function Name : FATDelete *
* *
* Purposes : Delete destination media files or dir *
* *
* Descriptions : *
* *
* Arguments : (none) *
* *
* Returns : (none) *
* *
* See also : *
* *
\****************************************************************************************/
void FATDelete(void)
{
printf("=================FATDelete()=================\n");
UINT16 index,current_dir_index;
int Res;
//switch to des pFsJpeg,fs9660dir and fs9660file buf
Switch2SrcDesBuf(DEST);
index = pFsJpeg->file_current_in_page + PER_PAGE*( pFsJpeg->file_page_index);
printf("======1====index %d===================================\n",index );
index = DirFileCount2[index];
printf("======2====index %d===================================\n",index );
if(index > ISO_FILE_MAX)
{
printf("=================DeleteDir=================\n");
ShowWarning("DELETING DIR...");
FATDeleteDir(index-ISO_FILE_MAX);
ShowWarning("DELETING DIR IS OK.");
}
else if(index < ISO_FILE_MAX)
{
printf("=================DeleteFile==================\n");
ShowWarning("DELETING FILE...");
FATDeleteFile(index);
ShowWarning("DELETING FILE IS OK.");
}
else if(index == ISO_FILE_MAX)
{
printf("=================invalid_key()=================\n");
invalid_key();
return;
}
current_dir_index = pFsJpeg->dir_current;
ReadFile(&Res);
pFsJpeg->dir_current = current_dir_index;
pFsJpeg->file_index_in_dir--;
if(pFsJpeg->file_current_in_page > 0)
pFsJpeg->file_current_in_page--;
else
{
pFsJpeg->file_current_in_page = PER_PAGE-1;
pFsJpeg->file_page_index--;
}
FileModeGUI_Refresh();
FileMode_DirList(current_dir_index);
}
/****************************************************************************************\
* *
* Function Name : FATDeleteFile *
* *
* Purposes : Delete destination media files *
* *
* Descriptions : *
* *
* Arguments : (none) *
* *
* Returns : (none) *
* *
* See also : *
* *
\****************************************************************************************/
void FATDeleteFile(UINT16 iFileIndex)
{
//UINT32 lba;
//lba=FSGetRoot();
FSDeleteData(FS_GetFilePropertyEntry(iFileIndex));
//FSDeleteData(&(iso9660_file[iFileIndex]));
}
/****************************************************************************************\
* *
* Function Name : FATDeleteDir *
* *
* Purposes : Delete destination media dir *
* *
* Descriptions : *
* *
* Arguments : (none) *
* *
* Returns : (none) *
* *
* See also : *
* *
\****************************************************************************************/
void FATDeleteDir (UINT16 iDirIndex)
{
//UINT32 lba;
//UINT16 i,file_cnt = 0;
//UINT16 index;
//lba = FSGetRoot ();
FSDeleteData( &(iso9660_dir[iDirIndex]) );
}
/****************************************************************************************\
* *
* Function Name : JudgeDir *
* *
* Purposes : *
* *
* Descriptions : *
* *
* Arguments : (none) *
* *
* Returns : (none) *
* *
* See also : *
* *
\****************************************************************************************/
UINT16 JudgeDir(INT16 iDirIndex)
{
int i,j = 0;
if(1)//set parent path flag for subdir
{
if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
DirFileCount1[j] = ISO_FILE_MAX;//flag as path to parent dir
else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
DirFileCount2[j] = ISO_FILE_MAX;//flag as path to parent dir
j++;
}
for (i = 1; i < pFsJpeg->iso9660_dir_cnt; i++)//skip No.0 dir
{
if((iso9660_dir[i].parent_dir == iDirIndex))
{
if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
DirFileCount1[j] = i + ISO_FILE_MAX;//flag as path to parent dir
else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
{
DirFileCount2[j] = i + ISO_FILE_MAX;
printf("=====1====DirFileCount2[%d]:%d=============\n",j,DirFileCount2[j]);
}
j++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -