Exemplo n.º 1
0
NaGePlane::NaGePlane(const double& A, const double& B, const double& C, const double& D)
{
	Equation[0] = A;
	Equation[1] = B;
	Equation[2] = C;
	Equation[3] = D;

	NaGePoint3D Pos(A, B, C);
	NaGeVector3D Dir(A, B, C);

	
	NaGeAxisSystem location(Pos, Dir);

	double d = location.GetDirection().Magnitude();
	if ( d > 0.0 )
	{
		d = 1.0/d;
		NaGeVector3D O = location.GetDirection()*(-d)*Equation[3];
		location.SetPosition(O.Point());
	}

	itsLocation = location;
	
	geomType = GEPLANE;
}
Exemplo n.º 2
0
void ProcessingDlg::ReadDir(const wxString& DirName)
{
    wxDir Dir(DirName);

    if ( !Dir.IsOpened() ) return;

    Status->SetLabel(_T("Reading dir: ") + DirName);
    ::wxYield();
    if ( StopFlag ) return;

    wxString Name;

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_FILES|wxDIR_HIDDEN) )
    {
        do
        {
            Map[Name].Add(DirName + wxFileName::GetPathSeparator() + Name);
        }
        while ( Dir.GetNext(&Name) );
    }

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_DIRS|wxDIR_HIDDEN) )
    {
        do
        {
            Map[Name].Add(DirName + wxFileName::GetPathSeparator() + Name);
            ReadDir(DirName + wxFileName::GetPathSeparator() + Name);
        }
        while ( Dir.GetNext(&Name) );
    }
}
Exemplo n.º 3
0
/*
Creates the hyperboloid using a formula. 
TODO: Update this so the hyperboloid actually represents a proper parametric model. 
*/
TopoDS_Shape hyperboloid::create(double innerRadius, double height, double heightUnder, double angle)
{
		int detail = 40;
		gp_Pnt Origin(0,0,0);
		gp_Vec Dir(0,0,1);

		int uCount = detail;
		double a = innerRadius;
		double c = angle;
		double totalHeight = height + heightUnder;
		TColgp_Array1OfPnt array (0,uCount - 1);

		for (double u = 0; u < uCount; u++)
		{	
			double uValue = ((totalHeight * u / (uCount - 1)) - heightUnder) / c;
			double vValue = 0;

			double sqrMe = 1 + uValue * uValue;

			double x = a * sqrt(sqrMe) * cos(vValue);
			double y = a * sqrt(sqrMe) * sin(vValue);
			double z = c * uValue;
			gp_Pnt P1(x,y,z);   
			array.SetValue(u,P1); 
		}
	                          
		Handle(Geom_BSplineCurve) hyperbola = GeomAPI_PointsToBSpline(array).Curve();    
		TopoDS_Edge hyperbolaTopoDS = BRepBuilderAPI_MakeEdge(hyperbola); 

		gp_Ax1 axis = gp_Ax1(Origin,Dir); 
		TopoDS_Shape hyperboloid = BRepPrimAPI_MakeRevol(hyperbolaTopoDS, axis); 

		return hyperboloid;
}
Exemplo n.º 4
0
void heapifica(int *heap, int N, int x) 
{
	int aux, maior = x, esq = Esq(x), dir = Dir(x);  		
	
    if(esq <= N && heap[esq] > heap[x])//se o filho for maior q o pai, faz a troca
									//a partir da posicao passada como parametro
	{        
		maior = esq;
	}

	if(dir <= N && heap[dir] > heap[maior])
	{
		maior = dir;
	}


	if(maior != x) // se o indice do pai mudou;
	{
		aux = heap[x];
		heap[x] = heap[maior];
		heap[maior] = aux;

		heapifica(heap, N, maior);
	}
}
Exemplo n.º 5
0
//---------------------------------------------------------
bool		DLG_Open(wxString &File_Path, const wxString &Caption, const wxString &def_Dir, const wxString &def_File, const wxString &Filter)
{
	wxString	Dir(def_Dir);

	if( !wxDirExists(def_Dir) )
	{
		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
	}

	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, Dir, def_File, Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST);

	if( dlg.ShowModal() == wxID_OK )
	{
		File_Path	= dlg.GetPath();

		if( !wxDirExists(def_Dir) )
		{
			CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str());
		}

		return( true );
	}

	return( false );
}
Exemplo n.º 6
0
QStringList CArchiveThread::ListParts(const QString &ArchivePath, bool NamesOnly)
{
	QStringList Parts;

	StrPair PathName = Split2(ArchivePath, "/", true);
	StrPair NameEx = Split2(PathName.second, ".", true);
	QRegExp Pattern;
	if(NameEx.second == "rar")
		Pattern = QRegExp(QRegExp::escape(NameEx.first) + "(\\.part[0-9]*)?\\.rar", Qt::CaseInsensitive);
	else
		Pattern = QRegExp(QRegExp::escape(NameEx.first + "." + NameEx.second) + "(\\.[0-9]*)?", Qt::CaseInsensitive);
	
	QDir Dir(PathName.first);
	foreach (const QString& File, Dir.entryList())
	{
		if (File.compare(".") == 0 || File.compare("..") == 0)
			continue;
		if(Pattern.exactMatch(File))
		{
			if(NamesOnly)
				Parts.append(File);
			else
				Parts.append(PathName.first + "/" + File);
		}
	}
	return Parts;
}
Exemplo n.º 7
0
	void Roataion::rotate( Dir axis )
	{
		mDir[0] = FDir::Rotate( axis , mDir[0] );
		mDir[1] = FDir::Rotate( axis , mDir[1] );
		mDir[2] = Dir( FDir::Cross( mDir[0] , mDir[1] ) );
		assert( mDir[2] != -1 );
	}
