本文整理汇总了C++中DOS_DTA::GetSearchParams方法的典型用法代码示例。如果您正苦于以下问题:C++ DOS_DTA::GetSearchParams方法的具体用法?C++ DOS_DTA::GetSearchParams怎么用?C++ DOS_DTA::GetSearchParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOS_DTA
的用法示例。
在下文中一共展示了DOS_DTA::GetSearchParams方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindFirst
bool isoDrive::FindFirst(char *dir, DOS_DTA &dta, bool fcb_findfirst) {
isoDirEntry de;
if (!lookup(&de, dir)) {
DOS_SetError(DOSERR_PATH_NOT_FOUND);
return false;
}
// get a directory iterator and save its id in the dta
int dirIterator = GetDirIterator(&de);
bool isRoot = (*dir == 0);
dirIterators[dirIterator].root = isRoot;
dta.SetDirID((Bit16u)dirIterator);
Bit8u attr;
char pattern[ISO_MAXPATHNAME];
dta.GetSearchParams(attr, pattern);
if (attr == DOS_ATTR_VOLUME) {
dta.SetResult(discLabel, 0, 0, 0, DOS_ATTR_VOLUME);
return true;
} else if ((attr & DOS_ATTR_VOLUME) && isRoot && !fcb_findfirst) {
if (WildFileCmp(discLabel,pattern)) {
// Get Volume Label (DOS_ATTR_VOLUME) and only in basedir and if it matches the searchstring
dta.SetResult(discLabel, 0, 0, 0, DOS_ATTR_VOLUME);
return true;
}
}
return FindNext(dta);
}
示例2: FindFirst
bool Virtual_Drive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
search_file=first_file;
Bit8u attr;char pattern[DOS_NAMELENGTH_ASCII];
dta.GetSearchParams(attr,pattern);
if(attr & DOS_ATTR_VOLUME) {
dta.SetResult("DOSBOX",0,0,0,DOS_ATTR_VOLUME);
return true;
}
return FindNext(dta);
}
示例3: FindNext
bool localDrive::FindNext(DOS_DTA & dta) {
char * dir_ent;
struct stat stat_block;
char full_name[CROSS_LEN];
char dir_entcopy[CROSS_LEN];
Bit8u srch_attr;char srch_pattern[DOS_NAMELENGTH_ASCII];
Bit8u find_attr;
dta.GetSearchParams(srch_attr,srch_pattern);
Bit16u id = dta.GetDirID();
again:
if (!dirCache.FindNext(id,dir_ent)) {
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
if(!WildFileCmp(dir_ent,srch_pattern)) goto again;
strcpy(full_name,srchInfo[id].srch_dir);
strcat(full_name,dir_ent);
//GetExpandName might indirectly destroy dir_ent (by caching in a new directory
//and due to its design dir_ent might be lost.)
//Copying dir_ent first
strcpy(dir_entcopy,dir_ent);
if (stat(dirCache.GetExpandName(full_name),&stat_block)!=0) {
goto again;//No symlinks and such
}
if(stat_block.st_mode & S_IFDIR) find_attr=DOS_ATTR_DIRECTORY;
else find_attr=DOS_ATTR_ARCHIVE;
if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
/*file is okay, setup everything to be copied in DTA Block */
char find_name[DOS_NAMELENGTH_ASCII];Bit16u find_date,find_time;Bit32u find_size;
if(strlen(dir_entcopy)<DOS_NAMELENGTH_ASCII){
strcpy(find_name,dir_entcopy);
upcase(find_name);
}
find_size=(Bit32u) stat_block.st_size;
struct tm *time;
if((time=localtime(&stat_block.st_mtime))!=0){
find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
} else {
find_time=6;
find_date=4;
}
dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
return true;
}
示例4: FindFirst
bool localDrive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
char tempDir[CROSS_LEN];
strcpy(tempDir,basedir);
strcat(tempDir,_dir);
CROSS_FILENAME(tempDir);
if (allocation.mediaid==0xF0 ) {
EmptyCache(); //rescan floppie-content on each findfirst
}
char end[2]={CROSS_FILESPLIT,0};
if (tempDir[strlen(tempDir)-1]!=CROSS_FILESPLIT) strcat(tempDir,end);
Bit16u id;
if (!dirCache.FindFirst(tempDir,id)) {
DOS_SetError(DOSERR_PATH_NOT_FOUND);
return false;
}
strcpy(srchInfo[id].srch_dir,tempDir);
dta.SetDirID(id);
Bit8u sAttr;
dta.GetSearchParams(sAttr,tempDir);
if (this->isRemote() && this->isRemovable()) {
// cdroms behave a bit different than regular drives
if (sAttr == DOS_ATTR_VOLUME) {
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
}
} else {
if (sAttr == DOS_ATTR_VOLUME) {
if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
// LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
// dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
// return true;
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
} else if ((sAttr & DOS_ATTR_VOLUME) && (*_dir == 0) && !fcb_findfirst) {
//should check for a valid leading directory instead of 0
//exists==true if the volume label matches the searchmask and the path is valid
if (WildFileCmp(dirCache.GetLabel(),tempDir)) {
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
}
}
}
return FindNext(dta);
}
示例5: FindNext
bool Virtual_Drive::FindNext(DOS_DTA & dta) {
Bit8u attr;char pattern[DOS_NAMELENGTH_ASCII];
dta.GetSearchParams(attr,pattern);
while (search_file) {
if (WildFileCmp(search_file->name,pattern)) {
dta.SetResult(search_file->name,search_file->size,search_file->date,search_file->time,DOS_ATTR_ARCHIVE);
search_file=search_file->next;
return true;
}
search_file=search_file->next;
}
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
示例6: FindFirst
bool Virtual_Drive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
search_file=first_file;
Bit8u attr;char pattern[CROSS_LEN];
dta.GetSearchParams(attr,pattern,true);
if (attr == DOS_ATTR_VOLUME) {
dta.SetResult("DOSBOX","DOSBOX",0,0,0,DOS_ATTR_VOLUME);
return true;
} else if ((attr & DOS_ATTR_VOLUME) && !fcb_findfirst) {
if (WildFileCmp("DOSBOX",pattern)) {
dta.SetResult("DOSBOX","DOSBOX",0,0,0,DOS_ATTR_VOLUME);
return true;
}
}
return FindNext(dta);
}
示例7: FindNext
bool physfsDrive::FindNext(DOS_DTA & dta) {
char * dir_ent;
char full_name[CROSS_LEN];
Bit8u srch_attr;char srch_pattern[DOS_NAMELENGTH_ASCII];
Bit8u find_attr;
dta.GetSearchParams(srch_attr,srch_pattern);
Bitu id = dta.GetDirID();
again:
if (!dirCache.FindNext(id,dir_ent)) {
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
if(!WildFileCmp(dir_ent,srch_pattern)) goto again;
char find_name[DOS_NAMELENGTH_ASCII];Bit16u find_date,find_time;Bit32u find_size;
if(strlen(dir_ent)<DOS_NAMELENGTH_ASCII){
strcpy(find_name,dir_ent);
upcase(find_name);
}
strcpy(full_name,srchInfo[id].srch_dir);
strcat(full_name,dir_ent);
dirCache.ExpandName(full_name);
normalize(full_name,basedir);
if (PHYSFS_isDirectory(full_name)) find_attr=DOS_ATTR_DIRECTORY|DOS_ATTR_ARCHIVE;
else find_attr=DOS_ATTR_ARCHIVE;
if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
/*file is okay, setup everything to be copied in DTA Block */
find_size=(Bit32u)PHYSFS_fileLength(full_name);
time_t mytime = (time_t)PHYSFS_getLastModTime(full_name);
struct tm *time;
if((time=localtime(&mytime))!=0){
find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
} else {
find_time=6;
find_date=4;
}
dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
return true;
}
示例8: FindFirst
bool physfsDrive::FindFirst(const char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
char tempDir[CROSS_LEN];
strcpy(tempDir,basedir);
strcat(tempDir,_dir);
CROSS_FILENAME(tempDir);
char end[2]={CROSS_FILESPLIT,0};
if (tempDir[strlen(tempDir)-1]!=CROSS_FILESPLIT) strcat(tempDir,end);
Bit16u id;
if (!dirCache.FindFirst(tempDir,id))
{
DOS_SetError(DOSERR_PATH_NOT_FOUND);
return false;
}
strcpy(srchInfo[id].srch_dir,tempDir);
dta.SetDirID(id);
Bit8u sAttr;
dta.GetSearchParams(sAttr,tempDir);
if (sAttr == DOS_ATTR_VOLUME) {
if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
return true;
}
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
} else if ((sAttr & DOS_ATTR_VOLUME) && (*_dir == 0) && !fcb_findfirst) {
//should check for a valid leading directory instead of 0
//exists==true if the volume label matches the searchmask and the path is valid
if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
return true;
}
if (WildFileCmp(dirCache.GetLabel(),tempDir)) {
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
}
}
return FindNext(dta);
}
示例9: FindNext
bool isoDrive::FindNext(DOS_DTA &dta) {
Bit8u attr;
char pattern[DOS_NAMELENGTH_ASCII];
dta.GetSearchParams(attr, pattern);
int dirIterator = dta.GetDirID();
bool isRoot = dirIterators[dirIterator].root;
isoDirEntry de;
while (GetNextDirEntry(dirIterator, &de)) {
Bit8u findAttr = 0;
if (IS_DIR(FLAGS1)) findAttr |= DOS_ATTR_DIRECTORY;
else findAttr |= DOS_ATTR_ARCHIVE;
if (IS_HIDDEN(FLAGS1)) findAttr |= DOS_ATTR_HIDDEN;
if (!IS_ASSOC(FLAGS1) && !(isRoot && de.ident[0]=='.') && WildFileCmp((char*)de.ident, pattern)
&& !(~attr & findAttr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM))) {
/* file is okay, setup everything to be copied in DTA Block */
char findName[DOS_NAMELENGTH_ASCII];
findName[0] = 0;
if(strlen((char*)de.ident) < DOS_NAMELENGTH_ASCII) {
strcpy(findName, (char*)de.ident);
upcase(findName);
}
Bit32u findSize = DATA_LENGTH(de);
Bit16u findDate = DOS_PackDate(1900 + de.dateYear, de.dateMonth, de.dateDay);
Bit16u findTime = DOS_PackTime(de.timeHour, de.timeMin, de.timeSec);
dta.SetResult(findName, findSize, findDate, findTime, findAttr);
return true;
}
}
// after searching the directory, free the iterator
FreeDirIterator(dirIterator);
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}