예제 #1
0
void TCompiler::collectVariables(TIntermNode* root)
{
    CollectVariables collect(&attributes,
                             &outputVariables,
                             &uniforms,
                             &varyings,
                             &interfaceBlocks,
                             hashFunction);
    root->traverse(&collect);

    // For backwards compatiblity with ShGetVariableInfo, expand struct
    // uniforms and varyings into separate variables for each field.
    ExpandVariables(uniforms, &expandedUniforms);
    ExpandVariables(varyings, &expandedVaryings);
}
std::wstring InstallerSession::GetSessionCabPath(bool returnonly)
{
	if (cabpath.empty() && ! returnonly)
    {
		cabpath = DVLib::DirectoryCombine(DVLib::GetTemporaryDirectoryW(), guid);
		DVLib::DirectoryCreate(cabpath);
    }

    return ExpandVariables(cabpath);
}
예제 #3
0
void MacrosDlg::AddMacro(const wxString& name, const wxString& desc)
{
    long row = AppendListCtrlRow(m_listCtrlMacros);
    SetColumnText(m_listCtrlMacros, row, 0, name);
    SetColumnText(m_listCtrlMacros, row, 1, desc);

    // Only fill third column if we can and may expand the macros
    if (m_project && m_editor && name != "$(ProjectFiles)" && name != "$(ProjectFilesAbs)") {
        wxString value = ExpandVariables(name, m_project, m_editor);
        SetColumnText(m_listCtrlMacros, row, 2, value);

    } else {
        // No third column here... don't fill it or we get an assertion
    }
}
예제 #4
0
파일: INI.cpp 프로젝트: PATRONAS/xlloop
dictionary* INI::LoadIniFile(HINSTANCE hInstance, LPSTR inifile)
{
	dictionary* ini = NULL;

	// First attempt to load INI from exe
	HRSRC hi = FindResource(hInstance, MAKEINTRESOURCE(1), RT_INI_FILE);
	if(hi) {
		HGLOBAL hg = LoadResource(hInstance, hi);
		PBYTE pb = (PBYTE) LockResource(hg);
		DWORD* pd = (DWORD*) pb;
		if(*pd == INI_RES_MAGIC) {
			ini = iniparser_load((char *) &pb[RES_MAGIC_SIZE], true);	
			if(!ini) {
				Log::Warning("Could not load embedded INI file");
			}
		}
	}

	// Check if we have already loaded an embedded INI file - if so 
	// then we only need to load and merge the INI file (if present)
	if(ini && iniparser_getboolean(ini, ALLOW_INI_OVERRIDE, 1)) {
		dictionary* ini2 = iniparser_load(inifile);
		if(ini2) {
			for(int i = 0; i < ini2->n; i++) {
				char* key = ini2->key[i];
				char* value = ini2->val[i];
				iniparser_setstr(ini, key, value);
			}		
			iniparser_freedict(ini2);
		}
	} else if(!ini) {
		ini = iniparser_load(inifile);
		if(ini == NULL) {
			Log::Error("Could not load INI file: %s", inifile);
			return NULL;
		}
	}

	// Expand environment variables
	ExpandVariables(ini);

	// Now check if we have an external file to load
	char* iniFileLocation = iniparser_getstr(ini, INI_FILE_LOCATION);
	if(iniFileLocation) {
		Log::Info("Loading INI keys from file location: %s", iniFileLocation);
		dictionary* ini3 = iniparser_load(iniFileLocation);
		if(ini3) {
			for(int i = 0; i < ini3->n; i++) {
				char* key = ini3->key[i];
				char* value = ini3->val[i];
				iniparser_setstr(ini, key, value);
			}		
			iniparser_freedict(ini3);
		} else {
			Log::Warning("Could not load INI keys from file: %s", iniFileLocation);
		}
	}

	// Attempt to parse registry location to include keys if present
	ParseRegistryKeys(ini);

	iniparser_setstr(ini, MODULE_INI, inifile);

	// Add module name to ini
	TCHAR filename[MAX_PATH], filedir[MAX_PATH];
	GetModuleFileName(hInstance, filename, MAX_PATH);
	iniparser_setstr(ini, MODULE_NAME, filename);

	// strip off filename to get module directory
	GetFileDirectory(filename, filedir);
	iniparser_setstr(ini, MODULE_DIR, filedir);

	// stip off filename to get ini directory
	GetFileDirectory(inifile, filedir);
	iniparser_setstr(ini, INI_DIR, filedir);

	// Log init
	Log::Init(hInstance, iniparser_getstr(ini, LOG_FILE), iniparser_getstr(ini, LOG_LEVEL), ini);
	Log::Info("Module Name: %s", filename);
	Log::Info("Module INI: %s", inifile);
	Log::Info("Module Dir: %s", filedir);
	Log::Info("INI Dir: %s", filedir);

	// Store a reference to be used by JNI functions
	g_ini = ini;

	return ini;
}
예제 #5
0
/*  Process an "output" translation spec - one of StartText, EndText,
 *  Replace, Message (these are the ones that produce output), or
 *  StartCode and EndCode (these get passed to the interpreter).
 *  Steps done:
 *	Expand attributes and regular varaibles in input string.
 *	Pass thru string, accumulating chars to be sent to output stream.
 *	If we find the start of a special variable, output what we've
 *	  accumulated, then find the special variable's "bounds" (ie, the
 *	  stuff between the curly brackets), and expand that by passing to
 *	  ExpandSpecialVar().  Continue until done the input string.
 *  Arguments:
 *	Input buffer (string) to be expanded and output.
 *	Pointer to element under consideration.
 *	FILE pointer to where to write output.
 *	Flag saying whether to track the character position we're on
 *	  (passed to OutputString).
 */