int LibraryDetectionManager::LoadXmlConfig(const wxString& Path)
{
    wxDir Dir(Path);
    wxString Name;
    if ( !Dir.IsOpened() ) return 0;

    int loaded = 0;
    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_DIRS|wxDIR_HIDDEN) )
    {
        do
        {
            loaded += LoadXmlConfig(Path+wxFileName::GetPathSeparator()+Name);
        }
        while ( Dir.GetNext(&Name) );
    }

    if ( Dir.GetFirst(&Name,wxEmptyString,wxDIR_FILES|wxDIR_HIDDEN) )
    {
        do
        {
            loaded += LoadXmlFile(Path+wxFileName::GetPathSeparator()+Name) ? 1 : 0;
        }
        while ( Dir.GetNext(&Name) );
    }

    return loaded;
}
Exemplo n.º 9
0
//-------------------------------------------------------------------------------------------------
inline void_t
File::reopen(
    std::ctstring_t  &a_filePath,
    const ExOpenMode &a_mode,
    cbool_t          &a_isUseBuffering
)
{
    xTEST_EQ(a_filePath.empty(), false);
    xTEST_NA(a_mode);
    xTEST_NA(a_isUseBuffering);

    // create dir
    Dir( Path(a_filePath).dir() ).pathCreate();

    // create, reopen file
    {
        std::FILE *file = xTFREOPEN(a_filePath.c_str(), _openMode(a_mode).c_str(), get());
        xTEST_PTR(file);

        _handle   = file;
        _filePath = a_filePath;
    }

    // buffering
    if (!a_isUseBuffering) {
        setVBuff(xPTR_NULL, bmNo,   0);
    } else {
        setVBuff(xPTR_NULL, bmFull, BUFSIZ);
    }
}
Exemplo n.º 10
0
///////////////////////////////////////////////////////////////////////////
//	Name:	CopyDataStore
//
//	Description:
//	Copy all the files in the specified source directory to the specified
//	destination directory.  Based on bQuestion ask a question about overwriting
//	any existing files, else just copy the files whether or not something
//	already exists.
//	
//	Declaration:
//	bool CDbIni::CopyDataStore(CString &strSourceRootPath, CString &strDestinationRootPath, bool bQuestion)
//
//	Input:	strSourceRootPath		base path of where to get the datastore to copy from
//			strDestinationRootPath	base path of where to copy the datastore to
//			bQuestion				whether or not to ask a question if the datastore exists at the destination
//			m_strComponentName		name of the subpath where this instrument's datastore is kept
//			m_strMyIniFilename		name of file that indicates a datastore is present
//
//	Output:	none
//
//	Return:	true (db exists and initialized) / false (error in operation)
//	
//  date    /	author	revision
//  -----------------	--------
//	28-Jan-2002	SFK		Created
//////////////////////////////////////////////////////////////////
bool CDbIni::CopyDataStore(CString &strSourceRootPath, CString &strDestinationRootPath, bool bQuestion)
{
	CDirUtilities Dir(false);  //QUIET MODE IS ALWAYS OFF FOR TIMEALIGN pjm 11/27/2007 for B2R1
	bool bOverwrite;
	bool bSuccess = false;
	CString strError;
	
	if ((m_strComponentName.GetLength() == 0) || (m_strMyIniFilename.GetLength() == 0)) {
		strError.Format("BackupDataStore: No component name or ini filename program error, cannot continue.");
		MessageBox(NULL, strError, "Fatal Error", MB_OK|MB_ICONWARNING);
		return(false);
	}

	CString strFullDestinationPath = Dir.AppendPath(strDestinationRootPath, m_strComponentName);	// create the Instrument Com specific path
	CString strFullSourcePath = Dir.AppendPath(strSourceRootPath, m_strComponentName);	// create the Instrument Com specific path

	bool bExists = Dir.FileExists(strFullDestinationPath, m_strMyIniFilename);	// does a datastore exist there already?

	if (bExists && bQuestion) {
		bOverwrite = Dir.OverwriteDbQuestion(strFullDestinationPath);		// datastore exists, see if they want to overwrite
	}
	else bOverwrite = true;

	if ((!bExists) || (bExists && bOverwrite)) {	// copy current datastore to the specified destination
		bExists = Dir.FileExists(strFullSourcePath, m_strMyIniFilename);	// is a file even there to copy?
		if (bExists) bSuccess = Dir.CopyDirectory(strFullSourcePath, strFullDestinationPath, true);
		else bSuccess = true;
	}
	return(bSuccess);
}
Exemplo n.º 11
0
//---------------------------------------------------------
bool		DLG_Open(wxArrayString &File_Paths, const wxString &Caption, const wxString &def_Dir, const wxString &Filter)
{
	wxString	Dir(def_Dir);

	if( !wxDirExists(def_Dir) )
	{
		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
	}

	wxFileDialog	dlg(MDI_Get_Top_Window(), Caption, Dir, wxT(""), Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE);

	if( dlg.ShowModal() == wxID_OK )
	{
		dlg.GetPaths(File_Paths);

		if( File_Paths.GetCount() > 0 )
		{
			if( !wxDirExists(def_Dir) )
			{
				CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Paths[0]).w_str());
			}

			return( true );
		}
	}

	return( false );
}
Exemplo n.º 12
0
	void Battle::renderStencilShadow()
	{
		if (lp_CONFIG->shadow_quality > 0 && cam.rpos.y <= gfx->low_def_limit)
		{
			switch (lp_CONFIG->shadow_quality)
			{
					case 1:                     // Stencil Shadowing (shadow volumes)
						if (rotate_light)
						{
							pSun.Dir.x = -1.0f;
							pSun.Dir.y = 1.0f;
							pSun.Dir.z = 1.0f;
							pSun.Dir.unit();
							Vector3D Dir(-pSun.Dir);
							Dir.x = cosf(light_angle);
							Dir.z = sinf(light_angle);
							Dir.unit();
							pSun.Dir = -Dir;
							units.draw_shadow(render_time, Dir);
						}
						else
						{
							pSun.Dir.x = -1.0f;
							pSun.Dir.y = 1.0f;
							pSun.Dir.z = 1.0f;
							pSun.Dir.unit();
							units.draw_shadow(render_time, -pSun.Dir);
						}
						break;
					case 2:                     // Shadow mapping
					case 3:
						break;
					}
		}
	}
