Esempio n. 1
0
String 
make_vmat_output_name(const String& proj_name, const String& fn, bool compress)
{
  // Build full path
  String vmat_fp = ChangeFileExt(ChangeFileExt(outgridfn)) + "." + fn;
  if (compress)
    vmat_fp += comp_suffix;
  return vmat_fp;
}
Esempio n. 2
0
//---------------------------------------------------------------------------
void __fastcall TFaceEditorWindow::ClearModelActionExecute(TObject *Sender)
{
  if (Form1->FImageToolkit1->CurrentTool == ftFaceTool)
  {
      TFaceModelTool* tool = (TFaceModelTool*)Form1->FImage1->Tool;
      tool->Reset();
      if (FileExists(ChangeFileExt(Form1->FileListBox1->FileName,".face")))
        DeleteFile(ChangeFileExt(Form1->FileListBox1->FileName,".face"));
  }
}
Esempio n. 3
0
//---------------------------------------------------------------------------
void __fastcall TFormMain::ExportCFileClick(TObject *Sender)
{
  if (ExportDialog->Execute())
  {
    TStringList* SL = new TStringList;
    __try
    {
      ChangeFileExt(ExtractFileName(ExportDialog->FileName), "");

      SL->Add(Format("YETI_ROM rom_map_t %s = {", ARRAYOFCONST((
        ChangeFileExt(ExtractFileName(ExportDialog->FileName), "")))));

      SL->Add(Format("\"%s\",\"%s\",\"%s\",{", ARRAYOFCONST((
        "Test Map",
        "Derek J. Evans",
        "Welcome to Yeti3D"))));

      for (int y = 0; y < YETI_MAP_HEIGHT; y++)
      {
        SL->Add("{");
        for (int x = 0; x < YETI_MAP_WIDTH; x++)
        {
          cell_t* cell = &yeti->cells[y][x];

          SL->Add(Format("{%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d},", ARRAYOFCONST((
            cell->swi,
            cell->ent,
            cell->top,
            cell->mid,
            cell->bot,
            cell->lit,
            cell->wtx,
            cell->ttx,
            cell->mtx,
            cell->btx,
            0,  // Reserved 1            
            0   // Reserved 2
            ))));
        }
        String S =  SL->Strings[SL->Count - 1];
        SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
        SL->Add("},");
      }
      String S =  SL->Strings[SL->Count - 1];
      SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
      SL->Add("}};");
      
      SL->SaveToFile(ExportDialog->FileName);
    }
    __finally
    {
      SL->Free();
    }
  }  
Esempio n. 4
0
//---------------------------------------------------------------------------
void __fastcall TLog::setLogFileNames(AnsiString name)
{
  // Set ELogFileName & OLogFileName
  if(logging)
  {
    stopLog();              // stop current log
    Application->MessageBox("Current Log Stopped.", "Information", MB_OK);
  }
  ELogFileName->Text = ChangeFileExt(name,"_RunLog.txt");
  OLogFileName->Text = ChangeFileExt(name,"_OutLog.txt");
  if (ElogFlag || OlogFlag) {
    Form1->ToolLogStart->Enabled = true;
    Form1->LogStart->Enabled = true;
  }
}
Esempio n. 5
0
//---------------------------------------------------------------------
__fastcall TAboutBox::TAboutBox(TComponent* AOwner)
	: TForm(AOwner)
{
  Caption=Application->Title;
  VersionInfo *vi=new VersionInfo(AnsiString(Application->ExeName).c_str());
  if(vi->hasInfo())
  {
	Label3->Caption=Format(L"Version %d.%d (Build %d.%d)",ARRAYOFCONST((
		vi->productMajorVersion(),
		vi->productMinorVersion(),
		vi->productBuild(),
		vi->productSubBuild())));
  }
  delete vi;


  String s=ChangeFileExt(Application->ExeName,".bmp");
  if(FileExists(s))
  {
    logo->Picture->LoadFromFile(s);
    Label4->Caption="Copyright 2003-2004 ¹è¹È¿Æ¼¼ Corporation";
    Label5->Caption="";
  }
  Label1->Caption=Application->Title;
  Label2->Caption=Application->Title;
  logo->Active=true;
}
Esempio n. 6
0
/*--------------------------------------------------------------------------*
Name:           ProcessFile

Description:    Process file.

Arguments:      filename: file to process.

Returns:        None.
*---------------------------------------------------------------------------*/
void MapConverter::ProcessFile(const char *filename)
{
	// load file, set map size from height/width line
	// if map isn't too large, reformat the file content, add size and .txt to filename
	// and save the file

	LoadFile(filename);

	if (!is_loaded_)
		return;

	mapsize_ = GetMapSize();

	// catch exception in GetMapSize(), std::stoi()
	if (has_exception_)
		return;

	if (IsMapGoodSize())
	{
		ReformatMap();
		ChangeFileExt();
		SaveFile(filename_.c_str());
	}
	else
		printf("Map too large.\n");
}
	//Class EventLogger
	EventLogger::EventLogger()
	{
		m_fOnDisplay = NULL;
		m_strFP = ChangeFileExt(GetExePath(), DAnsiStr(".pslog"));			
		m_szBufferSize = 0;
		setWriteFlags(PS_LOG_WRITE_EVENTTYPE | PS_LOG_WRITE_SOURCE | PS_LOG_WRITE_TO_SCREEN);
	}
//---------------------------------------------------------------------------
__fastcall THttpTestForm::THttpTestForm(TComponent* Owner)
    : TForm(Owner)
{
    // Build Ini file name
    FIniFileName = LowerCase(ChangeFileExt(Forms::Application->ExeName, ".ini"));
    FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini";
}
Esempio n. 9
0
bool CGlow::GetSummaryInfo(SSceneSummary* inf)
{
	inherited::GetSummaryInfo	(inf);
	if (m_TexName.size()) 	inf->AppendTexture(ChangeFileExt(*m_TexName,"").LowerCase().c_str(),SSceneSummary::sttGlow,0,0,"$GLOW$");
	inf->glow_cnt++;
	return true;
}
Esempio n. 10
0
void TfrmSoundLib::AppendModif(LPCSTR nm)
{
    FS_File 		dest;
    string_path		fname;
    FS.update_path	(fname,_sounds_,ChangeFileExt(nm,".wav").c_str());
	BOOL bFind		= FS.file_find(fname,dest); R_ASSERT(bFind);
    modif_map.insert(dest);
}
Esempio n. 11
0
//---------------------------------------------------------------------------
void __fastcall TMainWindow::FormCreate(TObject *Sender)
{
    InitializeCriticalSection(&CS);
   WSADATA wsaData,*lpwsaData;
   char *domain,user[256];

		lpwsaData = &wsaData;

		WORD wVersionRequested = MAKEWORD(1, 1);
		int nResult = WSAStartup(wVersionRequested, lpwsaData);
		if (nResult != 0) {
      	Application->MessageBox("WSAStartup failed","Error",MB_OK|MB_ICONERROR);
			return;
      }

		if (LOBYTE(lpwsaData->wVersion) != 1 || HIBYTE(lpwsaData->wVersion) != 1)
		{
			WSACleanup();
         Application->MessageBox("Wrong wsock version","Error",MB_OK|MB_ICONERROR);
			return;
		}
        DWORD size=256;
        domain=getenv("USERDOMAIN");
		GetUserNameA(user,&size);
        sprintf(name,"%s/%s",domain,user);
        Application->ShowHint = true;
        Application->OnHint = ShowHint;
        ShownBefore=false;


	Servers = new CServers(FALSE);
	PluginManager.LoadPlugins();
    CreatePluginMenu();
    PluginManager.RegisterClientWindow(Handle);
    Servers->RegisterClientWindow(Handle);

    //read checked Menue items from ini-file
    BOOL retval = true;
    DWORD errcode = NO_ERROR;
    char IniFileName[1024];
    AnsiString inivalue;
    if (!GetFullExeName(IniFileName))
       strcpy(IniFileName,"RexecShell.ini");
    else
    {
          ChangeFileExt(IniFileName,".ini") ;
        }
     IniFile = new TIniFile(IniFileName);
     inivalue = IniFile->ReadString("RexecShell" , "SetRPCEncryption","Default");
     if (inivalue == FALSESTR)
        RPCEncryption->Checked = false;
     SetRPCEncryption(RPCEncryption->Checked);   

     inivalue = IniFile->ReadString("RexecShell" , "checkprofilevalidity","Default");
     if (inivalue == FALSESTR)
        checkprofilevalidity->Checked = false;
     CheckUserAccountOnChange = checkprofilevalidity->Checked;
}
Esempio n. 12
0
void WriteToLog(String S) {
	HANDLE LogFile;
	String LogPath;
	String LogFileName;
	DWORD dwSize;
	AnsiString SS;
	TDateTime DateTime;
	LPDWORD NumberOfBytesWritten = new DWORD;

	try { // except
		DateTime = Now();

		LogPath = ExtractFilePath(Application->ExeName) + LoadStr(IDS_LOG_PATH);
		if (!DirectoryExists(LogPath))
			CreateDir(LogPath);

		LogFileName = IncludeTrailingPathDelimiter(LogPath) +
			ChangeFileExt(ExtractFileName(Application->ExeName),
			LoadStr(IDS_LOG_EXT));

		LogFile = CreateFile(LogFileName.w_str(), GENERIC_READ, FILE_SHARE_READ,
			NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

		dwSize = 0;
		if (LogFile != INVALID_HANDLE_VALUE) {
			dwSize = GetFileSize(LogFile, NULL);
			CloseHandle(LogFile);
		}

		if (dwSize > MaxLogSize) {
			String NewFileName = IncludeTrailingPathDelimiter(LogPath) +
				OnlyFileName(Application->ExeName) + SPACE + FormatDateTime
				(LoadStr(IDS_DATETIME_FORMAT_FILENAME), DateTime) +
				LoadStr(IDS_LOG_EXT);
			MoveFile(LogFileName.w_str(), NewFileName.w_str());
		}

		LogFile = CreateFile(LogFileName.w_str(), GENERIC_WRITE,
			FILE_SHARE_READ, NULL, OPEN_ALWAYS,
			FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_COMPRESSED, 0);

		if (LogFile != INVALID_HANDLE_VALUE) {
			SS = AnsiString(FormatDateTime(LoadStr(IDS_DATETIME_FORMAT_LOG),
				DateTime) + "; " + AnsiReplaceStr(S, sLineBreak, SPACE) +
				sLineBreak);

			if (SetFilePointer(LogFile, 0, NULL,
				FILE_END) != INVALID_SET_FILE_POINTER)
				WriteFile(LogFile, SS.c_str(), SS.Length(),
				NumberOfBytesWritten, NULL);

			CloseHandle(LogFile);
		}
	}
	catch (...) {
	}
}
Esempio n. 13
0
//---------------------------------------------------------------------------
void __fastcall TTableForm::SpeedButton2Click(TObject *Sender)
{
   Form1->m_Descr.DeleteDetectedItem(Form1->SelectedIndex);
   AnsiString str =  ChangeFileExt(Form1->m_strFileName, ".xml");
   Form1->m_Descr.SaveXML(str.c_str());
   Form1->FImage1->Init(Form1->m_strFileName, NULL);
   Form1->FImage1->BestFit();
   ListView1->DeleteSelected();
}
Esempio n. 14
0
//---------------------------------------------------------------------------
void __fastcall TTableForm::SpeedButton3Click(TObject *Sender)
{
	Form1->m_Descr.Clear();
   AnsiString str =  ChangeFileExt(Form1->m_strFileName, ".xml");
   Form1->m_Descr.SaveXML(str.c_str());
	Form1->FImage1->Init(Form1->m_strFileName, NULL);
    Form1->FImage1->BestFit();
    this->ListView1->Clear();
}
Esempio n. 15
0
//---------------------------------------------------------------------------
void __fastcall TForm1::ReadConfig ()    //读取配置
  {
    TIniFile *ini;
    ini = new TIniFile(ChangeFileExt(Application->ExeName,".INI "));
    Form1->Top = ini->ReadInteger( "Form ", "Top ", 100 );
    Form1->Left = ini->ReadInteger( "Form ", "Left ", 100 );
    AnsiString Caption =   ini->ReadString( "Form ", "Caption ", "科传接驳数据合规性检查程序" );
    Form1->Edit1->Text =  ini->ReadString( "Form ", "DefaultDir", "c:\\" );
    delete ini;
   }
Esempio n. 16
0
//---------------------------------------------------------------------------
void __fastcall TGetTrackThread::OpenDBDetecotr()
{
    if(!ShowReportEXE("TForm_DBDetecter",NULL))
    {
        TIniFile* ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI" ));        //free in next 2 line
        ini->WriteString("DBCHECK","DCH","false");
        delete ini;
    	ShellExecute(CallCenter_Main_Form, "open","DBDetector.exe", NULL, NULL, NULL);
    }
}
void __fastcall TSpreadSheetRLForm::actSaveSpeadSheetExecute(TObject *Sender)
{
  String AFileName;
  if (SaveDialog->Execute())
  {
    AFileName = ChangeFileExt(SaveDialog->FileName, ".xls");
    cxSpreadBook->SaveToFile(AFileName);
    ActiveMDIChild->Caption = ExtractFileName(AFileName);
  }
}
Esempio n. 18
0
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *ini;
    ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI " ) );
    ini->WriteInteger( "Form ", "Top ", Top );
    ini->WriteInteger( "Form ", "Left ", Left );
    ini->WriteString ( "Form ", "Caption ", Caption );
    ini->WriteString ( "Form ", "DefaultDir ", Edit1->Text );
    delete ini;        
}
Esempio n. 19
0
//---------------------------------------------------------------------------
// actor commands
//---------------------------------------------------------------------------
CCommandVar CActorTools::CommandLoad(CCommandVar p1, CCommandVar p2)
{
    xr_string temp_fn	= p1.IsString()?xr_string(p1):xr_string(""); 
    if(!p1.IsString()){
        temp_fn			= ChangeFileExt(m_LastFileName,"").c_str();
        if (!EFS.GetOpenName	( _objects_, temp_fn ))
        	return  	FALSE;
    }
    if( temp_fn.size() ){
		xr_strlwr				(temp_fn);
        if (!IfModified())		return FALSE;

        if (!FS.exist(temp_fn.c_str())){
            Msg					("#!Can't load file: %s",temp_fn.c_str());
        	return FALSE;
        }
        
        
        ExecCommand				(COMMAND_CLEAR);
        
        BOOL bReadOnly 			= !FS.can_modify_file(temp_fn.c_str());
        m_Flags.set				(flReadOnlyMode,bReadOnly);
        
        if (bReadOnly || EFS.CheckLocking(temp_fn.c_str(),false,true))
            Msg					("#!Object '%s' opened in readonly mode.",temp_fn.c_str());

/*        
        shared_str locker;
        if ((false==bReadOnly) && EFS.CheckLocking(_objects_,temp_fn.c_str(),false,true,&locker)){
            Log					("#!Object opened in readonly mode. Locked by user:"******"#!You don't have permisions to modify object:",temp_fn.c_str());
        }
*/        
        // set enable ...
		m_Props->SetReadOnly	(bReadOnly);
        fraLeftBar->SetReadOnly	(bReadOnly);
        
        CTimer T;
        T.Start();     
        if (!Load(temp_fn.c_str())){
            return FALSE;
        }
        m_LastFileName 			= temp_fn.c_str();
        ELog.Msg(mtInformation,"Object '%s' successfully loaded. Loading time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec());
        EPrefs->AppendRecentFile(m_LastFileName.c_str());
        ExecCommand	(COMMAND_UPDATE_CAPTION);
        ExecCommand	(COMMAND_UPDATE_PROPERTIES);
        // lock
        if (!bReadOnly)			EFS.LockFile(m_LastFileName.c_str());
        UndoClear();
        UndoSave();
    }
    return TRUE;
}
Esempio n. 20
0
//---------------------------------------------------------------------------
void __fastcall TFaceEditorWindow::SaveModelActionExecute(TObject *Sender)
{
  if (Form1->FImageToolkit1->CurrentTool == ftFaceTool)
  {
      TFaceModelTool* tool = (TFaceModelTool*)Form1->FImage1->Tool;
      //tool->Predict();
      UnicodeString str = ChangeFileExt(Form1->m_strFileName,".face");
      AnsiString _ansi = str;
      tool->SaveModel(_ansi.c_str());
  }
}
void __fastcall TfmAlertWindowCustomDraw::Save1Click(TObject *Sender)
{
  AnsiString RTFFilter = "Rich Text Files (*.RTF)|*.RTF";
  TSaveDialog *ASaveDialog = new TSaveDialog(this);
  ASaveDialog->Filter = RTFFilter;
  if (ASaveDialog->Execute())
  {
	ASaveDialog->FileName = ChangeFileExt(ASaveDialog->FileName, '.rtf');
	redtMessageText->Lines->SaveToFile(ASaveDialog->FileName);
  }
  delete ASaveDialog;
}
Esempio n. 22
0
void __fastcall TAssemblerBox::cmdLoadL68Click(TObject *Sender)
{
  AnsiString L68;

  //grab the active child window
  TTextStuff *Active = (TTextStuff*)Main->ActiveMDIChild;

  // get name of current L68 file
  L68 = ChangeFileExt(Active->Project.CurrentFile,".L68");

  Main->OpenFile(L68);        // open specified file
  AssemblerBox->Close();
}
Esempio n. 23
0
void ESceneGroupTool::MakeThumbnail()
{
	if (SelectionCount(true)==1)
    {
	    CGroupObject* object		= 0;
        for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
        {
        	if ((*it)->Selected())
            {
	            object				= dynamic_cast<CGroupObject*>(*it);
                break;
            }
        }
        VERIFY						(object);
        object->Select				(false);
        // save render params
        Flags32 old_flag			= psDeviceFlags;
        // set render params
        psDeviceFlags.set			(rsStatistic|rsDrawGrid,FALSE);

        U32Vec pixels;
        u32 w=512,h=512;
        if (EDevice.MakeScreenshot	(pixels,w,h))
        {
            AnsiString tex_name		= ChangeFileExt(object->Name,".thm");
            SStringVec lst;

            ObjectList 				grp_lst;
            object->GetObjects		(grp_lst);
            
            for (ObjectIt it=grp_lst.begin(); it!=grp_lst.end(); ++it)
                lst.push_back		((*it)->Name);
                
            EGroupThumbnail 		tex	(tex_name.c_str(),false);
            tex.CreateFromData		(pixels.begin(),w,h,lst);
            string_path fn;
            FS.update_path			(fn,_groups_,object->RefName());
            strcat					(fn,".group");
            tex.Save				(FS.get_file_age(fn));
        }else
        {
            ELog.DlgMsg				(mtError,"Can't make screenshot.");
        }
        object->Select				(true);
        // restore render params
        psDeviceFlags 				= old_flag;
    }else
    {
    	ELog.DlgMsg		(mtError,"Select 1 GroupObject.");
    }
}
Esempio n. 24
0
//---------------------------------------------------------------------------
void Init()
{
   IBDatabase = new TIBDatabase(Application);
   Settings = new TIniFile(ChangeFileExt( Application->ExeName, ".ini" ));


   IBDatabase->Params->Add("user_name=sysdba");
   IBDatabase->Params->Add("password=masterkey");
   IBDatabase->Params->Add("lc_ctype=WIN1251");
   IBDatabase->LoginPrompt = false;
   Connect();

   BlankDirectory = Settings->ReadString("Report","Derictory","blanks");
}
Esempio n. 25
0
void TfrmSoundLib::PlaySound(LPCSTR name, u32& size, u32& time)
{
	string_path fname;
    FS.update_path			(fname,_game_sounds_,ChangeFileExt(name,".ogg").c_str());
    FS_File F;
    if (FS.file_find(fname,F))
    {
        m_Snd.create		(name,st_Effect,sg_Undefined);
        m_Snd.play			(0,sm_2D);
        CSoundRender_Source* src= (CSoundRender_Source*)m_Snd._handle(); VERIFY(src);
        size				= F.size;
        time				= src->dwTimeTotal;
    	if (!bAutoPlay)		m_Snd.stop();
    }
}
Esempio n. 26
0
void GetAllFileNames(String path,std::list<String> &ret)
{
	TSearchRec rec;
	int attr = 0;
	int r = FindFirst(path,attr,rec);
	while(r==0)
	{
		if(rec.Name!="." && rec.Name!="..")
		{
			String name = ChangeFileExt(rec.Name,"");
			ret.push_back(name);
		}
		r = FindNext(rec);
	}
	FindClose(rec);
}
Esempio n. 27
0
//---------------------------------------------------------------------------
void __fastcall TAssemblerBox::cmdExecuteClick(TObject *Sender)
{
  AnsiString sim68K, S68;

  //grab the active child window
  TTextStuff *Active = (TTextStuff*)Main->ActiveMDIChild;

  // get name of current S-Record file
  S68 = "\"" + ChangeFileExt(Active->Project.CurrentFile,".S68") + "\"";

  //run simulator
  sim68K = ExtractFilePath(Application->ExeName) + "SIM68K.EXE";
  spawnl(P_NOWAITO, sim68K.c_str(), ParamStr(0).c_str(), S68.c_str(), NULL);

  AssemblerBox->Close();
}
Esempio n. 28
0
void TForm1::SaveIniSettings()
{
  TIniFile* ini = new TIniFile(ChangeFileExt(Application->ExeName, ".INI"));
  try {
    // view menu
    ini->WriteBool("General", "Exists", true);
    ini->WriteBool("View", "CSize", AbZipOutline1->Attributes.Contains(zaCompressedSize));
    ini->WriteBool("View", "CMethod", AbZipOutline1->Attributes.Contains(zaCompressionMethod));
    ini->WriteBool("View", "CRatio", AbZipOutline1->Attributes.Contains(zaCompressionRatio));
    ini->WriteBool("View", "CRC", AbZipOutline1->Attributes.Contains(zaCRC));
    ini->WriteBool("View", "EFA", AbZipOutline1->Attributes.Contains(zaExternalFileAttributes));
    ini->WriteBool("View", "IFA", AbZipOutline1->Attributes.Contains(zaInternalFileAttributes));
    ini->WriteBool("View", "Encryption", AbZipOutline1->Attributes.Contains(zaEncryption));
    ini->WriteBool("View", "TimeStamp", AbZipOutline1->Attributes.Contains(zaTimeStamp));
    ini->WriteBool("View", "USize", AbZipOutline1->Attributes.Contains(zaUncompressedSize));
    ini->WriteBool("View", "MadeBy", AbZipOutline1->Attributes.Contains(zaVersionMade));
    ini->WriteBool("View", "Needed", AbZipOutline1->Attributes.Contains(zaVersionNeeded));
    ini->WriteBool("View", "Comment", AbZipOutline1->Attributes.Contains(zaComment));

    ini->WriteBool("View", "Hierarchy", AbZipOutline1->Hierarchy);
//    ini->WriteInteger("View", "OutlineStyle", AbZipOutline1->OutlineStyle);
    // preferences menu
    ini->WriteString("Preferences",
      "BaseDirectory", AbZipOutline1->BaseDirectory);
    ini->WriteBool("Preferences", "Confirmations", Confirmations1->Checked);
    ini->WriteInteger("Preferences",
      "CompressionMethodToUse", AbZipOutline1->CompressionMethodToUse);
    ini->WriteInteger("Preferences",
      "DeflationOption", AbZipOutline1->DeflationOption);
    ini->WriteBool("Preferences",
      "CreateDirs", AbZipOutline1->ExtractOptions.Contains(eoCreateDirs));
    ini->WriteBool("Preferences",
      "RestorePath", AbZipOutline1->ExtractOptions.Contains(eoRestorePath));
    ini->WriteBool("Preferences",
      "StripPath", AbZipOutline1->StoreOptions.Contains(soStripPath));
    ini->WriteBool("Preferences",
      "RemoveDots", AbZipOutline1->StoreOptions.Contains(soRemoveDots));
    ini->WriteBool("Preferences",
      "Recurse", AbZipOutline1->StoreOptions.Contains(soRecurse));
  }
  catch (...) {
    delete ini;
    return;
  }
  delete ini;
}
Esempio n. 29
0
//------------------------------------------------------------------------------
ETextureThumbnail::ETextureThumbnail(LPCSTR src_name, bool bLoad):EImageThumbnail(src_name,ETTexture)
{
    if(!strchr(src_name,'\\'))
    {
      xr_string _name                     = src_name;
      ImageLib.UpdateFileName             (_name);
      m_Name                              = _name.c_str();
      m_Name 		                = ChangeFileExt(m_Name,".thm");
     }
    m_bValid                            = false;
    if (bLoad)
#ifdef XR_EPROPS_EXPORTS
    	Load();
#else
		if (!Load())
                {
                 ImageLib.CreateTextureThumbnail(this,src_name);
                 }
#endif
}
Esempio n. 30
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);
}