Exemplo n.º 1
0
void head_doctor::save_origin()
{
	ofstream fout(file_head_o, ios_base::out | ios_base::trunc);
	if (!fout.good())
	{
		if (l_head->rus == 1)
		{
			cout << "‘айл повреждЄн" << endl;
		}
		else
			if (l_head->rus == 0)
			{
				cout << "Bad file" << endl;
			}
	}
	else
	{
		fout << GetIniString("1", "answer_head", "ini_base/menu_list_rus.ini") << name << endl;
		fout << GetIniString("2", "answer_head", "ini_base/menu_list_rus.ini") << status << endl;
		fout << GetIniString("3", "answer_head", "ini_base/menu_list_rus.ini") << age << endl;
		fout << GetIniString("4", "answer_head", "ini_base/menu_list_rus.ini") << num << endl;
		fout << endl;
		fout << GetIniString("6", "objects", "ini_base/menu_list_rus.ini") << count << endl;
	}
}
Exemplo n.º 2
0
void head_doctor::display_eng()
{
	cout << endl;
	cout << GetIniString("1", "answer_head", "ini_base/menu_list_eng.ini") << name << endl;
	cout << GetIniString("2", "answer_head", "ini_base/menu_list_eng.ini") << status << endl;
	cout << GetIniString("3", "answer_head", "ini_base/menu_list_eng.ini") << age << endl;
	cout << GetIniString("4", "answer_head", "ini_base/menu_list_eng.ini") << num << endl;
	cout << endl;
	cout << GetIniString("6", "objects", "ini_base/menu_list_eng.ini") << count << endl;
	cout << endl;
}
Exemplo n.º 3
0
int load_paths()
{
	char	filename[256];
	int		ret = 0;

	if ( get_config_file( filename ) )
	{
		GetIniString( "PathNames", "roompath", ROOMPATH, ROOMPATH, 255, filename);
		GetIniString( "PathNames", "monpath", MONPATH, MONPATH, 255, filename);
		GetIniString( "PathNames", "objpath", OBJPATH, OBJPATH, 255, filename);
		GetIniString( "PathNames", "playerpath", PLAYERPATH, PLAYERPATH, 255, filename);
		GetIniString( "PathNames", "docpath", DOCPATH, DOCPATH, 255, filename);
		GetIniString( "PathNames", "postpath", POSTPATH, POSTPATH, 255, filename);
		GetIniString( "PathNames", "binpath", BINPATH, BINPATH, 255, filename);
		GetIniString( "PathNames", "logpath", LOGPATH, LOGPATH, 255, filename);

		/* make sure we only do this once */
		loaded_paths_yet = TRUE;
	}
	else
		ret = -1;


	return(ret);
}
Exemplo n.º 4
0
/********************************************** 
Name : GetIniDouble 
Input : 
char *pSection : Session Name 
char *pIdent: Identity Name 
double: Default Value if an error exists. 
Output : 
Double converted, if applicable 
Default value, if an error exists 

Process: Normal 
***********************************************/ 
double TIni::GetIniDouble(const char* pSection, const char* pIdent, const double iDefVal) 
{ 
char szTempBuffer[MAX_VALUE_BUFFER_SIZE]; 
if ( GetIniString(pSection, pIdent, szTempBuffer) == 0 ) { 
return atof(szTempBuffer); 
} else return iDefVal; 
} 
Exemplo n.º 5
0
VoidT ReadStylesFromIniSect(StringT ininame, IntT sectnum)
{
	DesStyleT *curr = NULL;
	StringT section = StyleSections[sectnum];
	StringT sname = NULL;
	StringT props = NULL;
	StringT aname = NULL;


	/* scan DesStyles list for match, or add to end, and set props */
	GetIniSect(ininame, section);
	while ((sname = GetIniSectKey()) != NULL) {
		curr = FindStyleInDesStyles(sname);
		if (!curr) {
			curr = LastDesStyle;
			curr->next = CreateDesignerStyle(F_StrCopyString(sname));
			curr = (DesStyleT *) curr->next;
			curr->para = True;  /* we presume */
			curr->next = NULL;
			LastDesStyle = curr;
			DesStyleCount++;
		}
		aname = Fm2a(sname);
		GetIniString(ininame, section, aname, &props);
		F_Free(aname);
		GetIniStyleProps(ininame, sectnum, props, curr);
	}
}
Exemplo n.º 6
0
//从Config.ini文件中获取反查服务器和正则表达式
bool GetConfig(LOOKUPCONFIG& stuLookUpConfig, int iNum)
{
	TCHAR tszNumServer[16] = {0};

	_stprintf(tszNumServer, _T("SERVER%d"), iNum);
	if (!GetIniString(stuLookUpConfig.szUrl, tszNumServer, _T("Url")))
	{
		return false;
	}

	if (!GetIniString(stuLookUpConfig.szRegex, tszNumServer, _T("Regex")))
	{
		return false;
	}

	return true;
}
Exemplo n.º 7
0
bool GetIpLookIP(TCHAR* ptszIP)
{

	if (!GetIniString(ptszIP, _T("ADDR"), _T("IP")))
	{
		return false;
	}

	return true;
}
Exemplo n.º 8
0
/********************************************** 
Name : GetIniLong 
Input : 
char *pSection : Session Name 
char *pIdent: Identity Name 
long: Default Value if an error exists. 
Output : 
Long converted, if applicable 
Default value, if an error exists 

Process: Normal 
***********************************************/ 
long TIni::GetIniLong(const char* pSection, const char* pIdent, const long iDefVal) 
{ 
char szTempBuffer[MAX_VALUE_BUFFER_SIZE]; 
if ( GetIniString(pSection, pIdent, szTempBuffer) == 0 ) { 
if (strlen(szTempBuffer)>2) { 
if ( (szTempBuffer[0]=='0') && 
( (szTempBuffer[1]=='x') || (szTempBuffer[1]=='X')) 
) return (strtol(szTempBuffer, (char **)NULL, 16)); 
} 
return atol(szTempBuffer); 
} else return iDefVal; 
} 
Exemplo n.º 9
0
VoidT GetIniStyleProps(StringT ininame, IntT sectnum, StringT props, DesStyleT *curr)
{
	DesStyleT *right;
	StringT pPr = NULL;
	StringT term = NULL;
	StringT pval = NULL;
	BoolT first = True;
	IntT i = 0;

	StringT aname = NULL;

	if (props == NULL)
		return;

	aname = Fm2a(curr->name);

	switch (sectnum) {
		case 0:  /* Styles */
			curr->remap = True;
			curr->rem_name = props;
			// add rem_name to list
			right = FindStyleInDesStyles(curr->rem_name);
			if (!right) {
				right = LastDesStyle;
				right->next = CreateDesignerStyle(F_StrCopyString(curr->rem_name));
				right = (DesStyleT *) right->next;
				right->next = NULL;
				LastDesStyle = right;
				DesStyleCount++;
			}
			// else error, should be new name
			right->para = curr->para;  /* we hope */
			break;

		case 1: /* StyleReplacements */
			curr->replace = True;
			curr->rep_name = props; 
			break;
	
		case 2: /* HelpStyles */
			pPr = props;
			term = props;
			first = True;
			curr->helptyp = 0;
			curr->ungreen = True;
			curr->nouline = True;
			while (*pPr) {
				while (*term
						&& (*term != ' '))
					term++;
				if (*term)
					*term++ = '\0';
				if (first) {
					for (i = 0; i < STY_START_COUNT; i++)
						if (!F_StrICmp(pPr, HelpStyleStart[i]))
							break;
					switch (i) {
						case 0:
							curr->helptyp = 1;
							curr->topictyp = 0;
							break;
						case 1:
							curr->helptyp = 1;
							curr->topictyp = 2;
							break;
						case 2:
							curr->helptyp = 2;
							curr->hotsptyp = 0;
							GetIniString(ininame, HelpStyleSects[5], aname,
													 &(curr->fixed_name));
							if (curr->fixed_name)
								curr->fixed = True;
							break;
						case 3:
							curr->helptyp = 2;
							curr->hotsptyp = 1;
							GetIniString(ininame, HelpStyleSects[5], aname,
													 &(curr->fixed_name));
							if (curr->fixed_name)
								curr->fixed = True;
							break;
						case 4:
							curr->helptyp = 2;
							curr->hotsptyp = 3;
							break;
						case 5:
							curr->helptyp = 3;
							break;
						case 6:
							curr->helptyp = 3;
							curr->pop_cont = True;
							break;
						case 7:
							curr->helptyp = 4;
							GetIniString(ininame, HelpStyleSects[2], aname,
													 &(curr->mac_name));
							break;
						case 8:
							curr->usekey = True;
							break;
						case 9:
							curr->akey = True;
							break;
						case 10:
							GetIniString(ininame, HelpStyleSects[9], aname,
													 &(curr->keys));
							break;
						case 11:
							curr->helptyp = 2;
							curr->hotsptyp = 2;
							curr->window = True;
							GetIniString(ininame, HelpStyleSects[1], aname,
													 &(curr->win_name));
							break;
						default:
							break;
					}
					first = False;
				}
				else {
					for (i = 0; i < STY_HKEY_COUNT; i++)
						if (!F_StrICmp(pPr, HelpStyleKeys[i]))
							break;
					if (i < STY_HSECT_COUNT)
						GetIniString(ininame, HelpStyleSects[i], aname, &pval);
					switch (i) {
						case 0:
							curr->browse = True;
							curr->br_px = pval;
							break;
						case 1:
							curr->window = True;
							curr->win_name = pval;
							break;
						case 2:
							curr->mac_name = pval;
							break;
						case 3:
							curr->build = True;
							curr->build_tag = pval;
							break;
						case 4:
							if (!pval)
								break;
							curr->cont = True;
							switch (*pval) {
								case 'V':
									curr->conttyp = 0;
									break;
								case 'H':
									curr->conttyp = 1;
									break;
								case 'T':
									curr->conttyp = 2;
									break;
								case 'B':
									curr->conttyp = 3;
									break;
								default:
									break;
							}
							curr->contlev = F_StrCopyString(pval + 1);
							F_StrFree(pval);
							break;
						case 5: // Refer (Topic only)
							curr->refer = True;
							break;
						case 6: // Suffix
							curr->refer = True;
							curr->ref_sx = pval;
							break;
						case 7:
							curr->titsx = True;
							curr->title_sx = pval;
							break;
						case 8:
							curr->fileref = True;
							curr->file_name = pval;
							break;
						case 9:
							curr->keys = pval;
							break;
						case 10:
							curr->usekey = True;
							break;
						case 11:
							curr->akey = True;
							break;
						case 12:
							curr->notitle = True;
							break;
						case 13:
							curr->topictyp = 1;
							break;
						case 14:
							curr->noscr_used = True;
							curr->noscroll = False;
							break;
						case 15:
							curr->noscr_used = True;
							curr->noscroll = True;
							break;
						case 16:
							curr->xtscr_used = True;
							curr->xtscroll = True;
							break;
						case 17:
							curr->xtscr_used = True;
							curr->xtscroll = False;
							break;
						case 18:
							curr->local = True;
							break;
						case 19:
							curr->ungreen = False;
							break;
						case 20:
							curr->nouline = False;
							break;
						default:
							break;
					}
				}
				pPr = term;
			}

			F_StrFree(props);
			break;

		default:
			F_StrFree(props);
			break;
	}

	F_Free(aname);
}