Exemplo n.º 13
0
Route_Node::Route_Node (void)
{
	Node (0);
	Dwell (0);
	TTime (0);
	Dir (0);
}
Exemplo n.º 14
0
bool cFileList::Read(char *dir, bool withsub)
{
  bool ret = false;
  char *buffer = NULL;

  struct dirent *DirData = NULL;

  cReadDir Dir(dir);
  if(Dir.Ok())
  {
    while((DirData = Dir.Next()) != NULL)
    {
      if(CheckIncludes(dir, DirData->d_name)  &&
         !CheckExcludes(dir, DirData->d_name) &&
         CheckType(dir, DirData->d_name, Type))
        SortIn(dir, DirData->d_name);
      if(withsub &&
         CheckType(dir, DirData->d_name, tDir) &&
         !RegIMatch(DirData->d_name, "^\\.{1,2}$"))
      {
        asprintf(&buffer, "%s/%s", dir, DirData->d_name);
        Read(buffer, withsub);
        FREENULL(buffer);
      }
    }
    ret = true;
  }

  return ret;
}
Exemplo n.º 15
0
void CWebSock::GetAvailSkins(VCString& vRet) const {
	vRet.clear();

	CString sRoot(GetSkinPath("_default_"));

	sRoot.TrimRight("/");
	sRoot.TrimRight("_default_");
	sRoot.TrimRight("/");

	if (!sRoot.empty()) {
		sRoot += "/";
	}

	if (!sRoot.empty() && CFile::IsDir(sRoot)) {
		CDir Dir(sRoot);

		for (unsigned int d = 0; d < Dir.size(); d++) {
			const CFile& SubDir = *Dir[d];

			if (SubDir.IsDir() && SubDir.GetShortName() == "_default_") {
				vRet.push_back(SubDir.GetShortName());
				break;
			}
		}

		for (unsigned int e = 0; e < Dir.size(); e++) {
			const CFile& SubDir = *Dir[e];

			if (SubDir.IsDir() && SubDir.GetShortName() != "_default_" && SubDir.GetShortName() != ".svn") {
				vRet.push_back(SubDir.GetShortName());
			}
		}
	}
}
Exemplo n.º 16
0
void MainWindow::PathFileRefresh(QString szFilePath)
{
	// reverse find last path separator,
	// strip filename from path
	// and check for supported files in path
	szFilePath.replace('\\', "/");
	int iPos = szFilePath.lastIndexOf('/');
	if (iPos == -1)
	{
		// does not have path separator as expected -> nothing to do
		setWindowTitle(m_szBaseTitle);
		return;
	}

	QString szFile = szFilePath.right(szFilePath.length() - iPos -1);

	// quick hack to show current file
	QString szTitle = m_szBaseTitle + " - " + szFile;
	setWindowTitle(szTitle);
	
	if (m_ImageList.length() < 1)
	{
		m_szCurPath = szFilePath.left(iPos + 1);

		// TODO: filter by supported image-codecs..
		// see: QImageReader::supportedImageFormats()
		
		QDir Dir(m_szCurPath);
		m_ImageList = Dir.entryList(QDir::Files | QDir::NoDotAndDotDot, 
									QDir::Name | QDir::IgnoreCase);
	}
	
	m_iCurImageIx = m_ImageList.indexOf(szFile);
}
Exemplo n.º 17
0
bool firstUse()
{
    QDir Dir(loc);
    if (Dir.exists())
        return false;
    else
        return true;
}
Exemplo n.º 18
0
	void Roataion::set(Dir dirX , Dir dirZ)
	{
		int dirCross = FDir::Cross( dirZ , dirX );
		assert( dirCross != -1 );
		mDir[0] = dirX;
		mDir[1] = Dir( dirCross );
		mDir[2] = dirZ;
	}
