Beispiel #1
0
bool CTemplateParserApp::HandleStaticFiles(SgmlElement *pStaticFiles)
{
   bool success = true;

   SgmlElement *pFile = pStaticFiles->Find("file");
   while (pFile && success)
   {
      CString csSource;
      CString csTarget;
      success = GetFileNames(pFile, csSource, csTarget, false);

      m_writtenFiles.Add(csTarget);

      success = LIo::CopyFile(csSource, csTarget);
      if (!success)
      {
         // TPERR_COPY_FAILED
         // config.xml: Beim Kopieren der Datei '%s' ist ein Fehler aufgetreten.
         // config.xml: Copying the file '%s' failed.
         MakeErrorMessage(TPERR_COPY_FAILED, csSource);
      }
      
      pFile = pFile->GetNext();
   }

   return success;
}
Beispiel #2
0
DBOOL CShellCasingFX::CreateObject(CClientDE *pClientDE)
{
	if (!CSpecialFX::CreateObject(pClientDE)) return DFALSE;

	char* pModelName = DNULL;
	char* pSkinName = DNULL;
	if (!GetFileNames(&pModelName, &pSkinName))
		return DFALSE;

	if (!pModelName || !pSkinName) return DFALSE;

	// Setup the shell...

	ObjectCreateStruct createStruct;
	INIT_OBJECTCREATESTRUCT(createStruct);

	createStruct.m_ObjectType = OT_MODEL;
	createStruct.m_Flags = 0;
	_mbscpy((unsigned char*)createStruct.m_Filename, (const unsigned char*)pModelName);
	_mbscpy((unsigned char*)createStruct.m_SkinName, (const unsigned char*)pSkinName);
	VEC_COPY(createStruct.m_Pos, m_vStartPos);
	ROT_COPY(createStruct.m_Rotation, m_rRot);

	m_hObject = pClientDE->CreateObject(&createStruct);
	if (!m_hObject) return DFALSE;


	m_pClientDE->SetObjectScale(m_hObject, &m_vScale);

	DVector vU, vR, vF;
	pClientDE->GetRotationVectors(&m_rRot, &vU, &vR, &vF);

	DVector vVel;

	if(m_bLeftHanded)
		VEC_NEGATE(vR, vR);

	DFLOAT fUpVel = GetRandom(60.0f, 90.0f);
	VEC_MULSCALAR(vU, vU, fUpVel);
	DFLOAT fRightVel = GetRandom(50.0f, 70.0f);
	VEC_MULSCALAR(vR, vR, fRightVel);
	DFLOAT fForwardVel = GetRandom(10.0f, 25.0f);
	VEC_MULSCALAR(vF, vF, fForwardVel);

	VEC_ADD(vVel, vU, vR);
	VEC_ADD(vVel, vVel, vF);

	InitMovingObject(&m_movingObj, &m_vStartPos, &vVel);;
	m_movingObj.m_PhysicsFlags |= MO_HALFGRAVITY;

	m_fExpireTime = 20.0f + m_pClientDE->GetTime();

	// Set the pitch velocity
	m_fPitchVel = GetRandom(-MATH_CIRCLE * 2, MATH_CIRCLE * 2);
	m_fYawVel = GetRandom(-MATH_CIRCLE * 2, MATH_CIRCLE * 2);
	m_fPitch	= m_fYaw = 0.0f;

	return DTRUE;
}
DatabaseProcessor::DatabaseProcessor(const char* s_directory, const char* s_folder,const char* s_main_directory)
{
    samp_directory = s_directory;
    samp_directory.append(s_folder);
    main_directory = s_main_directory;
    folder = s_folder;
    FeExtract.SetWriteFilePath(s_main_directory);
    GetFileNames();
}
Beispiel #4
0
size_t wxFileDataObject::GetDataSize() const
{
    wxCharBuffer buf;
    size_t buffLength;

    GetFileNames( buf );
    buffLength = strlen( buf );
    // terminating 0
    return buffLength + 1;
}
void DialogLoadPointSet::OnOK()
{
  if ( GetFileNames().isEmpty() )
  {
    QMessageBox::warning(
      this, "Error",
      "Point set file name can not be empty." );
    return;
  }
  accept();
}
Beispiel #6
0
bool wxFileDataObject::GetDataHere( void *pBuf ) const
{
    if (pBuf == NULL)
        return false;

    wxCharBuffer buf;
    size_t buffLength;

    GetFileNames( buf );
    buffLength = strlen( buf );
    memcpy( pBuf, (const char*)buf, buffLength + 1 );

    return true;
}
	// load template images
	bool OfflineTemplatesLoader::loadTemplateImages(
		const ObjectsConfig &objectsConfig,
		cv::Ptr<Detector> &detector, 
		std::map<int, std::vector<cv::Mat> > &images, 
		std::map<int, std::vector<cv::Rect> > &boundingBoxes)
	{
		const int objectNum = objectsConfig.object_config_size();
		CHECK(objectNum>0) << "No template images.";

#pragma omp parallel for
		for(int i=0; i<objectNum; ++i)
		{
			const ObjectConfig &objectConfig = objectsConfig.object_config(i);
			const int classId = objectConfig.id();
			const std::string &className = objectConfig.name();
			const std::string &imagesDir = objectConfig.img_dir();

			//read images
			std::vector<std::string> fileName;
			CHECK(GetFileNames(imagesDir, fileName))
				<< "Cannot get files name in specific directory";

			std::vector<cv::Mat> imgs;
			std::vector<cv::Rect> bbs;
			for(int k=0; k<(int)fileName.size(); ++k)
			{
				std::string file = imagesDir + "/" + fileName[k];
				cv::Mat img=cv::imread( file );					

				//extract a new template for current image
				cv::Rect tmplBoundingBox;
				int template_id = detector->addTemplate(img, classId, &tmplBoundingBox);

				//save all images, it is not a good idea when template images are large
				//but to do matches refinement, there's not good way
				imgs.push_back(img);
				bbs.push_back(tmplBoundingBox);
			}
#pragma omp critical
			{
				images.insert(std::pair<int, std::vector<cv::Mat> >(classId, imgs));
				boundingBoxes.insert(std::pair<int, std::vector<cv::Rect> >(classId, bbs));
			}
		}

		return true;
	}
