Beispiel #1
0
void CLogOutput::Initialize()
{
    if (initialized) return;

    filePath = CreateFilePath(fileName);
    RotateLogFile();

    /*filelog = new std::ofstream(filePath.c_str());
    if (filelog->bad())
    	SafeDelete(filelog);*/
    const bool flush = configHandler->GetBool("LogFlush");
    log_file_addLogFile(filePath.c_str(), NULL, LOG_LEVEL_ALL, flush);

    initialized = true;
    InitializeSections();

    /*std::vector<std::string>::iterator pili;
    for (pili = preInitLog().begin(); pili != preInitLog().end(); ++pili) {
    	ToFile(*pili);
    }
    preInitLog().clear();*/

    LOG("LogOutput initialized.");
    LOG("Spring %s", SpringVersion::GetFull().c_str());
    LOG("Build date/time: %s", SpringVersion::GetBuildTime().c_str());
    LOG("Build environment: %s", SpringVersion::GetBuildEnvironment().c_str());
    LOG("Compiler: %s", SpringVersion::GetCompiler().c_str());
}
Beispiel #2
0
void CLogOutput::Initialize()
{
	if (initialized) return;

	filePath = CreateFilePath(fileName);
	RotateLogFile();

	filelog = new std::ofstream(filePath.c_str());
	if (filelog->bad())
		SafeDelete(filelog);

	initialized = true;
	InitializeSections();

	std::vector<std::string>::iterator pili;
	for (pili = preInitLog().begin(); pili != preInitLog().end(); ++pili) {
		ToFile(*pili);
	}
	preInitLog().clear();

	LOG("LogOutput initialized.");
	LOG("Spring %s", SpringVersion::GetFull().c_str());
	LOG("Build date/time: %s", SpringVersion::GetBuildTime().c_str());
	LOG("Build environment: %s", SpringVersion::GetBuildEnvironment().c_str());
	LOG("Compiler: %s", SpringVersion::GetCompiler().c_str());
}
Beispiel #3
0
void CLogOutput::Initialize()
{
    assert(configHandler != NULL);

    if (IsInitialized())
        return;

    filePath = CreateFilePath(fileName);

    if (configHandler->GetBool("RotateLogFiles"))
        RotateLogFile();

    log_file_addLogFile(filePath.c_str(), NULL, LOG_LEVEL_ALL, configHandler->GetInt("LogFlushLevel"));
    InitializeLogSections();

    LOG("LogOutput initialized.");
}
inline tstring get_ini_file_name(LPCTSTR pszFileName)
{
	return CreateFilePath(pszFileName);
}
Beispiel #5
0
void SaveDialog::CreateDialog()
{
    CreateFilePath();
    CreateEncode();
    CreateButtonBox();
}
Beispiel #6
0
BOOL CUnzipper::UnzipFile(LPCTSTR szFolder, BOOL bIgnoreFilePath)
{
	if (!m_uzFile)
		return FALSE;

	if (!szFolder)
		szFolder = m_szOutputFolder;

	if (!CreateFolder(szFolder))
		return FALSE;

	UZ_FileInfo info;
	GetFileInfo(info);

	// if the item is a folder then simply return 'TRUE'
	if (info.szFileName[lstrlen(info.szFileName) - 1] == '\\')
		return TRUE;

	// build the output filename
	TCHAR szFilePath[MAX_PATH];
	wcscpy_s(szFilePath, MAX_PATH, szFolder);

	// append backslash
	if (szFilePath[lstrlen(szFilePath) - 1] != '\\')
		lstrcat(szFilePath, _T("\\"));

	if (bIgnoreFilePath)
	{
		TCHAR* p = _tcsrchr(info.szFileName, '\\');

		if (p)
			_tcscpy_s(info.szFileName, MAX_PATH+1,p + 1);
	}

	TCHAR szFileName[MAX_PATH+1];

	_tcscat_s(szFilePath, MAX_PATH, szFileName);
		
	// open the input and output files
	if (!CreateFilePath(szFilePath))
		return FALSE;

	HANDLE hOutputFile = ::CreateFile(szFilePath, 
										GENERIC_WRITE,
										0,
										NULL,
										CREATE_ALWAYS,
										FILE_ATTRIBUTE_NORMAL,
										NULL);

	if (INVALID_HANDLE_VALUE == hOutputFile)
		return FALSE;

	// read the file and output
	int nRet = UNZ_OK; 
	TCHAR pBuffer[BUFFERSIZE];
	mUnzipData.message = ZLIBCBFN_FILE;
	do
	{
		nRet = unzReadCurrentFile(m_uzFile, pBuffer, BUFFERSIZE);

		if (nRet > 0)
		{
			// output
			DWORD dwBytesWritten = 0;
			if (!::WriteFile(hOutputFile, pBuffer, nRet, &dwBytesWritten, NULL) ||
				dwBytesWritten != (DWORD)nRet)
			{
				nRet = UNZ_ERRNO;
				break;
			}
			mUnzipData.szBytesProcessed = dwBytesWritten;
			if (mCallbackFn(&mUnzipData) != ZLIBCBFN_CONTINUE) {
				nRet = UNZ_ERRNO; // User says abort
				break;
			}
		}
	}
	while (nRet > 0);

	CloseHandle(hOutputFile);
	unzCloseCurrentFile(m_uzFile);

	if (nRet == UNZ_OK)
		SetFileModTime(szFilePath, info.dwDosDate);

	return (nRet == UNZ_OK);
}