Beispiel #1
0
void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewName)
{
	SettingsList settingsList;
	DBCONTACTENUMSETTINGS dbces = {0};
	dbces.szModule = pszOldName;
	dbces.lParam = (LPARAM)&settingsList;
	dbces.pfnEnumProc = EnumSettingsProc2;

	int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces);
	if (nResult != -1)
	{
		DBVARIANT dbv;

		for(unsigned i=0; i<settingsList.size(); i++)
		{
			const char* pszSetting = settingsList[i];

			if (!GetSetting(hContact, pszOldName, pszSetting, &dbv))
			{
				switch (dbv.type)
				{
					case DBVT_BYTE:
						db_set_b(hContact, pszNewName, pszSetting, dbv.bVal);
					break;

					case DBVT_WORD:
						db_set_w(hContact, pszNewName, pszSetting, dbv.wVal);
					break;

					case DBVT_DWORD:
						db_set_dw(hContact, pszNewName, pszSetting, dbv.dVal);
					break;

					case DBVT_ASCIIZ:
						db_set_s(hContact, pszNewName, pszSetting, dbv.pszVal);
					break;

					case DBVT_UTF8:
						db_set_utf(hContact, pszNewName, pszSetting, dbv.pszVal);
					break;

					default:
						assert(0);
						break;
				}
				db_unset(hContact, pszOldName, pszSetting);
				db_free(&dbv);
			}
			free((char*)settingsList[i]);
		}
	}
}
Beispiel #2
0
void HTTPCodecPrinter::onSettings(const SettingsList& settings) {
    std::cout << "SETTINGS: num=" << settings.size() << std::endl;
    for (const auto& setting: settings) {
        std::cout << "\tid=" << folly::to<uint16_t>(setting.id)
                  << ", value=" << setting.value << std::endl;
    }
    callback_->onSettings(settings);
}
Beispiel #3
0
void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName)
{
	SettingsList settingsList;
	DBCONTACTENUMSETTINGS dbces = {0};
	dbces.szModule = pszModuleName;
	dbces.lParam = (LPARAM)&settingsList;
	dbces.pfnEnumProc = EnumSettingsProc2;

	int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces);
	if (nResult != -1)
	{
		for(unsigned i=0; i<settingsList.size(); i++)
		{
			db_unset(hContact, pszModuleName, settingsList[i]);
			free((char*)settingsList[i]);
		}
	}
}
Beispiel #4
0
void CHardLimit::LoadSettings(CPartFile* file)
{
	SettingsList daten;
	CString datafilepath;
	datafilepath.Format(_T("%s\\%s\\%s.ahl"), thePrefs.GetTempDir(),_T("Extra Lists"),file->GetPartMetFileName());

	CString strLine;
	CStdioFile f;
	if (!f.Open(datafilepath, CFile::modeReadWrite | CFile::typeText))
		return;
	while(f.ReadString(strLine))
	{
		if (strLine.GetAt(0) == '#')
			continue;
		int pos = strLine.Find(_T('\0'));
		if (pos == -1)
			continue;
		CString strData = strLine.Left(pos);
		CSettingsData* newdata = new CSettingsData(_tstol(strData));
		daten.AddTail(newdata);
	}
	f.Close();

	if(daten.GetCount() < 1){
		while (!daten.IsEmpty())
			delete daten.RemoveHead();
		return;
	}

	POSITION pos = daten.GetHeadPosition();
	if(!pos)
		return;

	file->SetMaxSourcesPerFile(((CSettingsData*)daten.GetAt(pos))->dwData);
	daten.GetNext(pos);

	while (!daten.IsEmpty())
		delete daten.RemoveHead();

}
void GameMenuManager::Render() {
	
	if (TheUtilityManager->IsMainMenu()) {
		SetRect(&Rect, 0, TheRenderManager->height - TextSize - 10, TheRenderManager->width, TheRenderManager->height + TextSize);
		SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
		FontNormal->DrawTextA(NULL, PluginVersion::VersionString, -1, &RectShadow, DT_CENTER, TextShadowColorNormal);
		FontNormal->DrawTextA(NULL, PluginVersion::VersionString, -1, &Rect, DT_CENTER, TextColorNormal);
	}
	else {
		if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyEnable)) {
			Enabled = !Enabled;
			EditingMode = false;
		}
		if (TheUtilityManager->IsMenu(0)) {
			Enabled = false;
			EditingMode = false;
		}
		if (Enabled) {
			const char* Text = NULL;
			char SettingFirst[40];
			size_t ListSize = 0;

			if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyEditing) && SelectedColumn == 3) {
				if (!EditingMode) {
					if (strstr(IntValues, SelectedSetting) || strstr(BoolValues, SelectedSetting))
						sprintf(EditingValue, "%.0f", SelectedValue);
					else
						sprintf(EditingValue, TheSettingManager->SettingsMain.Menu.ValueFormat, SelectedValue);
				}
				else
					TheSettingManager->SetMenuSetting(SelectedItem, SelectedDefinition, SelectedSection, SelectedSectionKey, SelectedSetting, atof(EditingValue));
				EditingMode = !EditingMode;
			}
			if (!EditingMode) {
				if (SelectedColumn == 0) {
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyDown)) SelectedColumn = 1;
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyLeft) && SelectedRow[SelectedColumn] > 0) SelectedRow[SelectedColumn] -= 1;
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyRight) && SelectedRow[SelectedColumn] < Rows[SelectedColumn] - 1) SelectedRow[SelectedColumn] += 1;
					SelectedPage[1] = SelectedPage[2] = SelectedPage[3] = 0;
				}
				else {
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyUp)) {
						if (SelectedRow[SelectedColumn] > 0) SelectedRow[SelectedColumn] -= 1; else SelectedColumn = 0;
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyDown) && SelectedRow[SelectedColumn] < Rows[SelectedColumn] - 1) SelectedRow[SelectedColumn] += 1;
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyLeft)) {
						if (SelectedColumn > 0) SelectedColumn -= 1;
						SelectedRow[SelectedColumn + 1] = 0;
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyRight) && SelectedColumn < 3) SelectedColumn += 1;
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyPageUp) && SelectedPage[SelectedColumn] > 0) {
						SelectedPage[SelectedColumn] -= 1;
						SelectedRow[SelectedColumn] = 0;
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyPageDown) && SelectedPage[SelectedColumn] < Pages[SelectedColumn]) {
						SelectedPage[SelectedColumn] += 1;
						SelectedRow[SelectedColumn] = 0;
					}
					if (!memcmp(SelectedItem, "Shader", 6)) {
						bool ShaderEnabled = TheSettingManager->GetMenuShaderEnabled(SelectedDefinition);
						if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyAdd) && !ShaderEnabled && SelectedColumn == 1) TheShaderManager->SwitchShaderStatus(SelectedDefinition);
						if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeySubtract) && ShaderEnabled && SelectedColumn == 1) TheShaderManager->SwitchShaderStatus(SelectedDefinition);
					}
					else if (!memcmp(SelectedItem, "Weather", 7)) {
						if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyAdd) && SelectedColumn == 1) {
							#if defined(OBLIVION) || defined(NEWVEGAS)
							for (tList<TESWeather>::Iterator Itr = WeatherListBegin; !Itr.End() && Itr.Get(); ++Itr) {
								TESWeatherEx* Weather = (TESWeatherEx*)Itr.Get();
							#elif defined(SKYRIM)
							tArray<TESWeather*>& Weathers = DataHandler::GetSingleton()->weather;
							for (UInt32 I = 0; I < Weathers.count; I++) {
								TESWeatherEx* Weather = (TESWeatherEx*)Weathers[I];
							#endif
								if (!strcmp(SelectedDefinition, Weather->EditorName)) {
									TheUtilityManager->ForceWeather(Weather);
									break;
								}
							}
						}
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeyAdd) && SelectedColumn == 3) {
						if (strstr(BoolValues, SelectedSetting))
							SelectedValue = !SelectedValue;
						else if (strstr(IntValues, SelectedSetting))
							SelectedValue += 1.0f;
						else
							SelectedValue += TheSettingManager->SettingsMain.Menu.StepValue;
						TheSettingManager->SetMenuSetting(SelectedItem, SelectedDefinition, SelectedSection, SelectedSectionKey, SelectedSetting, SelectedValue);
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeySubtract) && SelectedColumn == 3) {
						if (strstr(BoolValues, SelectedSetting))
							SelectedValue = !SelectedValue;
						else if (strstr(IntValues, SelectedSetting))
							SelectedValue -= 1.0f;
						else
							SelectedValue -= TheSettingManager->SettingsMain.Menu.StepValue;
						TheSettingManager->SetMenuSetting(SelectedItem, SelectedDefinition, SelectedSection, SelectedSectionKey, SelectedSetting, SelectedValue);
					}
					if (TheKeyboardManager->OnKeyDown(TheSettingManager->SettingsMain.Menu.KeySave)) {
						TheSettingManager->SaveSettings(SelectedItem, SelectedDefinition);
						TheUtilityManager->ShowMessage("Settings saved.");
					}
				}
			}
			else {
				if (strlen(EditingValue) < 19) {
					if (TheKeyboardManager->OnKeyDown(82))
						strcat(EditingValue, "0");
					else if (TheKeyboardManager->OnKeyDown(79))
						strcat(EditingValue, "1");
					else if (TheKeyboardManager->OnKeyDown(80))
						strcat(EditingValue, "2");
					else if (TheKeyboardManager->OnKeyDown(81))
						strcat(EditingValue, "3");
					else if (TheKeyboardManager->OnKeyDown(75))
						strcat(EditingValue, "4");
					else if (TheKeyboardManager->OnKeyDown(76))
						strcat(EditingValue, "5");
					else if (TheKeyboardManager->OnKeyDown(77))
						strcat(EditingValue, "6");
					else if (TheKeyboardManager->OnKeyDown(71))
						strcat(EditingValue, "7");
					else if (TheKeyboardManager->OnKeyDown(72))
						strcat(EditingValue, "8");
					else if (TheKeyboardManager->OnKeyDown(73))
						strcat(EditingValue, "9");
					else if (TheKeyboardManager->OnKeyDown(83))
						strcat(EditingValue, ".");
					else if (TheKeyboardManager->OnKeyDown(74))
						strcat(EditingValue, "-");
				}
				if (strlen(EditingValue) > 0 && TheKeyboardManager->OnKeyDown(14)) EditingValue[strlen(EditingValue) - 1] = NULL;
			}

			Text = TitleMenu;
			SetRect(&Rect, PositionX, PositionY, PositionX + TitleColumnSize, PositionY + TextSize);
			SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
			FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
			FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);

			SetRect(&Rect, Rect.left, Rect.bottom + RowSpace, Rect.right, Rect.bottom + RowSpace + 2);
			TheRenderManager->device->Clear(1, (D3DRECT*)&Rect, D3DCLEAR_TARGET, TextColorNormal, 0.0f, 0);

			Rows[0] = 0;
			SetRect(&Rect, Rect.left + MainItemColumnSize * 0, Rect.bottom + RowSpace, Rect.left + MainItemColumnSize * 1, Rect.bottom + RowSpace + TextSize);
			DefinitionsList Items = TheSettingManager->GetMenuItems();
			ListSize = Items.size();
			Pages[0] = ListSize / RowsPerPage;
			DefinitionsList::iterator Item = Items.begin();
			for (int i = 0; i < ListSize; i++) {
				Text = Item->second.c_str();
				SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
				if (SelectedRow[0] == Rows[0]) {
					strcpy(SelectedItem, Item->first.c_str());
					FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
					FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
				}
				else {
					FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
					FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
				}
				Rect.left += MainItemColumnSize;
				Rect.right += MainItemColumnSize;
				Rows[0]++;
				Item++;
			}

			SetRect(&Rect, PositionX, Rect.bottom + RowSpace, PositionX + TitleColumnSize, Rect.bottom + RowSpace + 2);
			TheRenderManager->device->Clear(1, (D3DRECT*)&Rect, D3DCLEAR_TARGET, TextColorNormal, 0.0f, 0);

			int MenuRectX = PositionX;
			int MenuRectY = Rect.bottom + RowSpace;
			Rows[1] = 0;
			SetRect(&Rect, MenuRectX + ItemColumnSize * 0, MenuRectY, MenuRectX + ItemColumnSize * 1, MenuRectY + TextSize);
			DefinitionsList Definitions = TheSettingManager->GetMenuDefinitions(SelectedItem);
			ListSize = Definitions.size();
			Pages[1] = ListSize / RowsPerPage;
			DefinitionsList::iterator Definition = Definitions.begin();
			for (int i = 0; i < ListSize; i++) {
				if (i >= RowsPerPage * SelectedPage[1] && i < RowsPerPage * (SelectedPage[1] + 1)) {
					Text = Definition->second.c_str();
					Rect.top += TextSize + RowSpace;
					Rect.bottom += TextSize + RowSpace;
					SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
					if (SelectedRow[1] == Rows[1]) {
						strcpy(SelectedDefinition, Definition->first.c_str());
						if (SelectedColumn >= 1) {
							FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
							FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
						}
						else {
							FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
							FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
						}
					}
					else {
						FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
						FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
					}
					if (!memcmp(SelectedItem, "Shader", 6)) {
						if (SelectedRow[1] == Rows[1] && SelectedColumn >= 1)
							FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_CALCRECT, TextColorSelected);
						else
							FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_CALCRECT, TextColorNormal);
						Rect.left = Rect.right;
						Rect.right += 100;
						SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
						if (TheSettingManager->GetMenuShaderEnabled(Definition->first.c_str())) Text = "ENABLED"; else Text = "DISABLED";
						if (SelectedRow[1] == Rows[1] && SelectedColumn >= 1) {
							FontStatus->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
							FontStatus->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
						}
						else {
							FontStatus->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
							FontStatus->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
						}
						Rect.left = MenuRectX + ItemColumnSize * 0;
						Rect.right = MenuRectX + ItemColumnSize * 1;
					}
					Rows[1]++;
				}
				Definition++;
			}
			Rows[2] = 0;
			SetRect(&Rect, MenuRectX + ItemColumnSize * 1, MenuRectY, MenuRectX + ItemColumnSize * 2, MenuRectY + TextSize);
			SectionsList Sections = TheSettingManager->GetMenuSections(SelectedItem, SelectedDefinition);
			ListSize = Sections.size();
			Pages[2] = ListSize / RowsPerPage;
			SectionsList::iterator Section = Sections.begin();
			for (int i = 0; i < ListSize; i++) {
				if (i >= RowsPerPage * SelectedPage[2] && i < RowsPerPage * (SelectedPage[2] + 1)) {
					Text = Section->second.c_str();
					Rect.top += TextSize + RowSpace;
					Rect.bottom += TextSize + RowSpace;
					SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
					if (SelectedRow[2] == Rows[2]) {
						strcpy(SelectedSection, Text);
						SelectedSectionKey = Section->first;
						if (SelectedColumn >= 2) {
							FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
							FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
						}
						else {
							FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
							FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
						}
					}
					else {
						FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
						FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
					}
					Rows[2]++;
				}
				Section++;
			}
			Rows[3] = 0;
			SetRect(&Rect, MenuRectX + ItemColumnSize * 2, MenuRectY, MenuRectX + ItemColumnSize * 3, MenuRectY + TextSize);
			SettingsList Settings = TheSettingManager->GetMenuSettings(SelectedItem, SelectedDefinition, SelectedSection, SelectedSectionKey);
			ListSize = Settings.size();
			Pages[3] = ListSize / RowsPerPage;
			SettingsList::iterator Setting = Settings.begin();
			for (int i = 0; i < ListSize; i++) {
				if (i >= RowsPerPage * SelectedPage[3] && i < RowsPerPage * (SelectedPage[3] + 1)) {
					strcpy(SettingFirst, Setting->first.c_str());
					if (strstr(IntValues, SettingFirst) || strstr(BoolValues, SettingFirst))
						sprintf(SettingValue, "%.0f", Setting->second);
					else
						sprintf(SettingValue, TheSettingManager->SettingsMain.Menu.ValueFormat, Setting->second);
					std::string T = Setting->first + " = " + SettingValue;
					Text = T.c_str();
					Rect.top += TextSize + RowSpace;
					Rect.bottom += TextSize + RowSpace;
					SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
					if (SelectedRow[3] == Rows[3]) {
						if (TheSettingManager->SettingsMain.Menu.InfoEnabled && strcmp(SelectedSetting, SettingFirst)) {
							strcpy(InfoText, "Info not found!");
							char FileName[MAX_PATH];
							strcpy(FileName, DocFile);
							std::ifstream InfoFile(FileName, std::ios::in);
							if (InfoFile.is_open()) {
								size_t P;
								std::string L;
								while (InfoFile.good()) {
									getline(InfoFile, L);
									P = L.find("<var>" + Setting->first);
									if (P != std::string::npos) {
										getline(InfoFile, L);
										if (L.length() > 256) {
											memcpy(InfoText, L.c_str(), 256);
											InfoText[255] = '\0';
										}
										else {
											strcpy(InfoText, L.c_str());
										}
										break;
									}
								}
								InfoFile.close();
							}
							else {
								strcat(FileName, " (ERROR OPENING)");
								strcpy(InfoText, FileName);
							}
						}
						strcpy(SelectedSetting, SettingFirst);
						SelectedValue = Setting->second;
						if (SelectedColumn >= 3) {
							if (EditingMode) {
								T = Setting->first + " = " + EditingValue;
								Text = T.c_str();
								FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorEditing);
								FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorEditing);
								FontNormal->DrawTextA(NULL, InfoText, -1, &RectInfoShadow, DT_CENTER | DT_WORDBREAK, TextShadowColorNormal);
								FontNormal->DrawTextA(NULL, InfoText, -1, &RectInfo, DT_CENTER | DT_WORDBREAK, TextColorNormal);
							}
							else {
								FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
								FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
								FontNormal->DrawTextA(NULL, InfoText, -1, &RectInfoShadow, DT_CENTER | DT_WORDBREAK, TextShadowColorNormal);
								FontNormal->DrawTextA(NULL, InfoText, -1, &RectInfo, DT_CENTER | DT_WORDBREAK, TextColorNormal);
							}
						}
						else {
							FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
							FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
						}
					}
					else {
						FontNormal->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorNormal);
						FontNormal->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorNormal);
					}
					Rows[3]++;
				}
				Setting++;
			}
		}
		if (TheSettingManager->SettingsMain.Main.FPSOverlay && TheFrameRateManager->FrameRate > 0) {
			char Text[4];
			time_t CurrentTime = time(NULL);

			if (difftime(CurrentTime, LastFrameRateTextTime) >= 1.0f) {
				FrameRateText = TheFrameRateManager->FrameRate;
				LastFrameRateTextTime = CurrentTime;
			}
			sprintf(Text, "%d", FrameRateText);
			SetRect(&Rect, 9, 6, 109, 6 + TextSize);
			SetRect(&RectShadow, Rect.left + 1, Rect.top + 1, Rect.right + 1, Rect.bottom + 1);
			FontSelected->DrawTextA(NULL, Text, -1, &RectShadow, DT_LEFT, TextShadowColorSelected);
			FontSelected->DrawTextA(NULL, Text, -1, &Rect, DT_LEFT, TextColorSelected);
		}
	}

}
void CSettingsSaver::ImportOldSettings(CPartFile* file)
{
	SettingsList daten;
	CString datafilepath;
	datafilepath.Format(_T("%s\\%s\\%s.sivka"), file->GetTempPath(), _T("Extra Lists"), file->GetPartMetFileName());

	CString strLine;
	CStdioFile f;
	if (!f.Open(datafilepath, CFile::modeReadWrite | CFile::typeText))
		return;
	while(f.ReadString(strLine))
	{
		if (strLine.GetAt(0) == _T('#'))
			continue;
		int pos = strLine.Find(_T('\n'));
		if (pos == -1)
			continue;
		CString strData = strLine.Left(pos);
		CSettingsData* newdata = new CSettingsData(_tstol(strData));
		daten.AddTail(newdata);
	}
	f.Close();

	POSITION pos = daten.GetHeadPosition();
	if(!pos)
		return;

	if( ((CSettingsData*)daten.GetAt(pos))->dwData == 0 || ((CSettingsData*)daten.GetAt(pos))->dwData == 1)
	{
		file->SetEnableAutoDropNNS((((CSettingsData*)daten.GetAt(pos))->dwData)!=0);
	}
	else
		file->SetEnableAutoDropNNS(thePrefs.GetEnableAutoDropNNSDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 0 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 60000)
		file->SetAutoNNS_Timer(((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetAutoNNS_Timer(thePrefs.GetAutoNNS_TimerDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 50 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 100)
		file->SetMaxRemoveNNSLimit((uint16)((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetMaxRemoveNNSLimit(thePrefs.GetMaxRemoveNNSLimitDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData == 0 || ((CSettingsData*)daten.GetAt(pos))->dwData == 1)
	{
		file->SetEnableAutoDropFQS((((CSettingsData*)daten.GetAt(pos))->dwData)!=0);
	}
	else
		file->SetEnableAutoDropFQS(thePrefs.GetEnableAutoDropFQSDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 0 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 60000)
		file->SetAutoFQS_Timer(((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetAutoFQS_Timer(thePrefs.GetAutoFQS_TimerDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 50 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 100)
		file->SetMaxRemoveFQSLimit((uint16)((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetMaxRemoveFQSLimit(thePrefs.GetMaxRemoveFQSLimitDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData == 0 || ((CSettingsData*)daten.GetAt(pos))->dwData == 1)
	{
		file->SetEnableAutoDropQRS((((CSettingsData*)daten.GetAt(pos))->dwData)!=0);
	}
	else
		file->SetEnableAutoDropQRS(thePrefs.GetEnableAutoDropQRSDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 0 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 60000)
		file->SetAutoHQRS_Timer(((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetAutoHQRS_Timer(thePrefs.GetAutoHQRS_TimerDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 1000 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 10000)
		file->SetMaxRemoveQRS((uint16)((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetMaxRemoveQRS(thePrefs.GetMaxRemoveQRSDefault());

	daten.GetNext(pos);
	if( ((CSettingsData*)daten.GetAt(pos))->dwData >= 50 && ((CSettingsData*)daten.GetAt(pos))->dwData <= 100)
		file->SetMaxRemoveQRSLimit((uint16)((CSettingsData*)daten.GetAt(pos))->dwData);
	else
		file->SetMaxRemoveQRSLimit(thePrefs.GetMaxRemoveQRSLimitDefault());

	if(daten.GetCount() > 10) // emulate StulleMule <= v2.2 files
	{
		// ==> Global Source Limit (customize for files) - Stulle
		daten.GetNext(pos);
		if( ((CSettingsData*)daten.GetAt(pos))->dwData == 0 || ((CSettingsData*)daten.GetAt(pos))->dwData == 1)
		{
			file->SetGlobalHL((((CSettingsData*)daten.GetAt(pos))->dwData)!=0);
		}
		else
			file->SetGlobalHL(thePrefs.GetGlobalHlDefault());
		// <== Global Source Limit (customize for files) - Stulle
	}
	else
		file->SetGlobalHL(thePrefs.GetGlobalHlDefault());

	while (!daten.IsEmpty()) 
		delete daten.RemoveHead();

	if (_tremove(datafilepath)) if (errno != ENOENT)
		AddLogLine(true, _T("Failed to delete %s, you will need to do this manually"), datafilepath);
}