void
ProcesOutputSpec(
    char	*ib,
    Element_t	*e,
    FILE	*fp,
    int		track_pos
)
{
    char	obuf[LINESIZE];
    char	vbuf[LINESIZE];
    char	*dest, vname[LINESIZE], *cp;
    int		esc;

    obuf[0] = EOS;			/* start with empty output buffer */

    ExpandVariables(ib, vbuf, e);	/* expand regular variables */
    ib = vbuf;
    dest = obuf;

    esc = 0;
    while (*ib) {
	/* Is esc-$ next?  If so, just copy the '$'. */
	if (*ib == '\\' && ib[1] == VDELIM) {
	    ib++;			/* skip esc */
	    *dest++ = *ib++;		/* copy $ */
	    continue;
	}

	/* If not a $, it's a regular char.  Just copy it and go to next. */
	if (*ib != VDELIM) {		/* look for att/variable marker */
	    *dest++ = *ib++;		/* it's not. just copy character */
	    continue;
	}

	/* We have a $.  What we have must be a "special variable" since
	 * regular variables have already been expanded, or just a lone $. */

	if (ib[1] != L_CURLY) {	/* just a stray dollar sign (no variable) */
	    *dest++ = *ib++;
	    continue;
	}

	ib++;				/* point past $ */

	/* Output what we have in buffer so far. */
	*dest = EOS;			/* terminate string */
	if (obuf[0]) OutputString(obuf, fp, track_pos);
	dest = obuf;			/* ready for new stuff in buffer */

	if (!strchr(ib, R_CURLY)) {
	    fprintf(stderr, "Mismatched braces in TranSpec: %s\n", ib);
	    /* how do we recover from this? */
	}
	ib++;
	cp = vname;
	while (*ib && *ib != R_CURLY) *cp++ = *ib++;
	*cp = EOS;			/* terminate att/var name */
	ib++;				/* point past closing curly */
	/* we now have special variable name (stuff in curly {}'s) in vname */
	/* if the special variable is _break and it's true, we're done */
	if (ExpandSpecialVar(&vname[1], e, fp, track_pos) == CONT_BREAK) {
	    break;
	}
    }
    *dest = EOS;			/* terminate string in output buffer */

    if (obuf[0]) OutputString(obuf, fp, track_pos);
}
예제 #6
0
void
ExpandSpecialVar(
    char	*name,
    Element_t	*e,
    FILE	*fp,
    int		track_pos
)
{
    FILE	*infile;
    char	buf[LINESIZE], *cp, *cp2, *atval;
    char	**tok;
    int		ntok, n, i, actioni;
    char	*action, *action1;
    Element_t	*ep;
    Trans_t	*t, *tt;
    Entity_t	*entp;

    /* Run a command.
     * Format: _! command args ... */
    if (*name == '!') {
	name++;
	if ((infile = popen(name, "r"))) {
	    while (fgets(buf, LINESIZE, infile)) fputs(buf, fp);
	    pclose(infile);
	    fflush(fp);
	}
	else {
	    fprintf(stderr, "Could not start program '%s': %s",
		name, strerror(errno));
	}
	return;
    }

    /* See if caller wants one of the tokens from _eachatt or _eachcon.
     * If so, output it and return.  (Yes, I admit that this is a hack.)
     */
    if (*name == 'A' && name[1] == EOS && each_A) {
	OutputString(each_A, fp, track_pos);
	return;
    }
    if (*name == 'C' && name[1] == EOS && each_C) {
	OutputString(each_C, fp, track_pos);
	return;
    }

    ntok = 0;
    tok = Split(name, &ntok, 0);

    /* Include another file.
     * Format: _include filename */
    if (StrEq(tok[0], "include")) {
	name = tok[1];
	if (ntok > 1 ) {
	    if ((infile=OpenFile(name)) == NULL) {
		sprintf(buf, "Can not open included file '%s'", name);
		perror(buf);
		return;
	    }
	    while (fgets(buf, LINESIZE, infile)) fputs(buf, fp);
	    fclose(infile);
	}
	else fprintf(stderr, "No file name specified for include\n");
	return;
    }

    /* Print location (nearest title, line no, path).
     * Format: _location */
    else if (StrEq(tok[0], "location")) {
	PrintLocation(e, fp);
    }

    /* Print path to this element.
     * Format: _path */
    else if (StrEq(tok[0], "path")) {
	(void)FindElementPath(e, buf);
	OutputString(buf, fp, track_pos);
    }

    /* Print name of this element (gi).
     * Format: _gi [M|L|U] */
    else if (StrEq(tok[0], "gi")) {
	strcpy(buf, e->gi);
	if (ntok >= 2) {
	    if (*tok[1] == 'L' || *tok[1] == 'l' ||
		*tok[1] == 'M' || *tok[1] == 'm') {
		for (cp=buf; *cp; cp++)
		    if (isupper(*cp)) *cp = tolower(*cp);
	    }
	    if (*tok[1] == 'M' || *tok[1] == 'm')
		if (islower(buf[0])) buf[0] = toupper(buf[0]);
	}
	OutputString(buf, fp, track_pos);
    }

    /* Print filename of this element's associated external entity.
     * Format: _filename */
    else if (StrEq(tok[0], "filename")) {
    	if ( ntok >= 2 )	{
	    cp2 = FindAttValByName(e, tok[1]);
	    if ( ! (entp = FindEntity(cp2)) )	{
	    	fprintf(stderr, "Can't find entity named %s (via _filename expression):\n", tok[1]);
	    	PrintLocation(e, stderr);
	    	return;
	    }
	    OutputString(entp->sysid, fp, track_pos);
	} else	{
	    if (!e->entity) {
	    	fprintf(stderr, "Expected ext entity (element %s) - no ->entity (internal error? bug?):\n", e->gi);
	    	PrintLocation(e, stderr);
	    	return;
	    }
	    if (!e->entity->fname) {
	    	fprintf(stderr, "Expected filename (element %s) - no ->entity->fname (internal error? bug?):\n", e->gi);
	    	PrintLocation(e, stderr);
	    	return;
	    }
	    OutputString(e->entity->sysid, fp, track_pos);
	}
    }

    /* Value of parent's attribute, by attr name.
     * Format: _pattr attname */
    else if (StrEq(tok[0], "pattr")) {
	ep = e->parent;
	if (!ep) {
	    fprintf(stderr, "Element does not have a parent:\n");
	    PrintLocation(ep, stderr);
	    return;
	}
	if ((atval = FindAttValByName(ep, tok[1]))) {
	    OutputString(atval, fp, track_pos);
	}
    }

    /* Use an action, given transpec's SID.
     * Format: _action action */
    else if (StrEq(tok[0], "action")) {
	TranTByAction(e, tok[1], fp);
    }

    /* Number of child elements of this element.
     * Format: _nchild */
    else if (StrEq(tok[0], "nchild")) {
	if (ntok > 1) {
	    for (n=0,i=0; i<e->necont; i++)
		if (StrEq(e->econt[i]->gi, tok[1])) n++;
	}
	else n = e->necont;
	sprintf(buf, "%d", n);
	OutputString(buf, fp, track_pos);
    }

    /* number of 1st child's child elements (grandchildren from first child).
     * Format: _n1gchild */
    else if (StrEq(tok[0], "n1gchild")) {
	if (e->necont) {
	    sprintf(buf, "%d", e->econt[0]->necont);
	    OutputString(buf, fp, track_pos);
	}
    }

    /* Chase this element's pointers until we hit the named GI.
     * Do the action if it matches.
     * Format: _chasetogi gi action */
    else if (StrEq(tok[0], "chasetogi")) {
	if (ntok < 3) {
	    fprintf(stderr, "Error: Not enough args for _chasetogi.\n");
	    return;
	}
	actioni = atoi(tok[2]);
	if (actioni) ChaseIDRefs(e, tok[1], tok[2], fp);
    }

    /* Follow link to element pointed to, then do action.
     * Format: _followlink [attname] action. */
    else if (StrEq(tok[0], "followlink")) {
	char **s;
	if (ntok > 2) {
	    if ((atval = FindAttValByName(e, tok[1]))) {
		if ((ep = FindElemByID(atval))) {
		    TranTByAction(ep, tok[2], fp);
		    return;
		}
	    }
	    else fprintf(stderr, "Error: Did not find attr: %s.\n", tok[1]);
	    return;
	}
	GetIDREFnames();
	for (s=idrefs; *s; s++) {
	    /* is this IDREF attr set? */
	    if ((atval = FindAttValByName(e, *s))) {
		ntok = 0;
		tok = Split(atval, &ntok, S_STRDUP);
		/* we'll follow the first one... */
		if ((ep = FindElemByID(tok[0]))) {
		    TranTByAction(ep, tok[1], fp);
		    return;
		}
		else fprintf(stderr, "Error: Can not find elem for ID: %s.\n",
			tok[0]);
	    }
	}
	fprintf(stderr, "Error: Element does not have IDREF attribute set:\n");
	PrintLocation(e, stderr);
	return;
    }

    /* Starting at this element, decend tree (in-order), finding GI.
     * Do the action if it matches.
     * Format: _find args ... */
    else if (StrEq(tok[0], "find")) {
	Find(e, ntok, tok, fp);
    }

    /* Starting at this element's parent, decend tree (in-order), finding GI.
     * Do the action if it matches.
     * Format: _pfind args ... */
    else if (StrEq(tok[0], "pfind")) {
	Find(e->parent ? e->parent : e, ntok, tok, fp);
    }

    /* Content is supposed to be a list of IDREFs.  Follow each, doing action.
     * If 2 actions are specified, use 1st for the 1st ID, 2nd for the rest.
     * Format: _namelist action [action2] */
    else if (StrEq(tok[0], "namelist")) {
	int id;
	action1 = tok[1];
	if (ntok > 2) action = tok[2];
	else action = action1;
	for (i=0; i<e->ndcont; i++) {
	    n = 0;
	    tok = Split(e->dcont[i], &n, S_STRDUP);
	    for (id=0; id<n; id++) {
		if (fold_case)
		    for (cp=tok[id]; *cp; cp++)
			if (islower(*cp)) *cp = toupper(*cp);
		if ((e = FindElemByID(tok[id]))) {
		    if (id) TranTByAction(e, action, fp);
		    else TranTByAction(e, action1, fp);	/* first one */
		}
		else fprintf(stderr, "Error: Can not find ID: %s.\n", tok[id]);
	    }
	}
    }

    /* For each word in the element's content, do action.
     * Format: _eachcon action [action] */
    else if (StrEq(tok[0], "eachcon")) {
	int id;
	action1 = tok[1];
	if (ntok > 3) action = tok[2];
	else action = action1;
	for (i=0; i<e->ndcont; i++) {
	    n = 0;
	    tok = Split(e->dcont[i], &n, S_STRDUP|S_ALVEC);
	    for (id=0; id<n; id++) {
		each_C = tok[id];
		TranTByAction(e, action, fp);
	    }
	    free(*tok);
	}
    }
    /* For each word in the given attribute's value, do action.
     * Format: _eachatt attname action [action] */
    else if (StrEq(tok[0], "eachatt")) {
	int id;
	action1 = tok[2];
	if (ntok > 3) action = tok[3];
	else action = action1;
	if ((atval = FindAttValByName(e, tok[1]))) {
	    n = 0;
	    tok = Split(atval, &n, S_STRDUP|S_ALVEC);
	    for (id=0; id<n; id++) {
		each_A = tok[id];
		if (id) TranTByAction(e, action, fp);
		else TranTByAction(e, action1, fp);	/* first one */
	    }
	    free(*tok);
	}
    }

    /* Do action on this element if element has [relationship] with gi.
     * Format: _relation relationship gi action [action] */
    else if (StrEq(tok[0], "relation")) {
	if (ntok >= 4) {
	    if (!CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Current)) {
		/* action not done, see if alt action specified */
		if (ntok >= 5)
		    TranTByAction(e, tok[4], fp);
	    }
	}
    }

    /* Do action on followed element if element has [relationship] with gi.
     * Format: _followrel relationship gi action */
    else if (StrEq(tok[0], "followrel")) {
	if (ntok >= 4)
	    (void)CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Related);
    }

    /* Find element with matching ID and do action.  If action not specified,
     * choose the right one appropriate for its context.
     * Format: _id id [action] */
    else if (StrEq(tok[0], "id")) {
	if ((ep = FindElemByID(tok[1]))) {
	    if (ntok > 2) TranTByAction(ep, tok[2], fp);
	    else {
		t = FindTrans(ep, 0);
		TransElement(ep, fp, t);
	    }
	}
    }

    /* Set variable to value.
     * Format: _set name value */
    else if (StrEq(tok[0], "set")) {
	SetMappingNV(Variables, tok[1], tok[2]);
    }

    /* Do action if variable is set, optionally to value.
     * If not set, do nothing.
     * Format: _isset varname [value] action 
     * Format: _issete varname [value] action  --  expands value */
    else if (StrEq(tok[0], "isset") || StrEq(tok[0], "issete")) {
	if ((cp = FindMappingVal(Variables, tok[1]))) {
	    if (ntok == 3) TranTByAction(e, tok[2], fp);
	    else
	    if (ntok > 3)	{
	    	if ( StrEq(tok[0], "issete") )	{
			ExpandVariables(tok[2], buf, e);
			cp2 = buf;
		} else
			cp2 = tok[2];
	    	if ( !strcmp(cp, cp2))
			TranTByAction(e, tok[3], fp);
	    }
	}
    }

    /* Insert a node into the tree at start/end, pointing to action to perform.
     * Format: _insertnode S|E action */
    else if (StrEq(tok[0], "insertnode")) {
	actioni = atoi(tok[2]);
	if (*tok[1] == 'S') e->gen_trans[0] = actioni;
	else if (*tok[1] == 'E') e->gen_trans[1] = actioni;
    }

    /* Do an CALS DTD table spec for TeX or troff.  Looks through attributes
     * and determines what to output. "check" means to check consistency,
     * and print error messages.
     * This is (hopefully) the only hard-coded part of instant.
     *
     * This was originally written for the OSF DTDs and recoded by FLD for
     * CALS tables (since no one will ever use the OSF tables).  Although
     * TeX was addressed first, it seems that a fresh approach was required,
     * and so, tbl is the first to be really *fixed*.  Once tbl is stable,
     * and there is a need for TeX again, that part will be recoded.
     *
     * *Obsolete* form (viz, for TeX):
     *    Format: _calstable [clear|check|tex]
     *			  [cellstart|cellend|rowstart|rowend|top|bottom]
     *
     * New, good form:
     *
     *    Format: _calstable [tbl]
     *			  [tablestart|tableend|tablegroup|tablefoot|rowstart|
     *			   rowend|entrystart|entryend]
     */

    else if (StrEq(tok[0], "calstable")) {
	CALStable(e, fp, tok, ntok);
    }

    /* Do action if element's attr is set, optionally to value.
     * If not set, do nothing.
     * Format: _attval att [value] action */
    else if (StrEq(tok[0], "attval")) {
	if ((atval = FindAttValByName(e, tok[1]))) {
	    if (ntok == 3) TranTByAction(e, tok[2], fp);
	    else if (ntok > 3 && !strcmp(atval, tok[2]))
		TranTByAction(e, tok[3], fp);
	}
    }
    /* Same thing, but look at parent */
    else if (StrEq(tok[0], "pattval")) {
	if ((atval = FindAttValByName(e->parent, tok[1]))) {
	    if (ntok == 3) {
		TranTByAction(e, tok[2], fp);
	    }
	    if (ntok > 3 && !strcmp(atval, tok[2]))
		TranTByAction(e, tok[3], fp);
	}
    }

    /* Print each attribute and value for the current element, hopefully
     * in a legal sgml form: <elem-name att1="value1" att2="value2:> .
     * Format: _allatts */
    else if (StrEq(tok[0], "allatts")) {
	for (i=0; i<e->natts; i++) {
	    if (i != 0) putc(' ', fp);
	    fputs(e->atts[i].name, fp);
	    fputs("=\"", fp);
	    fputs(e->atts[i].sval, fp);
	    putc('"', fp);
	}
    }

    /* Print the element's input filename, and optionally, the line number.
     * Format: _infile [line] */
    else if (StrEq(tok[0], "infile")) {
	if (e->infile) {
	    if (ntok > 1 && !strcmp(tok[1], "root")) {
		strcpy(buf, e->infile);
		if ((cp = strrchr(buf, '.'))) *cp = EOS;
		fputs(buf, fp);
	    }
	    else {
		fputs(e->infile, fp);
		if (ntok > 1 && !strcmp(tok[1], "line"))
		    fprintf(fp, " %d", e->lineno);
	    }
	    return;
	}
	else fputs("input-file??", fp);
    }

    /* Get value of an environement variable */
    else if (StrEq(tok[0], "env")) {
	if (ntok > 1 && (cp = getenv(tok[1]))) {
	    OutputString(cp, fp, track_pos);
	}
    }

    /* Something unknown */
    else {
	fprintf(stderr, "Unknown special variable: %s\n", tok[0]);
	tt = e->trans;
	if (tt && tt->lineno)
	    fprintf(stderr, "Used in transpec, line %d\n", tt->lineno);
    }
    return;
}
예제 #7
0
void WizardsPlugin::CreateWxProject(NewWxProjectInfo &info)
{
    //TODO:: Implement this ...
    wxString basedir = m_mgr->GetStartupDirectory();

    //we first create the project files
    if (info.GetType() == wxProjectTypeGUI) {

        //we are creating a project of type GUI
        wxString projectConent;
        wxString mainFrameCppContent;
        wxString mainFrameHContent;
        wxString appCppConent;
        wxString apphConent;
        wxString rcContent;
        wxString pchContent;

        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wxproject.project.wizard"), projectConent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/mainframe.cpp.wizard"), mainFrameCppContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/mainframe.h.wizard"), mainFrameHContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/app.h.wizard"), apphConent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/app.cpp.wizard"), appCppConent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/resources.rc.wizard"), rcContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wx_pch.h.wizard"), pchContent)) {
            return;
        }

        ExpandVariables(projectConent, info);
        ExpandVariables(mainFrameCppContent, info);
        ExpandVariables(mainFrameHContent, info);
        ExpandVariables(apphConent, info);
        ExpandVariables(appCppConent, info);

        //Write the files content into the project directory
        DirSaver ds;
        wxSetWorkingDirectory(info.GetPath());

        wxString projname = info.GetName();
        projname.MakeLower();

        wxString appfilename = projname + wxT("_app");
        wxString framefilename = projname + wxT("_frame");

        WriteFile(framefilename + wxT(".cpp"), mainFrameCppContent);
        WriteFile(framefilename + wxT(".h"), mainFrameHContent);
        WriteFile(appfilename + wxT(".h"), apphConent);
        WriteFile(appfilename+ wxT(".cpp"), appCppConent);
        if( info.GetFlags() & wxWidgetsWinRes ) WriteFile(wxT("resources.rc"), rcContent);
        if( info.GetFlags() & wxWidgetsPCH ) WriteFile(wxT("wx_pch.h"), pchContent);
        WriteFile(info.GetName() + wxT(".project"), projectConent);

        //If every this is OK, add the project as well
        m_mgr->AddProject(info.GetName() + wxT(".project"));

    } else if (info.GetType() == wxProjectTypeGUIFBDialog) {

        //we are creating a project of type GUI (dialog generated by wxFormBuilder)

        wxString projectContent;
        wxString mainFrameCppContent;
        wxString mainFrameHContent;
        wxString appCppContent;
        wxString apphContent;
        wxString fbContent;
        wxString rcContent;
        wxString pchContent;

        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wxproject-fb.project.wizard"), projectContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-dialog.cpp.wizard"), mainFrameCppContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-dialog.h.wizard"), mainFrameHContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/main-dialog.h.wizard"), apphContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/main-dialog.cpp.wizard"), appCppContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-dialog.fbp.wizard"), fbContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/resources.rc.wizard"), rcContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wx_pch.h.wizard"), pchContent)) {
            return;
        }

        ExpandVariables(projectContent, info);
        ExpandVariables(mainFrameCppContent, info);
        ExpandVariables(mainFrameHContent, info);
        ExpandVariables(apphContent, info);
        ExpandVariables(appCppContent, info);

        //Write the files content into the project directory
        DirSaver ds;
        wxSetWorkingDirectory(info.GetPath());

        wxString projname = info.GetName();
        projname.MakeLower();

        wxString appfilename = projname + wxT("_app");

        WriteFile(wxT("gui.cpp"), mainFrameCppContent);
        WriteFile(wxT("gui.h"), mainFrameHContent);
        WriteFile(appfilename + wxT(".h"), apphContent);
        WriteFile(appfilename+ wxT(".cpp"), appCppContent);
        WriteFile(wxT("gui.fbp"), fbContent);
        if( info.GetFlags() & wxWidgetsWinRes ) WriteFile(wxT("resources.rc"), rcContent);
        if( info.GetFlags() & wxWidgetsPCH ) WriteFile(wxT("wx_pch.h"), pchContent);
        WriteFile(info.GetName() + wxT(".project"), projectContent);

        //If every this is OK, add the project as well
        m_mgr->AddProject(info.GetName() + wxT(".project"));

    } else if (info.GetType() == wxProjectTypeGUIFBFrame) {

        //we are creating a project of type GUI (dialog generated by wxFormBuilder)

        wxString projectContent;
        wxString mainFrameCppContent;
        wxString mainFrameHContent;
        wxString appCppContent;
        wxString apphContent;
        wxString fbContent;
        wxString pchContent;
        wxString rcContent;

        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wxproject-fb.project.wizard"), projectContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-frame.cpp.wizard"), mainFrameCppContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-frame.h.wizard"), mainFrameHContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/main-frame.h.wizard"), apphContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/main-frame.cpp.wizard"), appCppContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/gui-frame.fbp.wizard"), fbContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/resources.rc.wizard"), rcContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wx_pch.h.wizard"), pchContent)) {
            return;
        }

        ExpandVariables(projectContent, info);
        ExpandVariables(mainFrameCppContent, info);
        ExpandVariables(mainFrameHContent, info);
        ExpandVariables(apphContent, info);
        ExpandVariables(appCppContent, info);

        //Write the files content into the project directory
        DirSaver ds;
        wxSetWorkingDirectory(info.GetPath());

        wxString projname = info.GetName();
        projname.MakeLower();

        wxString appfilename = projname + wxT("_app");

        WriteFile(wxT("gui.cpp"), mainFrameCppContent);
        WriteFile(wxT("gui.h"), mainFrameHContent);
        WriteFile(appfilename + wxT(".h"), apphContent);
        WriteFile(appfilename+ wxT(".cpp"), appCppContent);
        WriteFile(wxT("gui.fbp"), fbContent);
        if( info.GetFlags() & wxWidgetsWinRes ) WriteFile(wxT("resources.rc"), rcContent);
        if( info.GetFlags() & wxWidgetsPCH ) WriteFile(wxT("wx_pch.h"), pchContent);
        WriteFile(info.GetName() + wxT(".project"), projectContent);

        //If every this is OK, add the project as well
        m_mgr->AddProject(info.GetName() + wxT(".project"));

    } else if (info.GetType() == wxProjectTypeSimpleMain) {

        //we are creating a project of type console app

        wxString projectConent;
        wxString appCppConent;
        wxString pchContent;
        wxString rcContent;

        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wxmain.project.wizard"), projectConent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/main.cpp.wizard"), appCppConent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/resources.rc.wizard"), rcContent)) {
            return;
        }
        if (!ReadFileWithConversion(basedir + wxT("/templates/gizmos/wx_pch.h.wizard"), pchContent)) {
            return;
        }

        ExpandVariables(projectConent, info);
        ExpandVariables(appCppConent, info);

        //Write the files content into the project directory
        DirSaver ds;
        wxSetWorkingDirectory(info.GetPath());

        wxString projname = info.GetName();
        projname.MakeLower();

        wxString appfilename = projname;
        WriteFile(appfilename+ wxT(".cpp"), appCppConent);
        if( info.GetFlags() & wxWidgetsWinRes ) WriteFile(wxT("resources.rc"), rcContent);
        if( info.GetFlags() & wxWidgetsPCH ) WriteFile(wxT("wx_pch.h"), pchContent);
        WriteFile(info.GetName() + wxT(".project"), projectConent);

        //If every this is OK, add the project as well
        m_mgr->AddProject(info.GetName() + wxT(".project"));
    }
}