Exemplo n.º 19
0
void RecentBooksDlg::removeFile(LVPtrVector<CRFileHistRecord> & files, int num)
{

    QDir Dir0( cr2qt(files[num-1]->getFilePath()) );
    // Удаляемый файл ещё существует
    if((Dir0.exists( cr2qt(files.get(num-1)->getFileName()) )) && (files.length() > 1)){
        // Нужно чтобы в истории было больше одной книжки, чтобы можно было загрузить удяляемую запись а потом удалить
        m_docview->loadDocument(cr2qt(files[num-1]->getFilePathName()));

        // remove cache file
        QString filename = cr2qt(files.get(num-1)->getFileName());
        filename = cr2qt(m_docview->getDocView()->getDocProps()->getStringDef(DOC_PROP_FILE_NAME));

        // Уточняем CRC удаляемого файла
        lUInt32 crc = m_docview->getDocView()->getDocProps()->getIntDef(DOC_PROP_FILE_CRC32, 0);
        char s[16];
        sprintf(s, ".%08x", (unsigned)crc);
        filename = filename+ QString(s);

        // Возвращаем активным первоначально просматриваемый документ (он сейчас первым в списке истории стоит)
        m_docview->loadDocument(cr2qt(files[1]->getFilePathName()));
        //	// для отладки

        // trim file extension, need for archive files

        QDir Dir(qApp->applicationDirPath() + QDir::toNativeSeparators(QString("/data/cache/")));
        QStringList fileList = Dir.entryList(QStringList() << filename + "*.cr3", QDir::Files);
        if(fileList.count())
            Dir.remove(fileList.at(0));

        files.remove(1);
    } else {
        // Известно лишь название архива и если его название не совпадает с названием файла то кеш файл не будет удалён
        // remove cache file
        QString filename = cr2qt(files.get(num-1)->getFileName());
        // trim file extension, need for archive files
        int pos = filename.lastIndexOf(".");
        if(pos != -1) filename.resize(pos);
        QDir Dir(qApp->applicationDirPath() + QDir::toNativeSeparators(QString("/data/cache/")));
        QStringList fileList = Dir.entryList(QStringList() << filename + "*.cr3", QDir::Files);
        if(fileList.count())
            Dir.remove(fileList.at(0));
        files.remove(num-1);
    }
}
Exemplo n.º 20
0
	Dir Roataion::toLocal(Dir dir)
	{
		//TODO: improve
		int axis = FDir::Axis( dir );
		int idx = ( axis == FDir::Axis( mDir[2] ) ) ? 2 :
			( ( axis == FDir::Axis( mDir[1] ) ) ? 1 : 0 ) ;
		assert( axis == FDir::Axis( mDir[idx] ) );
		return Dir( 2 * idx + (( dir == mDir[idx] ) ? 0 : 1 ) );
	}
