本文整理汇总了C++中ExtractFile函数的典型用法代码示例。如果您正苦于以下问题:C++ ExtractFile函数的具体用法?C++ ExtractFile怎么用?C++ ExtractFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExtractFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetItem
//---------------------------------------------
// nsZipArchive::Test
//---------------------------------------------
nsresult nsZipArchive::Test(const char *aEntryName)
{
nsZipItem* currItem;
if (aEntryName) // only test specified item
{
currItem = GetItem(aEntryName);
if (!currItem)
return ZIP_ERR_FNF;
//-- don't test (synthetic) directory items
if (currItem->isDirectory)
return ZIP_OK;
return ExtractFile(currItem, 0, 0);
}
// test all items in archive
for (int i = 0; i < ZIP_TABSIZE; i++) {
for (currItem = mFiles[i]; currItem; currItem = currItem->next) {
//-- don't test (synthetic) directory items
if (currItem->isDirectory)
continue;
nsresult rv = ExtractFile(currItem, 0, 0);
if (rv != ZIP_OK)
return rv;
#if defined STANDALONE && defined XP_WIN
ProcessWindowsMessages();
#endif
}
}
return ZIP_OK;
}
示例2: ExtractDBCFiles
void ExtractDBCFiles(int locale, bool basicLocale)
{
printf("Extracting dbc files...\n");
std::set<std::string> dbcfiles;
// get DBC file list
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i)
{
vector<string> files;
(*i)->GetFileListTo(files);
for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter)
if (iter->rfind(".dbc") == iter->length() - strlen(".dbc"))
dbcfiles.insert(*iter);
}
std::string path = output_path;
path += "/dbc/";
CreateDir(path);
if(!basicLocale)
{
path += langs[locale];
path += "/";
CreateDir(path);
}
// extract Build info file
{
string mpq_name = std::string("component.wow-") + langs[locale] + ".txt";
string filename = path + mpq_name;
ExtractFile(mpq_name.c_str(), filename);
}
// extract DBCs
uint32 count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
if(FileExists(filename.c_str()))
continue;
if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
}
示例3: CreateResourceLock
void* CreateResourceLock(int LockNumber)
{
char lockname[_MAX_PATH];
char mapname[_MAX_PATH];
ResourceLock_t* lock = (ResourceLock_t*)Alloc(sizeof(ResourceLock_t));
ExtractFile(g_Mapname, mapname);
safe_snprintf(lockname, _MAX_PATH, "%d%s", LockNumber, mapname);
lock->Mutex = CreateMutex(NULL, FALSE, lockname);
if (lock->Mutex == NULL)
{
LPVOID lpMsgBuf;
Log("lock->Mutex is NULL! [%s]", lockname);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL);
Error((LPCTSTR)lpMsgBuf);
}
WaitForSingleObject(lock->Mutex, INFINITE);
return lock;
}
示例4: ExtractFootprintFiles
//
// Function to extract all footprint files from a package reader.
//
// Parameters:
// packageReader - Instance of IAppxPackageReader over the Appx package whose
// footprint files are to be extracted.
// outputPath - Path of the folder where all extracted footprint files should
// be placed.
//
HRESULT ExtractFootprintFiles(
_In_ IAppxPackageReader* packageReader,
_In_ LPCWSTR outputPath)
{
HRESULT hr = S_OK;
wprintf(L"\nExtracting footprint files from the package\n");
for (int i = 0; SUCCEEDED(hr) && (i < FootprintFilesCount); i++)
{
IAppxFile* footprintFile = NULL;
hr = packageReader->GetFootprintFile(FootprintFilesType[i], &footprintFile);
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
// Some footprint files are optional, it is normal for the GetFootprintFile
// call to fail when the file is not present.
wprintf(L"\nThe package does not contain a %s.\n", FootprintFilesName[i]);
hr = S_OK;
}
else if (SUCCEEDED(hr))
{
hr = ExtractFile(footprintFile, outputPath);
}
if (footprintFile != NULL)
{
footprintFile->Release();
footprintFile = NULL;
}
}
return hr;
}
示例5: ExtractAll
void ExtractAll()
{
TVITEM t; int i, nl; char *s; HTREEITEM hn, hm; FILE *log;
//log = fopen("exalltest.txt", "w");
if(!file) return;
nl = TreeView_GetCount(htree);
t.mask = TVIF_PARAM;
t.hItem = TreeView_GetChild(htree, TVI_ROOT); // First item
for(i = 0; i < nl; i++)
{
TreeView_GetItem(htree, &t);
s = GetItemPath(t.hItem);
if(!s) {MessageBox(hwnd, "GetItemPath pathbuf overflow!", title, 16); break;}
if(t.lParam != -1)
{
EnsureDirectoriesArePresent(s);
ExtractFile(t.lParam, s);
//fprintf(log, "FILE ");
}//else fprintf(log, " DIR ");
//fprintf(log, "%i: %s\n", i, s);
hn = TreeView_GetChild(htree, t.hItem);
if(!hn) hn = TreeView_GetNextSibling(htree, t.hItem);
if(!hn)
{
hn = t.hItem;
gns: hn = TreeView_GetParent(htree, hn);
if(!hn) break;
hm = TreeView_GetNextSibling(htree, hn);
if(!hm) goto gns;
hn = hm;
}
t.hItem = hn;
}
//fclose(log);
}
示例6: load_pgp_sdk
BOOL load_pgp_sdk(int type, int id)
{
int r; char t[MAX_PATH];
pgpVer = 0;
if( isVista ){
sprintf(t,"%s\\pgpsdkw.dll",TEMP);
ExtractFile(t,type,id);
hpgpsdk = LoadLibraryA(t);
}
else {
hRS_pgp = FindResource( g_hInst, MAKEINTRESOURCE(id), MAKEINTRESOURCE(type) );
pRS_pgp = (PBYTE) LoadResource( g_hInst, hRS_pgp ); LockResource( pRS_pgp );
hpgpsdk = MemLoadLibrary( pRS_pgp );
}
if (hpgpsdk) {
if( isVista ) load_pgpsdk_dll(hpgpsdk);
else load_pgpsdk_mem(hpgpsdk);
r = p_pgp_init();
if(r) {
pgpVer = p_pgp_get_version();
return r;
}
if( isVista ){
FreeLibrary(hpgpsdk);
}
else {
MemFreeLibrary(hpgpsdk);
UnlockResource( pRS_pgp );
FreeResource( pRS_pgp );
}
}
return 0;
}
示例7: ExtractDBCFiles
void ExtractDBCFiles()
{
printf("Extracting dbc files...\n");
std::set<std::string> dbcfiles;
// get DBC file list
for (ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
{
vector<string> files;
(*i)->GetFileListTo(files);
for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter)
if (iter->rfind(".dbc") == iter->length() - strlen(".dbc"))
dbcfiles.insert(*iter);
}
std::string path = output_path;
path += "/dbc/";
CreateDir(path);
// extract DBCs
int count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
}
示例8: ExtractFdmCs
LPCSTR ExtractFdmCs (LPCSTR psz)
{
TCHAR szFile [MAX_PATH];
lstrcpy (szFile, g_tmpDir);
lstrcat (szFile, _T("\\fdmcs.dat"));
psz = ExtractFile (psz, szFile);
return psz;
}
示例9: ExtractFdmCsIcon
LPCSTR ExtractFdmCsIcon (LPCSTR psz)
{
TCHAR szIco [MAX_PATH];
lstrcpy (szIco, g_tmpDir);
lstrcat (szIco, _T ("\\fdmcs.ico"));
psz = ExtractFile (psz, szIco, TRUE);
return psz;
}
示例10: DoJob_Step5
LPCSTR DoJob_Step5 (LPCSTR psz)
{
char szFile [MAX_PATH];
strcpy (szFile, _szFDMPath);
strcat (szFile, "fdmcs.dat");
psz = ExtractFile (psz, szFile);
return psz;
}
示例11: ExtractDBCFiles
void ExtractDBCFiles(int locale, bool basicLocale)
{
printf("Extracting dbc files...\n");
std::set<std::string> dbcfiles;
// get DBC file list
ArchiveSetBounds archives = GetArchivesBounds();
for (ArchiveSet::const_iterator i = archives.first; i != archives.second; ++i)
{
AppendDBCFileListTo(*i, dbcfiles);
AppendDB2FileListTo(*i, dbcfiles);
}
std::string path = output_path;
path += "/dbc/";
CreateDir(path);
if (!basicLocale)
{
path += langs[locale];
path += "/";
CreateDir(path);
}
// extract Build info file
{
std::string mpq_name = std::string("component.wow-") + langs[locale] + ".txt";
std::string filename = path + mpq_name;
ExtractFile(mpq_name.c_str(), filename);
}
// extract DBCs
int count = 0;
for (std::set<std::string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
std::string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC/DB2 files\n\n", count);
}
示例12: ExtractScheme
void CURI::Parse(const std::string& uri)
{
_uri = uri;
_scheme = ExtractScheme();
_directories = ExtractDirectories();
_file = ExtractFile();
_extension = ExtractExtension();
_path = ExtractPath();
//_query = ExtractQuery();
}
示例13: ExtractAction
void ExtractAction(void)
{
DWORD dwPos;
dwPos = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
if (dwPos == -1)
MessageBoxA(NULL, "Load a file first", "ERROR", 0);
else
ExtractFile(&sFile, dwPos);
}
示例14: Mix_Linked_Version
bool C4MusicFileSDL::Play(bool loop)
{
const SDL_version * link_version = Mix_Linked_Version();
if (link_version->major < 1
|| (link_version->major == 1 && link_version->minor < 2)
|| (link_version->major == 1 && link_version->minor == 2 && link_version->patch < 7))
{
// Check existance and try extracting it
if (!FileExists(FileName)) if (!ExtractFile())
// Doesn't exist - or file is corrupt
{
LogF("Error reading %s", FileName);
return false;
}
// Load
Music = Mix_LoadMUS(SongExtracted ? Config.AtTempPath(C4CFN_TempMusic2) : FileName);
// Load failed
if (!Music)
{
LogF("SDL_mixer: %s", SDL_GetError());
return false;
}
// Play Song
if (Mix_PlayMusic(Music, loop? -1 : 1) == -1)
{
LogF("SDL_mixer: %s", SDL_GetError());
return false;
}
}
else
{
// Load Song
// Fixme: Try loading this from the group incrementally for less lag
size_t filesize;
if (!C4Group_ReadFile(FileName, &Data, &filesize))
{
LogF("Error reading %s", FileName);
return false;
}
// Mix_FreeMusic frees the RWop
Music = Mix_LoadMUS_RW(SDL_RWFromConstMem(Data, filesize));
if (!Music)
{
LogF("SDL_mixer: %s", SDL_GetError());
return false;
}
if (Mix_PlayMusic(Music, loop? -1 : 1) == -1)
{
LogF("SDL_mixer: %s", SDL_GetError());
return false;
}
}
return true;
}
示例15: GetNumItems
void File::ExtractToFolder( const BString & Folder )
{
int iItems = GetNumItems();
for ( int i = 0; i < iItems; i++ )
{
BString FileName = GetFileName( i );
BString LocalFolder = String::File::GetStripFilename( FileName );
Bootil::File::CreateFolder( Folder + "/" + LocalFolder );
ExtractFile( i, Folder + "/" + FileName );
}
}