Beispiel #8
0
bool CTemplateParserApp::HandleTemplateFiles(SgmlElement *pTemplateFiles)
{
   bool success = true;

   SgmlElement *pFile = pTemplateFiles->Find("file");
   while (pFile && success)
   {
      CString csSource;
      CString csTarget;
      success = GetFileNames(pFile, csSource, csTarget, true);

      if (success)
      {
         LTextBuffer ltbSource;
         success = ltbSource.LoadFile(csSource);
         if (!success)
         {
            // TPERR_READ_TEMPLATE
            // config.xml: Die Vorlagen-Datei '%s' konnte nicht gelesen werden.
            // config.xml: Reading the template file '%s' failed.
            MakeErrorMessage(TPERR_READ_TEMPLATE, csSource);
         }
         
         if (success)
         {
            ReplaceAllKeywords(ltbSource);

            m_writtenFiles.Add(csTarget);

            success = ltbSource.SaveFile(csTarget);
            if (!success)
            {
               // TPERR_WRITE_TEMPLATE
               // config.xml: Das Schreiben der Datei '%s' schlug fehl.
               // config.xml: Writing the file '%s' failed.
               MakeErrorMessage(TPERR_WRITE_TEMPLATE, csTarget);
            }
         }
      }

      pFile = pFile->GetNext();
   }

   return success;
}
HRESULT CTsTeleportShellExt::Drop(
    IDataObject *pDataObj,
    DWORD grfKeyState,
    POINTL pt,
    DWORD *pdwEffect)
{
    HRESULT hr;
    TStringVector vFileNames;

    UNREFERENCED_PARAMETER(grfKeyState);
    UNREFERENCED_PARAMETER(pt);
    UNREFERENCED_PARAMETER(pdwEffect);

    //
    // Get the file names vector
    //

    hr = GetFileNames(pDataObj,
        vFileNames);

    LEAVE_IF_FAILED("GetFileNames failed");

    //
    // Send the files through the channel
    //

    hr = TeleportFiles(vFileNames);

    LEAVE_IF_FAILED("TeleportFiles failed");

_Function_Exit:

    MessageBox(NULL,
        SUCCEEDED(hr)? TEXT("File(s) sent!") : TEXT("Failed!"),
        SUCCEEDED(hr)? TEXT("Success") : TEXT("Error"),
        0);

    return hr;

}
Beispiel #10
0
LoadGameView::LoadGameView()
{
	LastSelected=0;
	CurrentlySelected=0;

	Height=10;
	Width=30;

	// Load file names
	FileNames=GetFileNames("Saves");
	// Trim to correct length
	for(unsigned int x=0; x<FileNames.size(); x++)
	{
		// Remove extension
		FileNames[x]=std::string(FileNames[x].begin(), FileNames[x].end()-4);
		// Trim to width
		if(FileNames[x].size()>Width-3)
		{
			FileNames[x].erase(FileNames[x].begin()+Width-3, FileNames[x].end());
		}
	}

	Exit=false;
}
Beispiel #11
0
int main()
{
	ofstream outFile;
	ifstream inFile;		//IN      - file used in the function

	string inFileName;		//IN      - name of file the user will enter
	string outFileName;

	MovieInfo *head;
//	MovieInfo *headPtr;
	bool validMenuChoice;
	int menuChoice;
	Menu commandMenu;
	bool quit;
	quit = false;

	head    = NULL;
	commandMenu = OUTPUT;

	GetFileNames(inFile,outFile,"Input");
	GetFileNames(inFile,outFile,"Output");

	head    = ReadInput(head,inFile);

//	PrintHeader("Searching Linked List",'A',7,cout);
//	PrintHeader("Searching Linked List",'A',7,outFile);

	while(commandMenu != EXIT)
	{
//		do
//		{
			cout << "DVD MENU OPTIONS"       << endl << endl;
			cout << "1 - Output Entire List" << endl;
			cout << "2 - Title Search"       << endl;
			cout << "3 - Genre Search"       << endl;
			cout << "4 - Actor Search"       << endl;
			cout << "5 - Year Search"        << endl;
			cout << "6 - Rating Search (0-9)"<< endl;
			cout << "0 - EXIT"               << endl;




			menuChoice = ErrorCheckingMenu
					   ("Enter an option (0 to exit): ",
						"**** The number  is an invalid entry ****",
						"**** Please input a number between 0 and 6 ****", 6,0 );
//		}while();
		if(menuChoice > 0)
		{
		commandMenu = Menu(menuChoice);
		}
		if (commandMenu == OUTPUT && menuChoice >0)
		{
			cout << endl <<"Listing all movies!" << endl << endl;
					ListAllMovies(head, outFile);

		}
		else
			if (commandMenu ==	TITLESEARCH ||
				 commandMenu == GENRESEARCH ||
				 commandMenu == ACTORSEARCH ||
				 commandMenu == YEARSEARCH ||
				 commandMenu == RATINGSEARCH )
		{
			SearchLinkedList(head,commandMenu, outFile);
		}

	}
	cout <<"Done reading File";
	cout << "Done outputting File";

	inFile.close();
	outFile.close();



	return 0;
}
	// load template images, poses of images, obj model file
	bool OfflineTemplatesLoader::loadTemplateImagesAndPoses(
		const ObjectsConfig &objectsConfig,
		cv::Ptr<Detector> &detector, 
		std::map<int, std::vector<cv::Mat> > &images, 
		std::map<int, std::vector<cv::Rect> > &boundingBoxes,
		std::map<int, std::vector<cv::Matx61f> > &poses, 
		std::map<int, GLMmodel*> &objModels)
	{
		const int objectNum = objectsConfig.object_config_size();
		CHECK(objectNum>0) << "No template images.";

		#pragma omp parallel for
		for(int i=0; i<objectNum; ++i)
		{
			const ObjectsConfig_ObjectConfig &objectConfig = objectsConfig.object_config(i);
			const int classId = objectConfig.id();
			const std::string &className = objectConfig.name();
			//const std::string &imagesDir = objectConfig.img_dir();
			//const std::string &posePath = objectConfig.pose_path();
			const std::string &modelPath = objectConfig.model_path();

			//CHECK(!posePath.empty())<< "Please configure the file path of pose file.";
			CHECK(!modelPath.empty())<< "Please configure the file path of obj file.";

#if 0
			// read images
			std::vector<std::string> fileName;
			CHECK(GetFileNames(imagesDir, fileName))
				<< "Cannot get files name in specific directory";

			std::vector<cv::Mat> imgs;
			std::vector<cv::Rect> bbs;
			for(int k=0; k<(int)fileName.size(); ++k)
			{
				std::string file = imagesDir + "/" + fileName[k];
				cv::Mat img=cv::imread( file );					

				//extract a new template for current image
				cv::Rect tmplBoundingBox;
				int template_id = detector->addTemplate(img, classId, &tmplBoundingBox);

				//save all images, it is not a good idea when template images are large
				//but to do matches refinement, there's not good way
				imgs.push_back(img);
				bbs.push_back(tmplBoundingBox);
			}

			// read pose file
			std::ifstream poseInFile(posePath.c_str());
			CHECK(poseInFile.is_open()) << "Cannot open pose file.";

			std::vector<cv::Matx61f> posesParam;
			for(int j=0; j<(int)fileName.size(); ++j)
			{
				cv::Matx61f poseTmp;

				// rotation vector and translation vector
				poseInFile >> poseTmp.val[0] >> poseTmp.val[1] >> poseTmp.val[2]
				>> poseTmp.val[3] >> poseTmp.val[4] >> poseTmp.val[5];

				posesParam.push_back(poseTmp);
			}
#endif

			// read template images and corresponding poses
			std::vector<cv::Mat> imgs;
			std::vector<cv::Rect> bbs;
			std::vector<cv::Matx61f> posesParam;
			for(int j=0; j<objectConfig.imagedir_posefile_pair_size(); ++j)
			{
				const ObjectsConfig_ObjectConfig_ImageDirAndPoseFilePair& imagedir_posefile = objectConfig.imagedir_posefile_pair(j);
				const std::string &imagesDir = imagedir_posefile.img_dir();
				const std::string &posePath = imagedir_posefile.pose_path();

				// read images
				std::vector<std::string> fileName;
				CV_Assert(GetFileNames(imagesDir, fileName));

				for(int k=0; k<(int)fileName.size(); ++k)
				{
					std::string file = imagesDir + "/" + fileName[k];
					cv::Mat img=cv::imread( file );	

					//extract a new template for current image
					cv::Rect tmplBoundingBox;
					int template_id = detector->addTemplate(img, classId, &tmplBoundingBox);

					//save all images, it is not a good idea when template images are large
					//but to do matches refinement, there's not good way
					imgs.push_back(img);
					bbs.push_back(tmplBoundingBox);
				}

				// read poses
				std::ifstream poseInFile(posePath.c_str());
				CV_Assert(poseInFile.is_open());

				for(int j=0; j<(int)fileName.size(); ++j)
				{
					cv::Matx61f poseTmp;

					// rotation vector and translation vector
					poseInFile >> poseTmp.val[0] >> poseTmp.val[1] >> poseTmp.val[2]
					>> poseTmp.val[3] >> poseTmp.val[4] >> poseTmp.val[5];

					posesParam.push_back(poseTmp);
				}
			}

			// read obj file
			GLMmodel *modelTmp = glmReadOBJ(const_cast<char*>(modelPath.c_str()));

			#pragma omp critical
			{
				images.insert(std::pair<int, std::vector<cv::Mat> >(classId, imgs));
				boundingBoxes.insert(std::pair<int, std::vector<cv::Rect> >(classId, bbs));
				poses.insert( std::pair<int, std::vector<cv::Matx61f> >(classId, posesParam) );
				objModels.insert(std::pair<int, GLMmodel*>(classId, modelTmp));
			}
		}

		return true;
	}