Exemplo n.º 21
0
//---------------------------------------------------------
bool		DLG_Image_Save(wxString &File_Path, int &Type, const wxString &def_Dir, const wxString &def_File)
{
	static	int	Filter_Index	= 3;

	wxString	Dir(def_Dir);

	if( !wxDirExists(def_Dir) )
	{
		CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir);
	}

	wxFileDialog	dlg(
		MDI_Get_Top_Window(), _TL("Save As Image"), Dir, def_File, wxString::Format(
			"%s (*.bmp)|*.bmp|"
			"%s (*.jpg)|*.jpg;*.jif;*.jpeg|"
			"%s (*.tif)|*.tif;*.tiff|"
			"%s (*.png)|*.png|"
			"%s (*.gif)|*.gif|"
			"%s (*.pcx)|*.pcx",
			_TL("Windows or OS/2 Bitmap"),
			_TL("JPEG - JFIF Compliant"),
			_TL("Tagged Image File Format"),
			_TL("Portable Network Graphics"),
			_TL("CompuServe Graphics Interchange"),
			_TL("Zsoft Paintbrush")
		), wxFD_SAVE|wxFD_OVERWRITE_PROMPT
	);

	dlg.SetFilterIndex(Filter_Index);

	if( dlg.ShowModal() == wxID_OK )
	{
		File_Path		= dlg.GetPath();
		Filter_Index	= dlg.GetFilterIndex();

		switch( Filter_Index )
		{
		default: Type	= wxBITMAP_TYPE_BMP ;	break;
		case  1: Type	= wxBITMAP_TYPE_JPEG;	break;
		case  2: Type	= wxBITMAP_TYPE_TIF ;	break;
		case  3: Type	= wxBITMAP_TYPE_PNG ;	break;
		case  4: Type	= wxBITMAP_TYPE_GIF ;	break;
 		case  5: Type	= wxBITMAP_TYPE_PCX ;	break;
		case  6: Type	= wxBITMAP_TYPE_PNM ;	break;
		}

		if( !wxDirExists(def_Dir) )
		{
			CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str());
		}

		return( true );
	}

	return( false );
}
Exemplo n.º 22
0
void BaseFileModel::setDirs(const QStringList& dirs)
{
	reset();
	dirs_ = dirs;
	foreach(const QString& dirName, dirs_) {
		QDir Dir(dirName);
		foreach(const QString& fileName, Dir.entryList(QDir::Files)) {
			files_.append(Dir.absoluteFilePath(fileName));
		}
	}
Exemplo n.º 23
0
void GoToFile(const wchar_t *Target, BOOL AnotherPanel)
{
	HANDLE  _PANEL_HANDLE = AnotherPanel?PANEL_PASSIVE:PANEL_ACTIVE;
	PanelRedrawInfo PRI = {sizeof(PanelRedrawInfo)};
	PanelInfo PInfo = {sizeof(PanelInfo)};
	int pathlen;
	const wchar_t *p = FSF.PointToName(const_cast<wchar_t*>(Target));
	StrBuf Name(lstrlen(p)+1);
	lstrcpy(Name,p);
	pathlen=(int)(p-Target);
	StrBuf Dir(pathlen+1);

	if (pathlen)
		memcpy(Dir.Ptr(),Target,pathlen*sizeof(wchar_t));

	Dir[pathlen]=L'\0';
	FSF.Trim(Name);
	FSF.Trim(Dir);
	FSF.Unquote(Name);
	FSF.Unquote(Dir);

	if (*Dir.Ptr())
	{
		FarPanelDirectory dirInfo = {sizeof(dirInfo), Dir, nullptr, {}, nullptr};
		Info.PanelControl(_PANEL_HANDLE, FCTL_SETPANELDIRECTORY, 0, &dirInfo);
	}

	Info.PanelControl(_PANEL_HANDLE,FCTL_GETPANELINFO,0,&PInfo);
	PRI.CurrentItem=PInfo.CurrentItem;
	PRI.TopPanelItem=PInfo.TopPanelItem;

	for (size_t J=0; J < PInfo.ItemsNumber; J++)
	{
		size_t Size=Info.PanelControl(_PANEL_HANDLE,FCTL_GETPANELITEM,J,0);
		PluginPanelItem* PPI=(PluginPanelItem*)malloc(Size);

		if (PPI)
		{
			FarGetPluginPanelItem gpi={sizeof(FarGetPluginPanelItem), Size, PPI};
			Info.PanelControl(_PANEL_HANDLE,FCTL_GETPANELITEM,J,&gpi);
		}


		if (!FSF.LStricmp(Name,FSF.PointToName((PPI?PPI->FileName:NULL))))
		{
			PRI.CurrentItem=J;
			PRI.TopPanelItem=J;
			free(PPI);
			break;
		}
		free(PPI);
	}

	Info.PanelControl(_PANEL_HANDLE,FCTL_REDRAWPANEL,0,&PRI);
}
Exemplo n.º 24
0
void ResetWindow::deleteDir(QString dir)
{
	QDirIterator i(dir, QDirIterator::Subdirectories);
	QDir Dir(dir);
	while(i.hasNext())
	{
		i.next();
		Dir.remove(i.filePath());
	}
	
}
Exemplo n.º 25
0
//-------------------------------------------------------------------------------------------------
inline void_t
Config::setPath(
    std::ctstring_t &a_filePath
)
{
    xTEST_EQ(a_filePath.empty(), false);

    Dir( Path(a_filePath).dir() ).pathCreate();

    _filePath = a_filePath;
}
Exemplo n.º 26
0
void CAddEdit::OnButtonBrowse() 
{
	// TODO: Add your control notification handler code here
	CDirDialog Dir(this);
	Dir.m_strTitle = "Select Directory for DelFi to watch";
	ShowWindow(SW_HIDE);
	if (Dir.DoBrowse() == 1)
	{
		m_pPath.SetWindowText(Dir.m_strPath);
	}
	ShowWindow(SW_SHOW);
}
Exemplo n.º 27
0
	virtual void OnModCommand(const CString& sLine) {
		CString sCommand = sLine.Token(0);
		if (sCommand.Equals("cd")) {
			CString sArg = sLine.Token(1, true);
			CString sPath = CDir::ChangeDir(m_sPath, (sArg.empty() ? CString(CZNC::Get().GetHomePath()) : sArg), CZNC::Get().GetHomePath());
			CFile Dir(sPath);

			if (Dir.IsDir()) {
				m_sPath = sPath;
			} else if (Dir.Exists()) {
				PutShell("cd: not a directory [" + sPath + "]");
			} else {
				PutShell("cd: no such directory [" + sPath + "]");
			}

			PutShell("znc$");
		} else if (sCommand.Equals("SEND")) {
			CString sToNick = sLine.Token(1);
			CString sFile = sLine.Token(2);

			if ((sToNick.empty()) || (sFile.empty())) {
				PutShell("usage: Send <nick> <file>");
			} else {
				sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());

				if (!CFile::Exists(sFile)) {
					PutShell("get: no such file [" + sFile + "]");
				} else if (!CFile::IsReg(sFile)) {
					PutShell("get: not a file [" + sFile + "]");
				} else {
					m_pUser->SendFile(sToNick, sFile, GetModName());
				}
			}
		} else if (sCommand.Equals("GET")) {
			CString sFile = sLine.Token(1);

			if (sFile.empty()) {
				PutShell("usage: Get <file>");
			} else {
				sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());

				if (!CFile::Exists(sFile)) {
					PutShell("get: no such file [" + sFile + "]");
				} else if (!CFile::IsReg(sFile)) {
					PutShell("get: not a file [" + sFile + "]");
				} else {
					m_pUser->SendFile(m_pUser->GetCurNick(), sFile, GetModName());
				}
			}
		} else {
			RunCommand(sLine);
		}
	}
