1 |
cycrow |
1 |
#include "settings.h"
|
|
|
2 |
#include "../common/strutils.h"
|
|
|
3 |
|
|
|
4 |
#include <stdio.h>
|
|
|
5 |
#include <windows.h>
|
|
|
6 |
|
|
|
7 |
static Settings *g_settings;
|
|
|
8 |
//---------------------------------------------------------------------------------
|
|
|
9 |
bool Settings::loadINI(const char *pszFileName)
|
|
|
10 |
{
|
|
|
11 |
char szSectionName[50];
|
|
|
12 |
|
|
|
13 |
g_settings=this;
|
|
|
14 |
clearErrors();
|
|
|
15 |
|
114 |
cycrow |
16 |
GetPrivateProfileStringA("library", "WriteWarnings", "off", szSectionName, sizeof(szSectionName), pszFileName);
|
|
|
17 |
m_bOutputWarnings = (_stricmp(szSectionName, "on")==0);
|
1 |
cycrow |
18 |
|
114 |
cycrow |
19 |
GetPrivateProfileStringA("library", "Convert", "on", szSectionName, sizeof(szSectionName), pszFileName);
|
|
|
20 |
m_bRawMode =! (_stricmp(szSectionName, "on")==0);
|
1 |
cycrow |
21 |
|
114 |
cycrow |
22 |
GetPrivateProfileStringA("library", "XtraPointInfo", "on", szSectionName, sizeof(szSectionName), pszFileName);
|
|
|
23 |
m_bXtraPntInfo = (_stricmp(szSectionName, "on")==0);
|
1 |
cycrow |
24 |
|
114 |
cycrow |
25 |
GetPrivateProfileStringA("library", "WriteX3Data", "on", szSectionName, sizeof(szSectionName), pszFileName);
|
|
|
26 |
m_bWriteX3Data = (_stricmp(szSectionName, "on")==0);
|
1 |
cycrow |
27 |
|
114 |
cycrow |
28 |
return true;
|
1 |
cycrow |
29 |
}
|
|
|
30 |
//---------------------------------------------------------------------------------
|
|
|
31 |
void Settings::error(ErrorType type, ErrorCodes code, const char *format, ...)
|
|
|
32 |
{
|
|
|
33 |
va_list ap;
|
|
|
34 |
va_start(ap, format);
|
|
|
35 |
|
|
|
36 |
ErrorMsg *e=new ErrorMsg();
|
|
|
37 |
e->type=type;
|
|
|
38 |
e->code=code;
|
|
|
39 |
|
|
|
40 |
_vsnprintf(e->message, sizeof(e->message), format, ap);
|
|
|
41 |
va_end(ap);
|
|
|
42 |
|
|
|
43 |
errors.push_back(e);
|
|
|
44 |
}
|
114 |
cycrow |
45 |
//---------------------------------------------------------------------------------
|