Beispiel #13
0
bool CSpell::Init(bool bCheckFiles, UINT idFileDLL, UINT idFileMainLex1, UINT idFileMainLex2, UINT idFileUserLex)
{
	if (m_hSpellLib)
		return true;

	CString strFileDLL;
	CString strFileMainLex1;
	CString strFileMainLex2;
	CString strFileUserLex;
	GetFileNames(strFileDLL, strFileMainLex1, strFileMainLex2, strFileUserLex);

	CString strDstPath;
	GetSpellCheckerPath(strDstPath);

	if (idFileDLL || idFileMainLex1 || idFileMainLex2 || idFileUserLex)
	{
		HINSTANCE hInstance = _AtlBaseModule.GetResourceInstance();
		WriteResourceToFile(hInstance, idFileDLL,      "SPELLCHECK", strDstPath + strFileDLL);
		WriteResourceToFile(hInstance, idFileMainLex1, "SPELLCHECK", strDstPath + strFileMainLex1);
		WriteResourceToFile(hInstance, idFileMainLex2, "SPELLCHECK", strDstPath + strFileMainLex2);
		WriteResourceToFile(hInstance, idFileUserLex,  "SPELLCHECK", strDstPath + strFileUserLex);
	}

	if (bCheckFiles)
	{
		bool bOK = FileExists(strDstPath + strFileMainLex1) && FileExists(strDstPath + strFileMainLex2) && FileExists(strDstPath + strFileUserLex);
		if (!bOK)
			return false;
	}

	m_hSpellLib = ::LoadLibrary(strDstPath + strFileDLL);
	if (!m_hSpellLib)
		return false;

	PFNSetKey pSetKey = (PFNSetKey)::GetProcAddress(m_hSpellLib, "SSCE_SetKey");
	if (!pSetKey || pSetKey(0x8359C65E) != SSCE_OK_RSLT)
	{
		::FreeLibrary(m_hSpellLib);
		m_hSpellLib = NULL;
		return false;
	}

	// Get the function pointers from the Spell Check DLL
	PFNSetMainLexPath pMainLexPath = (PFNSetMainLexPath)::GetProcAddress(m_hSpellLib, "SSCE_SetMainLexPath");
	if (pMainLexPath)
		SSCE_S16 svMainLexPath = pMainLexPath(strDstPath);

	PFNSetUserLexPath pUserLexPath = (PFNSetUserLexPath)::GetProcAddress(m_hSpellLib, "SSCE_SetUserLexPath");
	if (pUserLexPath)
		SSCE_S16 svUserLexPath = pUserLexPath(strDstPath);

	PFNSetMainLexFiles pMainLexFiles = (PFNSetMainLexFiles)::GetProcAddress(m_hSpellLib, "SSCE_SetMainLexFiles");
	if (pMainLexFiles)
		SSCE_S16 svMainLexFiles = pMainLexFiles(strFileMainLex1 + "," + strFileMainLex2); // "ssceam.tlx,ssceam2.clx"

	PFNSetUserLexFiles pUserLexFiles = (PFNSetUserLexFiles)::GetProcAddress(m_hSpellLib, "SSCE_SetUserLexFiles");
	if (pUserLexFiles)
		SSCE_S16 svUserLexFiles = pUserLexFiles(strFileUserLex);

	PFNResetLex pResetLex = (PFNResetLex)::GetProcAddress(m_hSpellLib, "SSCE_ResetLex");
	if (pResetLex)
		pResetLex();

	PFNSetAutoCorrect pSetAutoCorrect = (PFNSetAutoCorrect)::GetProcAddress(m_hSpellLib, "SSCE_SetAutoCorrect");
	if (pSetAutoCorrect)
		pSetAutoCorrect(false);

	PFNSetMinSuggestDepth pSetMinSuggestDepth = (PFNSetMinSuggestDepth)::GetProcAddress(m_hSpellLib, "SSCE_SetMinSuggestDepth");
	if (pSetMinSuggestDepth)
		pSetMinSuggestDepth(SSCE_MAX_SUGGEST_DEPTH/2);

	PFNSetOption pSetOption = (PFNSetOption)::GetProcAddress(m_hSpellLib, "SSCE_SetOption");
	if (pSetOption)
	{
		SSCE_S16 sid = 0; // m_pfnGetSid();
		SSCE_U32 OldValue = SSCE_OK_RSLT;
		OldValue = pSetOption(sid, SSCE_IGNORE_CAPPED_WORD_OPT, false);		// Default false
		OldValue = pSetOption(sid, SSCE_IGNORE_MIXED_CASE_OPT, false);		// Default false
		OldValue = pSetOption(sid, SSCE_IGNORE_MIXED_DIGITS_OPT, false);	// Default false
		OldValue = pSetOption(sid, SSCE_IGNORE_ALL_CAPS_WORD_OPT, true);	// Default false
		OldValue = pSetOption(sid, SSCE_IGNORE_NON_ALPHA_WORD_OPT, true);	// Default true
		OldValue = pSetOption(sid, SSCE_IGNORE_DOMAIN_NAMES_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_IGNORE_HTML_MARKUPS_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_REPORT_UNCAPPED_OPT, true);			// Default false*
		OldValue = pSetOption(sid, SSCE_REPORT_MIXED_CASE_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_REPORT_MIXED_DIGITS_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_REPORT_DOUBLED_WORD_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_CASE_SENSITIVE_OPT, true);			// Default true
		OldValue = pSetOption(sid, SSCE_SPLIT_HYPHENATED_WORDS_OPT, true);	// Default true
		OldValue = pSetOption(sid, SSCE_SPLIT_CONTRACTED_WORDS_OPT, false);	// Default false
		OldValue = pSetOption(sid, SSCE_SPLIT_WORDS_OPT, false);			// Default false
		OldValue = pSetOption(sid, SSCE_SUGGEST_SPLIT_WORDS_OPT, true);		// Default false*
		OldValue = pSetOption(sid, SSCE_SUGGEST_PHONETIC_OPT, false);		// Default false
		OldValue = pSetOption(sid, SSCE_SUGGEST_TYPOGRAPHICAL_OPT, true);	// Default true
		OldValue = pSetOption(sid, SSCE_STRIP_POSSESSIVES_OPT, true);		// Default true
		OldValue = pSetOption(sid, SSCE_ALLOW_ACCENTED_CAPS_OPT, true);		// Default true
	//	OldValue = pSetOption(sid, SSCE_LANGUAGE_OPT, false);
	//	OldValue = pSetOption(sid, SSCE_CHECK_SINGLE_WORD_OPT, false);
	//	OldValue = pSetOption(sid, SSCE_REPORT_SPELLING_OPT, false);
	}

	// Get the function pointers from the Spell Check DLL
	m_pfnGetSid = (PFNGetSid)::GetProcAddress(m_hSpellLib, "SSCE_GetSid");
	m_pfnCheckString = (PFNCheckString)::GetProcAddress(m_hSpellLib, "SSCE_CheckString");
	m_pfnCheckStringDlg = (PFNCheckStringDlg)::GetProcAddress(m_hSpellLib, "SSCE_CheckBlockDlgTmplt");
	m_pfnGetStatistics = (PFNGetStatistics)::GetProcAddress(m_hSpellLib, "SSCE_GetStatistics");
	if (!m_pfnGetSid || !m_pfnCheckString || !m_pfnCheckStringDlg || !m_pfnGetStatistics)
	{
		::FreeLibrary(m_hSpellLib);
		m_hSpellLib = NULL;
		m_pfnGetSid = NULL;
		m_pfnCheckString = NULL;
		m_pfnCheckStringDlg = NULL;
		m_pfnGetStatistics = NULL;
		return false;
	}

	return (m_hSpellLib != NULL);
}