Exemplo n.º 1
0
void MainFrame::OnNewConfig(wxCommandEvent &event){

	if (m_configModified){
		if (QuerySaveModifications()) SaveCurrentConfig();
	}
	m_currentConfig.SetDefaults();
	NotifyConfigChanged();
}
Exemplo n.º 2
0
void MainFrame::OnOpenConfig(wxCommandEvent& event){

	if (m_configModified){
		if (QuerySaveModifications()) SaveCurrentConfig();
	}

	wxString defaultDir = _appPrefs.GetLastConfigFileDirectory();
	wxString defaultFile = "";
	wxFileDialog fileDialog(this, "Open Configuration", defaultDir, defaultFile, CONFIG_FILE_FILTER, wxFD_OPEN);

	int result = fileDialog.ShowModal();

	if (wxID_OK == result){
		const wxString fileName = fileDialog.GetPath();
		LoadConfigurationFile(fileName);
		_appPrefs.SetLastConfigFileDirectory(fileDialog.GetDirectory());
	}
}
Exemplo n.º 3
0
// recupere toute la configuration en un seul fichier
void SaveDump( void ) {
    FILE * fp, * fpout ;
    char buffer[4096], buffer2[4096] ;
    int i;

    if( IniFileFlag != SAVEMODE_REG ) {
        WriteCountUpAndPath() ;
    }

    sprintf( buffer, "%s\\%s", InitialDirectory, "kitty.dmp" ) ;
    if( ( fpout = fopen( buffer, "w" ) ) != NULL ) {

        fputs( "\n@ InitialDirectoryListing @\n\n", fpout ) ;
        SaveDumpListFile( fpout, InitialDirectory ) ;
        fflush( fpout ) ;

        fputs( "\n@ Environment variables @\n\n", fpout ) ;
        SaveDumpEnvironment( fpout ) ;
        fflush( fpout ) ;

        fputs( "\n@ KiTTYIniFile @\n\n", fpout ) ;
        if( ( fp = fopen( KittyIniFile, "r" ) ) != NULL ) {
            while( fgets( buffer, 4095, fp ) != NULL ) fputs( buffer, fpout ) ;
            fclose( fp ) ;
        }
        fputs( "\n", fpout ) ;
        fflush( fpout ) ;

        if( RegTestKey( HKEY_CURRENT_USER, TEXT("Software\\SimonTatham\\PuTTY") ) ) {
            fputs( "\n@ PuTTY RegistryBackup @\n\n", fpout ) ;
            SaveRegistryKeyEx( HKEY_CURRENT_USER, TEXT("Software\\SimonTatham\\PuTTY"), KittySavFile ) ;
            if( ( fp = fopen( KittySavFile, "r" ) ) != NULL ) {
                while( fgets( buffer, 4095, fp ) != NULL ) fputs( buffer, fpout ) ;
                fclose( fp ) ;
            }
            unlink( KittySavFile ) ;
        }
        fflush( fpout ) ;

        fputs( "\n@ KiTTY RegistryBackup @\n\n", fpout ) ;
        if( (IniFileFlag == SAVEMODE_REG)||(IniFileFlag == SAVEMODE_FILE) ) {
            SaveRegistryKey() ;
            if( ( fp = fopen( KittySavFile, "r" ) ) != NULL ) {
                while( fgets( buffer, 4095, fp ) != NULL ) fputs( buffer, fpout ) ;
                fclose( fp ) ;
            }
        }
        else if( IniFileFlag == SAVEMODE_DIR ) {
            sprintf( buffer, "%s\\Commands", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
            sprintf( buffer, "%s\\Folders", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
            sprintf( buffer, "%s\\Launcher", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
            sprintf( buffer, "%s\\Sessions", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
            sprintf( buffer, "%s\\Sessions_Commands", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
            sprintf( buffer, "%s\\SshHostKeys", ConfigDirectory ) ;
            SaveDumpListConf( fpout, buffer ) ;
        }
        fflush( fpout ) ;

        fputs( "\n@ WindowSettings @\n\n", fpout ) ;
        PrintWindowSettings( fpout ) ;

        fputs( "\n@ RunningProcess @\n\n", fpout ) ;
        PrintAllProcess( fpout ) ;
        fflush( fpout ) ;

        fputs( "\n@ CurrentEventLog @\n\n", fpout ) ;
        i=0 ;
        while( print_event_log( fpout, i ) ) {
            i++ ;
        }
        fflush( fpout ) ;

        fputs( "\n@ ClipBoardContent @\n\n", fpout ) ;
        SaveDumpClipBoard( fpout ) ;
        fflush( fpout ) ;

        if( debug_flag ) {
            fputs( "\n@ KeyPressed @\n\n", fpout ) ;
            fprintf( fpout, "%d: WM_KEYDOWN\n%d: WM_SYSKEYDOWN\n%d: WM_KEYUP\n%d: WM_SYSKEYUP\n%d: WM_CHAR\n\n", WM_KEYDOWN,WM_SYSKEYDOWN,WM_KEYUP,WM_SYSKEYUP,WM_CHAR);
            fprintf( fpout, "SHIFT CONTROL ALT ALTGR WIN\n" ) ;
            fprintf( fpout, "%s\n", SaveKeyPressed ) ;
        }
        fflush( fpout ) ;

        fputs( "\n@ RunningConfig @\n\n", fpout ) ;
        SaveDumpConfig( fpout, conf ) ;
        fflush( fpout ) ;

        fputs( "\n@ RunningConfig in KTX file format @\n\n", fpout ) ;
        SaveCurrentConfig( fpout, conf ) ;
        fputs( "\n", fpout ) ;
        fflush( fpout ) ;

        if( IniFileFlag==SAVEMODE_DIR ) {
            fputs( "\n@ RunningPortableConfig @\n\n", fpout ) ;
            SaveDumpPortableConfig( fpout ) ;
        }
        fflush( fpout ) ;

        if( DebugText!= NULL ) {
            fputs( "\n@ Debug @\n\n", fpout ) ;
            fprintf( fpout, "%s\n",  DebugText ) ;
        }

        fputs( "\n@ Shortcuts @\n\n", fpout ) ;
        SaveShortCuts( fpout ) ;
        fflush( fpout ) ;

        fputs( "\n@ SpecialMenu @\n\n", fpout ) ;
        SaveSpecialMenu( fpout ) ;
        fflush( fpout ) ;

        if( existfile("kitty.log") ) {
            fputs( "\n@ Debug log file @\n\n", fpout ) ;
            SaveDebugFile( "kitty.log", fpout ) ;
        }

#if (defined IMAGEPORT) && (!defined FDJ)
        fputs( "\n@ ScreenShot @\n\n", fpout ) ;
        SaveScreenShot( fpout ) ;
        fflush( fpout ) ;
#endif

        fclose( fpout ) ;

        sprintf( buffer, "%s\\%s", InitialDirectory, "kitty.dmp" ) ;
        sprintf( buffer2, "%s\\%s", InitialDirectory, "kitty.dmp.bcr" ) ;
        bcrypt_file_base64( buffer, buffer2, "9bis", 80 ) ;
        unlink( buffer ) ;
        rename( buffer2, buffer ) ;
    }
}
Exemplo n.º 4
0
void MainFrame::OnSaveConfig(wxCommandEvent& event){
	SaveCurrentConfig();
}