示例#1
0
int main(int argc, char *argv[])
{
	SetConsoleTitle("YTDYDRYDDYFT2TXDDFFCOL");
	if(settings.m_bEnableLog)
		LOG_OPEN();
	
	if (argc > 1)
	{
		printf("argc=%d\n", argc);
		UINT8 i;
		for ( i= 1; i < argc; i++)
		{
			if (argv[i]!=NULL)
				printf("arg%d\t%s\n", i, argv[i]);
		}

		char ext[4];
		i = strlen(argv[1]);
		ext[0] = argv[1][i - 3];
		ext[1] = argv[1][i - 2];
		ext[2] = argv[1][i - 1];
		ext[3] = 0;
		//strcpy(ext, argv[1]+strlen(argv[1]) - 3);
		if (strcmp(ext,"ydr")==0)
		{
			ConvertYDR(argv[1]);
		}

	}
	else{
		LOGL("No arguments. Searching file..");
		LOGL("Searching for ytd...");
		SearchFiles("*.ytd", (LPSEARCHFUNC)ConvertYTD);
		LOGL("Searching for ydr...");
		SearchFiles("*.ydr", (LPSEARCHFUNC)ConvertYDR);
		LOGL("Searching for ydd...");
		SearchFiles("*.ydd", (LPSEARCHFUNC)ConvertYDD);
		LOGL("Searching for yft...");
		SearchFiles("*.yft", (LPSEARCHFUNC)ConvertYFT);

	}

	LOG_CLOSE();
	printf("\nConversion finished.");

	getchar();
	return 1;
}
示例#2
0
DWORD WINAPI SearchThread (LPVOID IpParam)
{	
	SearchFiles( mPathOut, FileList, mbInnerFolders, SizePathOut );
	hThread = NULL;
	SetEvent( hEvent );
	return 0;
}
示例#3
0
FileParser::FileParser()
{
    path = QString("./");
    thread = new QThread();
    connect(thread,SIGNAL(started()),this,SLOT(SearchFiles()));
    connect(thread,SIGNAL(finished()),this,SLOT(Complete()));
}
示例#4
0
void InitTextures()
{
	char result[100];

	strcpy(result, path_textures);
	strcat(result, "\\*.bmp");
	SearchFiles(result, (LPSEARCHFUNC)LoadTexture, true);
}
示例#5
0
void InitDefinitions()
{
	char result[100];

	strcpy(result, path_def);
	strcat(result, "\\*.def");
	SearchFiles(result, (LPSEARCHFUNC)Load, true);
}
void AllFiles::RewriteList()
{
	//std::lock_guard<std::mutex> guard(g_MutexFile);
	m_ClFiles.clear();
	unsigned long count = 0;
	char strPath[256] = "";
	strcpy(strPath, m_MainPath);
	SearchFiles(strPath, count);
}
示例#7
0
int KGFileManager::ComparePathFiles(const char cszPath_1[], const char cszPath_2[], const char cszExt[])
{
	int nComparedFilesNum = 0;
	int nRetCode = false;
	char szResult[2 * MAX_PATH] = {0};
	vector<string> vecFileList_1;
	vector<string> vecFileList_2;

	KG_ASSERT_EXIT(cszPath_1);
	KG_ASSERT_EXIT(cszPath_1[0] != '\0');
	KG_ASSERT_EXIT(cszPath_2);
	KG_ASSERT_EXIT(cszPath_2[0] != '\0');

	nRetCode = SearchFiles(cszPath_1, &vecFileList_1, cszExt);
	KGLOG_PROCESS_ERROR(nRetCode);
	nRetCode = SearchFiles(cszPath_2, &vecFileList_2, cszExt);
	KGLOG_PROCESS_ERROR(nRetCode);

	if (vecFileList_1.size() != vecFileList_2.size())
	{
		nRetCode = _snprintf_s(
			szResult, 
			sizeof(szResult),
			sizeof(szResult) - 1,
			"The number of files in path is different. Path_1=%s Path_2=%s",
			cszPath_1,
			cszPath_2
			);
		KGLOG_PROCESS_ERROR(nRetCode > 0);
		KGLogPrintf(KGLOG_ERR, szResult);
		KGLOG_PROCESS_ERROR(false);
	}

	for (size_t i = 0; i < vecFileList_1.size(); i++)
	{
		nRetCode = CompareFileByDataStream(vecFileList_1[i].c_str(), vecFileList_2[i].c_str());
		KGLOG_PROCESS_ERROR(nRetCode);
	}

	nComparedFilesNum =  (int)vecFileList_1.size();
Exit0:
	return nComparedFilesNum;
}
示例#8
0
FileParser::~FileParser()
{
    while (ImageTable.size())
    {
        delete ImageTable.at(0);
        ImageTable.removeAt(0);
    }
    listOfFiles.clear();
    disconnect(thread,SIGNAL(started()),this,SLOT(SearchFiles()));
    disconnect(thread,SIGNAL(finished()),this,SLOT(Complete()));
    delete thread;
}
void AllFiles::SetMainPath(CString Path)
{
	//std::lock_guard<std::mutex> guard(g_MutexFile);
	if (Path.GetLength() > 1)
	{
		m_MainPath = Path;
		unsigned long count = 0;
		char strPath[256] = "";
		strcpy(strPath, m_MainPath);
		SearchFiles(strPath, count);
	}
}
示例#10
0
void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs)
{
    if (fns.IsEmpty()) {
        return;
    }

    const CAppSettings& s = AfxGetAppSettings();

    ResolveLinkFiles(fns);

    CAtlList<CString> sl;
    if (SearchFiles(fns.GetHead(), sl)) {
        if (sl.GetCount() > 1) {
            subs = NULL;
        }
        POSITION pos = sl.GetHeadPosition();
        while (pos) {
            ParsePlayList(sl.GetNext(pos), subs);
        }
        return;
    }

    CAtlList<CString> redir;
    CStringA ct = GetContentType(fns.GetHead(), &redir);
    if (!redir.IsEmpty()) {
        POSITION pos = redir.GetHeadPosition();
        while (pos) {
            ParsePlayList(sl.GetNext(pos), subs);
        }
        return;
    }

    if (ct == "application/x-mpc-playlist") {
        ParseMPCPlayList(fns.GetHead());
        return;
    } else {
#if INTERNAL_SOURCEFILTER_MPEG
        if (ct == "application/x-bdmv-playlist" && s.SrcFilters[SRC_MPEG]) {
            ParseBDMVPlayList(fns.GetHead());
            return;
        }
#endif
    }

    AddItem(fns, subs);
}
示例#11
0
	bool SearchFiles(const TString& directory, TStrings & files, bool subFolders, const TString & mask)
	{
		if(!IsDirectoryExists(directory.c_str()))
			return false;

		TString path;
		HANDLE hFind;
		WIN32_FIND_DATA findData;
		TString searchPath;

		if(subFolders)
		{
			searchPath = CreatePath(directory, TEXT("*"));
			hFind = ::FindFirstFile(searchPath.c_str(), &findData);
			if(hFind != INVALID_HANDLE_VALUE) 
			{
				do 
				{
					TString name = findData.cFileName;
					if(name == TEXT(".") || name == TEXT(".."))
						continue;
					if((findData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
						SearchFiles(CreatePath(directory, name), files, subFolders, mask);
				} while(::FindNextFile(hFind, &findData)); 
				::FindClose(hFind);
			}
		}

		searchPath = CreatePath(directory, mask);
		hFind = ::FindFirstFile(searchPath.c_str(), &findData);
		if(hFind != INVALID_HANDLE_VALUE) 
		{
			do 
			{
				TString name = findData.cFileName;
				if(name == TEXT(".") || name == TEXT(".."))
					continue;
				if((findData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) == 0)
					files.push_back(CreatePath(directory, name));
			} while(::FindNextFile(hFind, &findData)); 
			::FindClose(hFind);
		}

		return true;
	}
示例#12
0
bool zs_ut_s::DeleteRecursionDir(std::string path)
{
	std::vector<_FileInfo> files;
	SearchFiles(path, files);

	for (std::vector<_FileInfo>::const_reverse_iterator iter =files.rbegin(); iter != files.rend(); ++iter)
	{
		if (iter->bDir)
		{
			zs_ut_s::DeleteDir(iter->fullpath);
		}
		else
		{
			zs_ut_s::DeleteFileZ(iter->fullpath);
		}
	}
	return zs_ut_s::DeleteDir(path);
}
示例#13
0
BOOL CFileHelper::SearchFiles(const TCHAR* chFolderPath, const TCHAR* chFilter, vector<CString>& vcFound, BOOL bFindFolder)
{
	//assert(pFindProc); 
	int nPathLen = _tcslen(chFolderPath) + MAX_PATH; 
	TCHAR* pChPath = new TCHAR[nPathLen];
	//sprintf_s(pChPath, nPathLen, "%s\\%s", chFolderPath, chFilter);
	_stprintf_s(pChPath, nPathLen, _T("%s\\%s"), chFolderPath, chFilter);
	WIN32_FIND_DATA fileFindData;
	HANDLE hFind = ::FindFirstFile(pChPath, &fileFindData);            //找到第一个

	if (hFind == INVALID_HANDLE_VALUE)        //如果没有找到相关的文件信息,返回FALSE
	{
		delete pChPath;
		return FALSE;
	}

	//处理之后查找下一个,直到都找完
	do 
	{
		if (fileFindData.cFileName[0] == '.')
		{
			continue;            //因为文件夹开始有"."和".."两个目录,要过滤掉
		}

		_stprintf_s(pChPath, nPathLen, _T("%s\\%s"), chFolderPath, fileFindData.cFileName);    //文件的完整路径

		//如果要查找递归查找文件夹
		if (bFindFolder && (fileFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			SearchFiles(pChPath, chFilter, vcFound, bFindFolder);            //递归调用来查找他的子目录
		}

		//如果是文件
		//pFindProc(pChPath);
		vcFound.push_back(pChPath);

	}while (::FindNextFile(hFind, &fileFindData)); 

	FindClose(hFind);                //关闭查找句柄
	delete pChPath;    
	return TRUE;
}
示例#14
0
void AllFiles::SearchFiles(const char* path, unsigned long& count)
{
	AccessFile pAccFile;
	ClientFile pClFile;
	char direct[256] = "";
	char direct_copy[256] = "";
	strcpy(direct, path);
	strcat(direct, "\\*.*");
	_finddata_t* fi = new _finddata_t;//alternative - unique_ptr<_finddata_t> fi(new _finddata_t);
	intptr_t handle = 0, copy_handle = 0;
	handle = copy_handle = _findfirst(direct, fi);//handle = copy_handle = _findfirst(dir, fi.get());
	while (copy_handle != -1)
	{
		if (fi->name[0] != '.')
		{
			if (fi->attrib & _A_SUBDIR)
			{
				strcpy(direct_copy, path);
				strcat(direct_copy, "\\");
				strcat(direct_copy, fi->name);
				SearchFiles(direct_copy, count);
			}
			else
			{
				itoa(count, pAccFile.IDFile, 10);
				GetMask(pAccFile.name, pAccFile.mask, fi->name);
				//strcpy(pAccFile.size, std::to_string(fi->size).c_str());
				GetFileSize(pAccFile.size, fi->size);
				CString PathFile = path;
				pClFile.SetClientFile(pAccFile, PathFile);
				m_ClFiles.emplace_back(pClFile);
				count++;
			}
		}
		copy_handle = _findnext(handle, fi);
	}
	_findclose(handle);
	_findclose(copy_handle);
	if (fi)
		delete fi;
}
示例#15
0
BOOL SearchFiles(LPCTSTR lpszFileName, LPSEARCHFUNC lpSearchFunc, BOOL bInnerFolders = TRUE)
{
    LPTSTR part;
    char tmp[MAX_PATH]; // временный массив
    char name[MAX_PATH];

    HANDLE hSearch = NULL;
    WIN32_FIND_DATA wfd;
    memset(&wfd, 0, sizeof(WIN32_FIND_DATA));

    // сначало поиск внутри вложенных папках ...
    if(bInnerFolders)
    {
        if(GetFullPathName(lpszFileName, MAX_PATH, tmp, &part) == 0) return FALSE;
        strcpy(name, part);
        strcpy(part, "*.*");

        // если папки существуют, то делаем поиск
        wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
        if (!((hSearch = FindFirstFile(tmp, &wfd)) == INVALID_HANDLE_VALUE))
        do
        {
            // в каждой папке есть две папки с именами "." и ".."
            // и эти папки мы не трогаем

            // пропускаем папки "." и ".."
            if (!strncmp(wfd.cFileName, ".", 1) || !strncmp(wfd.cFileName, "..", 2))            
            continue;
        
            if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // если мы нашли папку
            {
                char next[MAX_PATH];
                if(GetFullPathName(lpszFileName, MAX_PATH, next, &part) == 0) return FALSE;
                strcpy(part, wfd.cFileName);
                strcat(next, "\\");
                strcat(next, name);

                SearchFiles(next, lpSearchFunc, TRUE);
            }
        }
        while (FindNextFile(hSearch, &wfd)); // ищем следующий файл

        FindClose (hSearch); // заканчиваем поиск
    }

    if ((hSearch = FindFirstFile(lpszFileName, &wfd)) == INVALID_HANDLE_VALUE) 
        return TRUE; // в противном случае выходим
    do
    if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) // если мы нашли файл
    {
        char file[MAX_PATH];
        if(GetFullPathName(lpszFileName, MAX_PATH, file, &part) == 0) return FALSE;
        strcpy(part, wfd.cFileName);

        lpSearchFunc(file);
    }
    while (FindNextFile(hSearch, &wfd)); // ищем следующий файл
    FindClose (hSearch); // заканчиваем поиск

    return TRUE;
}
void
CBSearchTextDialog::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == GetFindFwdButton() && message.Is(JXButton::kPushed) &&
		(itsMultifileCB->IsChecked() || itsSearchDirCB->IsChecked()))
		{
		SearchFiles();
		}
	else if (sender == GetReplaceAllFwdButton() && message.Is(JXButton::kPushed) &&
			 (itsMultifileCB->IsChecked() || itsSearchDirCB->IsChecked()))
		{
		SearchFilesAndReplace();
		}

	else if (sender == itsFileList && message.Is(JXFileListTable::kProcessSelection))
		{
		OpenSelectedFiles();
		}
	else if (sender == itsFileList &&
			 (message.Is(JTable::kRowsInserted) ||
			  message.Is(JTable::kRowsRemoved)))
		{
		UpdateDisplay();
		}

	else if (sender == itsFileListMenu && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateFileListMenu();
		}
	else if (sender == itsFileListMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleFileListMenu(selection->GetIndex());
		}

	else if (sender == itsSearchDirCB && message.Is(JXCheckbox::kPushed))
		{
		UpdateDisplay();
		}
	else if (sender == itsDirInput &&
			 (message.Is(JTextEditor::kTextChanged) ||
			  message.Is(JTextEditor::kTextSet)))
		{
		itsSearchDirCB->SetState(kJTrue);
		}
	else if (sender == itsMultifileCB && message.Is(JXCheckbox::kPushed))
		{
		const JBoolean on = itsMultifileCB->IsChecked();
		if (on && itsFileList->GetRowCount() == 0)
			{
			AddSearchFiles();
			}
		UpdateDisplay();
		}

	else if (sender == CBGetDocumentManager() &&
			 message.Is(CBDocumentManager::kProjectDocumentActivated))
		{
		UpdateBasePath();
		}
	else if (sender == itsChooseDirButton && message.Is(JXButton::kPushed))
		{
		itsDirInput->ChoosePath("");
		itsSearchDirCB->SetState(kJTrue);
		}

	else if (sender == itsDirHistory && message.Is(JXMenu::kItemSelected))
		{
		JBoolean recurse;
		itsDirInput->SetText(itsDirHistory->GetPath(message, &recurse));
		itsRecurseDirCB->SetState(recurse);
		itsSearchDirCB->SetState(kJTrue);
		}
	else if (sender == itsFileFilterHistory && message.Is(JXMenu::kItemSelected))
		{
		JBoolean invert;
		itsFileFilterInput->SetText(itsFileFilterHistory->GetFilter(message, &invert));
		itsInvertFileFilterCB->SetState(invert);
		itsSearchDirCB->SetState(kJTrue);
		}
	else if (sender == itsPathFilterHistory && message.Is(JXMenu::kItemSelected))
		{
		JBoolean invert;
		itsPathFilterInput->SetText(itsPathFilterHistory->GetFilter(message, &invert));
		itsSearchDirCB->SetState(kJTrue);
		}

	else
		{
		JXSearchTextDialog::Receive(sender, message);
		}
}