Ejemplo n.º 1
0
void __fastcall TfrmImageLib::UpdateLib()
{
    VERIFY			(!bReadonlyMode);
    RegisterModifiedTHM	        ();
    SaveUsedTHM			();
    if (bImportMode && !texture_map.empty())
    {
    	AStringVec modif;
        LockForm();
        ImageLib.SafeCopyLocalToServer(texture_map);
		// rename with folder
        FS_FileSet files        = texture_map;
        texture_map.clear       ();
        xr_string               fn;
        FS_FileSetIt it         = files.begin();
        FS_FileSetIt _E         = files.end();

        for (;it!=_E; it++)
        {
            fn                  = EFS.ChangeFileExt(it->name.c_str(),"");
            ImageLib.UpdateFileName(fn);
            FS_File		F(*it);
            F.name		= fn;
            texture_map.insert  (F);
        }
        // sync
	ImageLib.SynchronizeTextures(true,true,true,&texture_map,&modif);
        UnlockForm              ();
    	ImageLib.RefreshTextures(&modif);
    }else
    {
    // save game textures
        if (modif_map.size())
        {
            AStringVec modif;
	    LockForm();
            ImageLib.SynchronizeTextures(true,true,true,&modif_map,&modif);
            UnlockForm();
            ImageLib.RefreshTextures(&modif);
        }
    }
}
Ejemplo n.º 2
0
void __fastcall TfrmSoundLib::UpdateLib()
{
    RegisterModifiedTHM		();
    SaveUsedTHM				();
    // save game sounds
    if (modif_map.size()){
        AStringVec 			modif;
        LockForm			();
        SndLib->SynchronizeSounds	(true,true,true,&modif_map,0);
//		SndLib->ChangeFileAgeTo		(&modif_map,time(NULL));
        UnlockForm			();
        SndLib->RefreshSounds(false);
		modif_map.clear		();
    }
}
Ejemplo n.º 3
0
void __fastcall TfrmImageLib::ebRebuildAssociationClick(TObject *)
{
	if (ELog.DlgMsg(mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo,"Are you sure to export association?")==mrNo) return;

    if (!modif_map.empty()){
        int res = ELog.DlgMsg(mtConfirmation,TMsgDlgButtons()<<mbYes<<mbNo<<mbCancel,"Save modified properties?");
        switch (res){
        case mrYes: 	UpdateLib();	break;
        case mrNo: 			  			break;
        case mrCancel: 		  			return;
        }
    }

	string_path nm;
    FS.update_path			(nm,_game_textures_,"textures.ltx");
	CInifile* ini 			= xr_new<CInifile>(nm, FALSE, FALSE, TRUE);

	LockForm				();

    FS_FileSetIt it		= texture_map.begin();
    FS_FileSetIt _E		= texture_map.end();
	SPBItem* pb = UI->ProgressStart(texture_map.size(),"Export association");
    bool bRes=true;
    for (;it!=_E; it++){
        ETextureThumbnail* m_Thm = xr_new<ETextureThumbnail>(it->name.c_str());
	    pb->Inc				(it->name.c_str());
        AnsiString base_name= ChangeFileExt(it->name.c_str(),"");
        ImageLib.WriteAssociation	(ini,base_name.c_str(),m_Thm->_Format());
        xr_delete			(m_Thm);
		if (UI->NeedAbort()){ bRes=false; break; }
    }
	UI->ProgressEnd(pb);

	UnlockForm();

    if (!bRes) ini->bSaveAtEnd = false;
	xr_delete(ini);
}