/**
 * Creates all files belonging to the project
 *
 * @param           
 * @return          
 * @exception       -
 * @see             
*/
HRESULT CProjectWizardData::CreateProjectFiles ()
{
    HRESULT hr;

    hr = CreateProjectDirectory ();
    if (hr != S_OK)
        return (hr);
 
    hr = CreateProjectFile ();
    if (hr != S_OK)
        return (hr);

	hr = CreateLatcommFile ();
    if (hr != S_OK)
        return (hr);

    hr = CreateConfigurationFile ();
    if (hr != S_OK)
        return (hr);

    hr = CreateResourceDependentFiles ();
    if (hr != S_OK)
        return (hr);

    return (S_OK);
}
Ejemplo n.º 2
0
static Bool configcit(void)
    {
    Bool oldresizelog = FALSE, oldresizemsg = FALSE;

    CitadelIsConfiguring = TRUE;

    VerifyHeap();

#ifndef WINCIT
    if (OC.PrintFile)
        {
        fclose(OC.PrintFile);
        OC.PrintFile = NULL;
        }

    if (journalfl)
        {
        fclose(journalfl);
        journalfl = NULL;
        }
#endif

    if (TrapFile)
        {
        fclose(TrapFile);
        TrapFile = NULL;
        }

    if (RoomFile)
        {
        fclose(RoomFile);
        RoomFile = NULL;
        }


    // read CONFIG.CIT
    if (!readconfig(NULL, 0))
        {
        return (FALSE);
        }


	Bool grpZap = FALSE, hallZap = FALSE, msgZap = FALSE, logZap = FALSE, log2Zap = FALSE, log3Zap = FALSE,
			log4Zap = FALSE, log5Zap = FALSE, log6Zap = FALSE, roomZap = FALSE, roomposZap = FALSE;

    initfiles(&grpZap, &hallZap, &msgZap, &logZap, &log2Zap, &log3Zap, &log4Zap, &log5Zap, &log6Zap, &roomZap, &roomposZap);

    VerifyHeap();

    // if we are about to make a new system, make default .CIT files.
    if (msgZap && roomZap && logZap && grpZap && hallZap && roomposZap)
        {
        CreateConfigurationFile(C_EXTERNAL_CIT, 0, TRUE);
        CreateConfigurationFile(C_NODES_CIT, 1, TRUE);
        CreateConfigurationFile(C_GRPDATA_CIT, 2, TRUE);
        CreateConfigurationFile(C_CRON_CIT, 3, TRUE);
        CreateConfigurationFile(C_MDMRESLT_CIT, 4, TRUE);
        CreateConfigurationFile(C_PROTOCOL_CIT, 5, TRUE);
        CreateConfigurationFile(C_TERMCAP_CIT, 6, TRUE);
        CreateConfigurationFile(C_COMMANDS_CIT, 7, TRUE);
        }

    VerifyHeap(1);

    // allocate tables here so readconfig() can be called from sysop menu
    allocateTables();

#ifndef WINCIT
    setdefaultTerm(TT_ANSI);
    termCap(TERM_NORMAL);
#endif

    VerifyHeap(1);

#ifdef WINCIT
    if (msgZap || roomZap || logZap || grpZap || hallZap || roomposZap)
        {
        hCreateDlg = CreateDialog(hInstance, "CREATEDATAFILES", NULL, (DLGPROC) EmptyDlgProc);
        }
#endif

    if (msgZap)
        {
        MessageDat.InitializeMessageFile(cfg.MsgDatSizeInK * 1024l);
        }

    if (roomZap)    zapRoomFile();
    if (logZap)     zapLogFile(FALSE, TRUE);
    if (grpZap)     zapGrpFile(NULL, TRUE);
    if (hallZap)    zapHallFile();
    if (roomposZap) zapRoomPosFile(TRUE);

    if (roomZap && !msgZap) roomBuild = TRUE;
    if (hallZap && !msgZap) hallBuild = TRUE;

    if (!logZap)
        {
        if (log2Zap)    zapLog2();
        if (log3Zap)    zapLog3();
        if (log4Zap)    zapLog4();
        if (log5Zap)    zapLog5();
        if (log6Zap)    zapLog6();
        }

#ifdef WINCIT
    if (hCreateDlg)
        {
        DestroyWindow(hCreateDlg);
        hCreateDlg = NULL;
        }

// no go for debug version; td32 go crash crash
    hConfigDlg = CreateDialog(hInstance, "CONFIGURE", NULL, (DLGPROC) EmptyDlgProc);
#endif

    VerifyHeap(1);

    logInit();

    VerifyHeap(1);

	MessageDat.BuildTable();

    VerifyHeap(1);

    RoomTabBld();

    VerifyHeap(1);

#ifdef WINCIT
    if (hConfigDlg)
        {
        DestroyWindow(hConfigDlg);
        hConfigDlg = NULL;
        }
#endif

    if (hallBuild)
        {
        buildhalls();
        VerifyHeap(1);
        }

    if (resizeRoom)
        {
        resizeroomfile();
        VerifyHeap(1);
        }

    if (resizeGrp)
        {
        resizegrpfile();
        VerifyHeap(1);
        }

    if (resizeHall)
        {
        resizehallfile();
        VerifyHeap(1);
        }

    if (resizeLog)
        {
        resizelogfile();
        VerifyHeap(1);
        }

    if (resizeMsg)
        {
        MessageDat.Resize(newmessagek * 1024l);	// bibnewmsg
        VerifyHeap(1);
        }

    if (resizeLog || resizeMsg || resizeRoom || resizeGrp)
        {
        oldresizelog = resizeLog;
        oldresizemsg = resizeMsg;
        resizeLog = FALSE;
        resizeMsg = FALSE;

        MessageDat.CloseMessageFile();

#ifndef MINGW
        fcloseall();
#endif

        cfg.MsgDatSizeInK = newmessagek;
        cfg.MAXLOGTAB = newmaxlogtab;

        initfiles(&grpZap, &hallZap, &msgZap, &logZap, &log2Zap, &log3Zap, &log4Zap, &log5Zap, &log6Zap, &roomZap, &roomposZap);
        }

    VerifyHeap(1);

#ifdef WINCIT
    if (oldresizelog || oldresizemsg)
        {
        hConfigDlg = CreateDialog(hInstance, "CONFIGURE", NULL, (DLGPROC) EmptyDlgProc);
        }
#endif

    if (oldresizelog)
        {
        if (!LogTab.Resize(cfg.MAXLOGTAB))
            {
            crashout(getcfgmsg(116));
            }

        VerifyHeap(1);

        logInit();

        VerifyHeap(1);
        }

	if (oldresizemsg)	// bibnewmsg - required?
        {
        MessageDat.SetTableSize(cfg.nmessages);

        VerifyHeap(1);

        MessageDat.BuildTable();

        VerifyHeap(1);
        }

#ifdef WINCIT
    if (hConfigDlg)
        {
        DestroyWindow(hConfigDlg);
        hConfigDlg = NULL;
        }
#else
    doccr();
    cPrintf(getcfgmsg(135));
    doccr();
    pause(200);
#endif

	MessageDat.CloseMessageFile();

#ifndef WINCIT
    if (OC.PrintFile)
        {
        fclose(OC.PrintFile);
        OC.PrintFile = NULL;
        }

    if (journalfl)
        {
        fclose(journalfl);
        journalfl = NULL;
        }
#endif

    if (TrapFile)
        {
        fclose(TrapFile);
        TrapFile = NULL;
        }

    if (RoomFile)
        {
        fclose(RoomFile);
        RoomFile = NULL;
        }

    VerifyHeap(1);

    CitadelIsConfiguring = FALSE;

    return (TRUE);
    }