Exemplo n.º 28
0
void Tank::Init()
{
	s = sz;
	b = 0;
	e = 1;
	dir = Dir(UP+rand()%4);		// 随机选择一个前进方向
	v = rand()%2==0?velf:vels;	// 在两种速度之间以50%的几率随机选择一种
	c = v == velf?RGB(0,122,122):RGB(0,60,30);	// 两种速度坦克的颜色不一样
	x = (rand()%3)*(wndWidth-sz)/2 + sz/2;	// 随机出生点
	y = sz;
	p = 0;
}
Exemplo n.º 29
0
void TemplatesManager::reloadEngines()
{
    _engines.clear();

    StringList entries = Dir("WebCpp/Plugins/TemplateEngines/").entries();
    for (const String& entry : entries)
    {
        Plugin* plugin = new Plugin("WebCpp/Plugins/TemplateEngines/"+entry);
        AbstractTemplateEngine* engine = plugin->instance<AbstractTemplateEngine>();
        _engines[engine->id()] = engine;
    }
}
Exemplo n.º 30
0
	void addDir(const string &dir)
	{
		DirList::iterator it;
		if(!findDir(it, dir))
		{
			dirs[dir] = Dir();
			findDir(it, dir);

			// Add to parent list

			string current = dir;
			DirList::iterator currentIt = it;

			for(int i = 0; ; ++i)
			{
				string parent;
				getDirPart(current, parent);
				if(parent.empty())
					break;

				bool needAdd = false;

				DirList::iterator parentIt;
				if(!findDir(parentIt, parent))
				{
					dirs[parent] = Dir();
					findDir(parentIt, parent);
					needAdd = true;
				}

				parentIt->second.subDirs.push_back(currentIt);
				if(!needAdd)
					break;

				current = parent;
				currentIt = parentIt;
			}
		}
	}