本文整理汇总了C++中FindFile::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ FindFile::Next方法的具体用法?C++ FindFile::Next怎么用?C++ FindFile::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FindFile
的用法示例。
在下文中一共展示了FindFile::Next方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WildFileExist
bool WildFileExist(const wchar *Name)
{
if (IsWildcard(Name))
{
FindFile Find;
Find.SetMask(Name);
FindData fd;
return Find.Next(&fd);
}
return FileExist(Name);
}
示例2: WildFileExist
bool WildFileExist(const char *FileName,const wchar *FileNameW)
{
if (IsWildcard(FileName,FileNameW))
{
FindFile Find;
Find.SetMask(FileName);
Find.SetMaskW(FileNameW);
struct FindData fd;
return(Find.Next(&fd));
}
return(FileExist(FileName,FileNameW));
}
示例3: WildFileExist
bool WildFileExist(const char *Name,const wchar *NameW)
{
if (IsWildcard(Name,NameW))
{
FindFile Find;
Find.SetMask(Name);
Find.SetMaskW(NameW);
FindData fd;
return(Find.Next(&fd));
}
return(FileExist(Name,NameW));
}
示例4: VolNameToFirstName
// Get the name of first volume. Return the leftmost digit of volume number.
wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,size_t MaxSize,bool NewNumbering)
{
if (FirstName!=VolName)
wcsncpyz(FirstName,VolName,MaxSize);
wchar *VolNumStart=FirstName;
if (NewNumbering)
{
wchar N='1';
// From the rightmost digit of volume number to the left.
for (wchar *ChPtr=GetVolNumPart(FirstName);ChPtr>FirstName;ChPtr--)
if (IsDigit(*ChPtr))
{
*ChPtr=N; // Set the rightmost digit to '1' and others to '0'.
N='0';
}
else
if (N=='0')
{
VolNumStart=ChPtr+1; // Store the position of leftmost digit in volume number.
break;
}
}
else
{
// Old volume numbering scheme. Just set the extension to ".rar".
SetExt(FirstName,L"rar",MaxSize);
VolNumStart=GetExt(FirstName);
}
if (!FileExist(FirstName))
{
// If the first volume, which name we just generated, is not exist,
// check if volume with same name and any other extension is available.
// It can help in case of *.exe or *.sfx first volume.
wchar Mask[NM];
wcsncpyz(Mask,FirstName,ASIZE(Mask));
SetExt(Mask,L"*",ASIZE(Mask));
FindFile Find;
Find.SetMask(Mask);
FindData FD;
while (Find.Next(&FD))
{
Archive Arc;
if (Arc.Open(FD.Name,0) && Arc.IsArchive(true) && Arc.FirstVolume)
{
wcsncpyz(FirstName,FD.Name,MaxSize);
break;
}
}
}
return VolNumStart;
}
示例5: FetchDir
bool DlgCompareDir::FetchDir(String dir, VectorMap<String, FileInfo>& files, VectorMap<String, String>& dirs)
{
FindFile ff;
if(!ff.Search(AppendFileName(dir, "*")))
return false;
do
if(ff.IsFile() && PatternMatchMulti(fm, ff.GetName()))
files.Add(NormalizePathCase(ff.GetName()), FileInfo(ff.GetName(), ff.GetLength(), ff.GetLastWriteTime()));
else if(ff.IsFolder())
dirs.Add(NormalizePathCase(ff.GetName()), ff.GetName());
while(ff.Next());
return true;
}
示例6: RunCommand
int MyDocEdit::RunCommand(String user_input)
{
FindFile ff;
Insert(GetCursor(), "\n");
cursor++;
if(!ff.Search(AppendFileName(dir, "*")))
return false;
do {
Insert(GetCursor(), ff.GetName()+"\n");
SetCursor(GetCursor()+ff.GetName().GetLength()+1);
}
while(ff.Next());
return 0;
}
示例7: ExpandFolderMask
// For masks like dir1\dir2*\*.ext in non-recursive mode.
bool ScanTree::ExpandFolderMask()
{
bool WildcardFound=false;
uint SlashPos=0;
for (int I=0;CurMask[I]!=0;I++)
{
if (CurMask[I]=='?' || CurMask[I]=='*')
WildcardFound=true;
if (WildcardFound && IsPathDiv(CurMask[I]))
{
// First path separator position after folder wildcard mask.
// In case of dir1\dir2*\dir3\name.ext mask it may point not to file
// name, so we cannot use PointToName() here.
SlashPos=I;
break;
}
}
wchar Mask[NM];
wcsncpyz(Mask,CurMask,ASIZE(Mask));
Mask[SlashPos]=0;
// Prepare the list of all folders matching the wildcard mask.
ExpandedFolderList.Reset();
FindFile Find;
Find.SetMask(Mask);
FindData FD;
while (Find.Next(&FD))
if (FD.IsDir)
{
wcsncatz(FD.Name,CurMask+SlashPos,ASIZE(FD.Name));
// Treat dir*\* or dir*\*.* as dir, so empty 'dir' is also matched
// by such mask. Skipping empty dir with dir*\*.* confused some users.
wchar *LastMask=PointToName(FD.Name);
if (wcscmp(LastMask,L"*")==0 || wcscmp(LastMask,L"*.*")==0)
RemoveNameFromPath(FD.Name);
ExpandedFolderList.AddString(FD.Name);
}
if (ExpandedFolderList.ItemsCount()==0)
return false;
// Return the first matching folder name now.
ExpandedFolderList.GetString(CurMask,ASIZE(CurMask));
return true;
}
示例8: VolNameToFirstName
char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering)
{
if (FirstName!=VolName)
strcpy(FirstName,VolName);
char *VolNumStart=FirstName;
if (NewNumbering)
{
int N='1';
for (char *ChPtr=GetVolNumPart(FirstName);ChPtr>FirstName;ChPtr--)
if (isdigit(*ChPtr))
{
*ChPtr=N;
N='0';
}
else
if (N=='0')
{
VolNumStart=ChPtr+1;
break;
}
}
else
{
SetExt(FirstName,"rar");
VolNumStart=GetExt(FirstName);
}
if (!FileExist(FirstName))
{
char Mask[NM];
strcpy(Mask,FirstName);
SetExt(Mask,"*");
FindFile Find;
Find.SetMask(Mask);
struct FindData FD;
while (Find.Next(&FD))
{
Archive Arc;
if (Arc.Open(FD.Name,FD.NameW) && Arc.IsArchive(true) && !Arc.NotFirstVolume)
{
strcpy(FirstName,FD.Name);
break;
}
}
}
return(VolNumStart);
}
示例9: RecVolumesTest
void RecVolumesTest(RAROptions *Cmd,Archive *Arc,const wchar *Name)
{
wchar RevName[NM];
*RevName=0;
if (Arc!=NULL)
{
// We received .rar or .exe volume as a parameter, trying to find
// the matching .rev file number 1.
bool NewNumbering=Arc->NewNumbering;
wchar ArcName[NM];
wcsncpyz(ArcName,Name,ASIZE(ArcName));
wchar *VolNumStart=VolNameToFirstName(ArcName,ArcName,ASIZE(ArcName),NewNumbering);
wchar RecVolMask[NM];
wcsncpyz(RecVolMask,ArcName,ASIZE(RecVolMask));
size_t BaseNamePartLength=VolNumStart-ArcName;
wcsncpyz(RecVolMask+BaseNamePartLength,L"*.rev",ASIZE(RecVolMask)-BaseNamePartLength);
FindFile Find;
Find.SetMask(RecVolMask);
FindData RecData;
while (Find.Next(&RecData))
{
wchar *Num=GetVolNumPart(RecData.Name);
if (*Num!='1') // Name must have "0...01" numeric part.
continue;
bool FirstVol=true;
while (--Num>=RecData.Name && IsDigit(*Num))
if (*Num!='0')
{
FirstVol=false;
break;
}
if (FirstVol)
{
wcsncpyz(RevName,RecData.Name,ASIZE(RevName));
Name=RevName;
break;
}
}
if (*RevName==0) // First .rev file not found.
return;
}
File RevFile;
if (!RevFile.Open(Name))
{
ErrHandler.OpenErrorMsg(Name); // It also sets RARX_OPEN.
return;
}
#ifndef GUI
mprintf(L"\n");
#endif
byte Sign[REV5_SIGN_SIZE];
bool Rev5=RevFile.Read(Sign,REV5_SIGN_SIZE)==REV5_SIGN_SIZE && memcmp(Sign,REV5_SIGN,REV5_SIGN_SIZE)==0;
RevFile.Close();
if (Rev5)
{
RecVolumes5 RecVol(true);
RecVol.Test(Cmd,Name);
}
else
{
RecVolumes3 RecVol(true);
RecVol.Test(Cmd,Name);
}
}
示例10: wcscpy
bool RecVolumes5::Restore(RAROptions *Cmd,const wchar *Name,bool Silent)
{
wchar ArcName[NM];
wcscpy(ArcName,Name);
wchar *Num=GetVolNumPart(ArcName);
while (Num>ArcName && IsDigit(*(Num-1)))
Num--;
wcsncpyz(Num,L"*.*",ASIZE(ArcName)-(Num-ArcName));
wchar FirstVolName[NM];
*FirstVolName=0;
int64 RecFileSize=0;
FindFile VolFind;
VolFind.SetMask(ArcName);
FindData fd;
uint FoundRecVolumes=0;
while (VolFind.Next(&fd))
{
Wait();
Archive *Vol=new Archive(Cmd);
int ItemPos=-1;
if (Vol->WOpen(fd.Name))
{
if (CmpExt(fd.Name,L"rev"))
{
uint RecNum=ReadHeader(Vol,FoundRecVolumes==0);
if (RecNum!=0)
{
if (FoundRecVolumes==0)
RecFileSize=Vol->FileLength();
ItemPos=RecNum;
FoundRecVolumes++;
}
}
else
if (Vol->IsArchive(true) && (Vol->SFXSize>0 || CmpExt(fd.Name,L"rar")))
{
if (!Vol->Volume && !Vol->BrokenHeader)
{
uiMsg(UIERROR_NOTVOLUME,ArcName);
return false;
}
// We work with archive as with raw data file, so we do not want
// to spend time to QOpen I/O redirection.
Vol->QOpenUnload();
Vol->Seek(0,SEEK_SET);
// RAR volume found. Get its number, store the handle in appropriate
// array slot, clean slots in between if we had to grow the array.
wchar *Num=GetVolNumPart(fd.Name);
uint VolNum=0;
for (uint K=1;Num>=fd.Name && IsDigit(*Num);K*=10,Num--)
VolNum+=(*Num-'0')*K;
if (VolNum==0 || VolNum>MaxVolumes)
continue;
size_t CurSize=RecItems.Size();
if (VolNum>CurSize)
{
RecItems.Alloc(VolNum);
for (size_t I=CurSize;I<VolNum;I++)
RecItems[I].f=NULL;
}
ItemPos=VolNum-1;
if (*FirstVolName==0)
VolNameToFirstName(fd.Name,FirstVolName,ASIZE(FirstVolName),true);
}
}
if (ItemPos==-1)
delete Vol; // Skip found file, it is not RAR or REV volume.
else
if ((uint)ItemPos<RecItems.Size()) // Check if found more REV than needed.
{
// Store found RAR or REV volume.
RecVolItem *Item=RecItems+ItemPos;
Item->f=Vol;
Item->New=false;
wcsncpyz(Item->Name,fd.Name,ASIZE(Item->Name));
}
}
if (!Silent || FoundRecVolumes!=0)
uiMsg(UIMSG_RECVOLFOUND,FoundRecVolumes);
if (FoundRecVolumes==0)
return false;
uiMsg(UIMSG_RECVOLCALCCHECKSUM);
MissingVolumes=0;
for (uint I=0;I<TotalCount;I++)
{
RecVolItem *Item=&RecItems[I];
if (Item->f!=NULL)
{
//.........这里部分代码省略.........
示例11: Restore
bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,const wchar *NameW,bool Silent)
{
char ArcName[NM];
wchar ArcNameW[NM];
strcpy(ArcName,Name);
wcscpy(ArcNameW,NameW);
char *Ext=GetExt(ArcName);
bool NewStyle=false;
bool RevName=Ext!=NULL && stricomp(Ext,".rev")==0;
if (RevName)
{
for (int DigitGroup=0;Ext>ArcName && DigitGroup<3;Ext--)
if (!IsDigit(*Ext))
if (IsDigit(*(Ext-1)) && (*Ext=='_' || DigitGroup<2))
DigitGroup++;
else
if (DigitGroup<2)
{
NewStyle=true;
break;
}
while (IsDigit(*Ext) && Ext>ArcName+1)
Ext--;
strcpy(Ext,"*.*");
if (*ArcNameW!=0)
{
wchar *ExtW=GetExt(ArcNameW);
for (int DigitGroup=0;ExtW>ArcNameW && DigitGroup<3;ExtW--)
if (!IsDigit(*ExtW))
if (IsDigit(*(ExtW-1)) && (*ExtW=='_' || DigitGroup<2))
DigitGroup++;
else
if (DigitGroup<2)
{
NewStyle=true;
break;
}
while (IsDigit(*ExtW) && ExtW>ArcNameW+1)
ExtW--;
wcscpy(ExtW,L"*.*");
}
FindFile Find;
Find.SetMask(ArcName);
Find.SetMaskW(ArcNameW);
FindData fd;
while (Find.Next(&fd))
{
Archive Arc(Cmd);
if (Arc.WOpen(fd.Name,fd.NameW) && Arc.IsArchive(true))
{
strcpy(ArcName,fd.Name);
wcscpy(ArcNameW,fd.NameW);
break;
}
}
}
Archive Arc(Cmd);
if (!Arc.WCheckOpen(ArcName,ArcNameW))
return(false);
if (!Arc.Volume)
{
#ifndef SILENT
Log(ArcName,St(MNotVolume),ArcName);
#endif
return(false);
}
bool NewNumbering=(Arc.NewMhd.Flags & MHD_NEWNUMBERING)!=0;
Arc.Close();
char *VolNumStart=VolNameToFirstName(ArcName,ArcName,NewNumbering);
char RecVolMask[NM];
strcpy(RecVolMask,ArcName);
size_t BaseNamePartLength=VolNumStart-ArcName;
strcpy(RecVolMask+BaseNamePartLength,"*.rev");
wchar RecVolMaskW[NM];
size_t BaseNamePartLengthW=0;
*RecVolMaskW=0;
if (*ArcNameW!=0)
{
wchar *VolNumStartW=VolNameToFirstName(ArcNameW,ArcNameW,NewNumbering);
wcscpy(RecVolMaskW,ArcNameW);
BaseNamePartLengthW=VolNumStartW-ArcNameW;
wcscpy(RecVolMaskW+BaseNamePartLengthW,L"*.rev");
}
#ifndef SILENT
int64 RecFileSize=0;
#endif
// We cannot display "Calculating CRC..." message here, because we do not
// know if we'll find any recovery volumes. We'll display it after finding
// the first recovery volume.
bool CalcCRCMessageDone=false;
FindFile Find;
//.........这里部分代码省略.........
示例12: if
Array<FileSystemInfo::FileInfo> FileSystemInfo::Find(String mask, int max_count, bool unmounted) const
{
Array<FileInfo> fi;
if(IsNull(mask))
{ // root
#ifdef PLATFORM_WINCE
FileInfo& f = fi.Add();
f.filename = "\\";
f.root_style = ROOT_FIXED;
#elif defined(PLATFORM_WIN32)
char drive[4] = "?:\\";
for(int c = 'A'; c <= 'Z'; c++) {
*drive = c;
int n = GetDriveType(drive);
if(n == DRIVE_NO_ROOT_DIR)
continue;
FileInfo& f = fi.Add();
f.filename = drive;
char name[256], system[256];
DWORD d;
if(c != 'A' && c != 'B' && n != DRIVE_REMOTE && n != DRIVE_UNKNOWN) {
bool b = GetVolumeInformation(drive, name, 256, &d, &d, &d, system, 256);
if(b) {
if(*name) f.root_desc << " " << FromSystemCharset(name);
}
else if(n == DRIVE_REMOVABLE || n == DRIVE_CDROM) {
if(unmounted) {
f.root_desc = t_("Empty drive");
} else {
fi.Drop();
continue;
}
}
}
switch(n)
{
default:
case DRIVE_UNKNOWN: f.root_style = ROOT_UNKNOWN; break;
case DRIVE_NO_ROOT_DIR: f.root_style = ROOT_NO_ROOT_DIR; break;
case DRIVE_REMOVABLE: f.root_style = ROOT_REMOVABLE; break;
case DRIVE_FIXED: f.root_style = ROOT_FIXED; break;
case DRIVE_REMOTE: f.root_style = ROOT_REMOTE; break;
case DRIVE_CDROM: f.root_style = ROOT_CDROM; break;
case DRIVE_RAMDISK: f.root_style = ROOT_RAMDISK; break;
}
}
#elif defined(PLATFORM_POSIX)
FileInfo& f = fi.Add();
f.filename = "/";
f.root_style = ROOT_FIXED;
#endif
}
else
{
FindFile ff;
if(ff.Search(mask))
do
{
FileInfo& f = fi.Add();
f.filename = ff.GetName();
#ifndef PLATFORM_POSIX
f.is_archive = ff.IsArchive();
f.is_compressed = ff.IsCompressed();
f.is_hidden = ff.IsHidden();
f.is_system = ff.IsSystem();
f.is_temporary = ff.IsTemporary();
#endif
f.is_read_only = ff.IsReadOnly();
f.length = ff.GetLength();
#ifdef PLATFORM_POSIX
f.creation_time = ff.GetLastChangeTime();
f.unix_mode = ff.GetMode();
#endif
f.last_access_time = ff.GetLastAccessTime();
f.last_write_time = ff.GetLastWriteTime();
#ifdef PLATFORM_WIN32
f.creation_time = ff.GetCreationTime();
f.unix_mode = 0;
#endif
f.read_only = ff.IsReadOnly();
f.is_directory = ff.IsDirectory();
f.is_folder = ff.IsFolder();
f.is_file = ff.IsFile();
#ifdef PLATFORM_POSIX
f.is_symlink = ff.IsSymLink();
#endif
}
while(ff.Next() && fi.GetCount() < max_count);
}
return fi;
}
示例13: Restore
bool RecVolumes::Restore(RAROptions *Cmd,const char *Name,
const wchar *NameW,bool Silent)
{
char ArcName[NM];
wchar ArcNameW[NM];
strcpy(ArcName,Name);
strcpyw(ArcNameW,NameW);
char *Ext=GetExt(ArcName);
bool NewStyle=false;
bool RevName=Ext!=NULL && stricomp(Ext,".rev")==0;
if (RevName)
{
for (int DigitGroup=0;Ext>ArcName && DigitGroup<3;Ext--)
if (!isdigit(*Ext))
{
if (isdigit(*(Ext-1)) && (*Ext=='_' || DigitGroup<2))
DigitGroup++;
else if (DigitGroup<2)
{
NewStyle=true;
break;
}
}
while (isdigit(*Ext) && Ext>ArcName+1)
Ext--;
strcpy(Ext,"*.*");
FindFile Find;
Find.SetMask(ArcName);
struct FindData FD;
while (Find.Next(&FD))
{
Archive Arc(Cmd);
if (Arc.WOpen(FD.Name,FD.NameW) && Arc.IsArchive(true))
{
strcpy(ArcName,FD.Name);
*ArcNameW=0;
break;
}
}
}
Archive Arc(Cmd);
if (!Arc.WCheckOpen(ArcName,ArcNameW))
return(false);
if (!Arc.Volume)
{
#ifndef SILENT
Log(ArcName,St(MNotVolume),ArcName);
#endif
return(false);
}
bool NewNumbering=(Arc.NewMhd.Flags & MHD_NEWNUMBERING);
Arc.Close();
char *VolNumStart=VolNameToFirstName(ArcName,ArcName,NewNumbering);
char RecVolMask[NM];
strcpy(RecVolMask,ArcName);
int BaseNamePartLength=VolNumStart-ArcName;
strcpy(RecVolMask+BaseNamePartLength,"*.rev");
#ifndef SILENT
Int64 RecFileSize=0;
#endif
FindFile Find;
Find.SetMask(RecVolMask);
struct FindData RecData;
int FileNumber=0,RecVolNumber=0,FoundRecVolumes=0,MissingVolumes=0;
char PrevName[NM];
while (Find.Next(&RecData))
{
char *Name=RecData.Name;
int P[3];
if (!RevName && !NewStyle)
{
NewStyle=true;
char *Dot=GetExt(Name);
if (Dot!=NULL)
{
int LineCount=0;
Dot--;
while (Dot>Name && *Dot!='.')
{
if (*Dot=='_')
LineCount++;
Dot--;
}
if (LineCount==2)
NewStyle=false;
}
}
if (NewStyle)
{
File CurFile;
CurFile.TOpen(Name);
CurFile.Seek(0,SEEK_END);
Int64 Length=CurFile.Tell();
CurFile.Seek(Length-7,SEEK_SET);
for (int I=0;I<3;I++)
P[2-I]=CurFile.GetByte()+1;
uint FileCRC=0;
for (int I=0;I<4;I++)
//.........这里部分代码省略.........