Пример #1
0
/*
 * Event Handler Functions _________________________________________________________________
 *
 */
static void OnInitDialog(HWND hwndDlg)
{
    hDlg = hwndDlg;

    g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
    g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
    g_pWiz->SetDefaultControl(IDNEXT);

    if (g_CfgData.bFirstServer) {
	ConfigMsg(IDS_MUST_CONFIG_FS);
	g_CfgData.configFS = CS_CONFIGURE;
	return;
    }

    switch (g_CfgData.configFS) {
    case CS_ALREADY_CONFIGURED:
	ConfigMsg(IDS_ALREADY_A_FS_SERVER);
	break;

    case CS_DONT_CONFIGURE:
	SetCheck(hDlg, IDC_DONT_CONFIG_FILE_SERVER);
	break;

    case CS_CONFIGURE:
    default:
	SetCheck(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER);
	break;
    }
}
Пример #2
0
/*
 * Event Handler Functions _________________________________________________________________
 *
 */
static void OnInitDialog(HWND hwndDlg)
{
    hDlg = hwndDlg;

    g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
    g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
    g_pWiz->SetDefaultControl(IDNEXT);

    if (g_CfgData.bFirstServer) {
	ConfigMsg(IDS_MUST_CONFIG_DB);
	g_CfgData.configDB = CS_CONFIGURE;
	return;
    }

    ShowPageInfo();

    switch (g_CfgData.configDB) {
    case CS_ALREADY_CONFIGURED:
	ConfigMsg(IDS_ALREADY_A_DB_SERVER);
	break;

    case CS_DONT_CONFIGURE:
	SetCheck(hDlg, IDC_DONT_CONFIG_DB_SERVER);
	EnableSCM(ES_DISABLE);
	break;

    case CS_CONFIGURE:
    default:
	SetCheck(hDlg, IDC_CONFIG_DB_SERVER);
	EnableSCM(ES_ENABLE);
	break;
    }
}
Пример #3
0
int Ctcs::Send_Config()
{
  char message[CTCS_BUFSIZE];

  if( m_protocol >= 3 ){
    int r = 0;
    const char *cfgtype, *info;
    char range[32], tmpinfo[CTCS_BUFSIZE];
    const char *value;

    if( (r=SendMessage("CTCONFIGSTART")) < 0 ) return r;

    for( ConfigGen *config = CONFIG.First();
         config;
         config = CONFIG.Next(config) ){
      if( !config->Hidden() ){
        switch( config->Type() ){
          case DT_CONFIG_INT: cfgtype = "I"; break;
          case DT_CONFIG_FLOAT: cfgtype = "F"; break;
          case DT_CONFIG_BOOL: cfgtype = "B"; break;
          default:
          case DT_CONFIG_STRING: cfgtype = "S";
        }

        if( config->Type() == DT_CONFIG_STRING )
          sprintf(range, "%d", (int)config->MaxLen());
        else if( 0 != strcmp(config->Smax(), config->Smin()) )
          sprintf(range, "%s-%s", config->Smin(), config->Smax());
        else sprintf(range, "0");

        if( config->Locked() ){
          snprintf(tmpinfo, CTCS_BUFSIZE, "%s [Locked]", config->Info());
          info = tmpinfo;
        }else info = config->Info();

        value = config->Sval();
        if( m_protocol == 3 && DT_CONFIG_BOOL == config->Type() )
          value = strchr("1TtYy", *value) ? "1" : "0";

        if( (r=SendMessage(ConfigMsg(config->Tag(), cfgtype, range, value,
                 config->Desc(), info))) < 0 ){
          return r;
        }
      }
    }

    sprintf(message, "CTCONFIGDONE");
  }
  else if( m_protocol == 2 )
    snprintf(message, CTCS_BUFSIZE, "CTCONFIG %d %lu %f %d %d %d %d %d",
      (int)*cfg_verbose, (unsigned long)*cfg_seed_hours, *cfg_seed_ratio,
      (int)*cfg_max_peers, (int)*cfg_min_peers,
      BTCONTENT.GetFilter() ? atoi(BTCONTENT.GetFilterName()) : 0,
      (int)*cfg_cache_size, WORLD.IsPaused());
  else  // m_protocol == 1
    snprintf(message, CTCS_BUFSIZE, "CTCONFIG %d %lu %f %d %d %d %d %d %d",
      (int)*cfg_verbose, (unsigned long)*cfg_seed_hours, *cfg_seed_ratio,
      (int)*cfg_max_peers, (int)*cfg_min_peers,
      BTCONTENT.GetFilter() ? atoi(BTCONTENT.GetFilterName()) : 0,
      0, WORLD.IsPaused(), 0);

  return SendMessage(message);
}