示例#1
0
const CStringArray& CCaliMethodOn::StringNames()
{
	static CStringArray sa;
	if(sa.IsEmpty())
	{
		sa.Add(_T("峰面积"));
		sa.Add(_T("峰高"));
	}
	return sa;
}
示例#2
0
const CStringArray& CCaliMethodOn::StringIDs()
{
	static CStringArray sa;
	if(sa.IsEmpty())
	{
		sa.Add(XMLVALUE_CONSTENT_c_peak_area);
		sa.Add(XMLVALUE_CONSTENT_c_peak_height);
	}
	return sa;
}
示例#3
0
const CStringArray& CCaliMethod::StringNames()
{
	static CStringArray sa;
	if(sa.IsEmpty())
	{
		sa.Add(_T("百分比法"));
		sa.Add(_T("归一化法"));
		sa.Add(_T("内标法"));
		sa.Add(_T("外标法"));
		sa.Add(_T("内标百分比法"));
		sa.Add(_T("外标百分比法"));
	}
	return sa;
}
示例#4
0
const CStringArray& CCaliMethod::StringIDs()
{
	static CStringArray sa;
	if(sa.IsEmpty())
	{
		sa.Add(XMLVALUE_CONST_c_percentage);
		sa.Add(XMLVALUE_CONST_c_normalization);
		sa.Add(XMLVALUE_CONST_c_internal);
		sa.Add(XMLVALUE_CONST_c_external);
		sa.Add(XMLVALUE_CONST_c_internal_percentage);
		sa.Add(XMLVALUE_CONST_c_external_percentage);
	}
	return sa;
}
示例#5
0
bool CCaliData::GetSampleFullPath(CStringArray& strArry)
{
	if(!strArry.IsEmpty()) strArry.RemoveAll();

	const int itemNum = m_CaliItems.size();
	std::set<CString> sampleFullPath;
	for (int i=0; i<itemNum; i++)
	{
		sampleFullPath.insert(m_CaliItems[i].szSampleFullName);
	}
	//遍历SampleNames容器后放入deque<SamleFileInfo> m_InFileInfo
	typedef std::set<CString>::iterator SetIter;
	for (SetIter iter=sampleFullPath.begin(); iter!=sampleFullPath.end(); ++iter)
	{
		CString szPath = *iter;
		strArry.Add(szPath);
	}
	return true;
}
int CBase_AnalysisTemplate::Sample_PrepareAcquire(CBase_AnalysisSample *pcSample)
{
	if(!pcSample) {
		return IAERROR_PARAMETER_WRONGTYPE;
	}

	CBase_AnalysisInstrument *pcInstru=NULL;

	BOOL bConnected=FALSE;
	for(int i=0; i<m_cArrayInstrument2Sample.GetCount(); ++i) {
		if(m_cArrayInstrument2Sample[i].m_pcSample==pcSample) {
			bConnected = TRUE;
			pcInstru = m_cArrayInstrument2Sample[i].m_pcInstrument;
			g_TracePersistentlyWithTime(_T("Sample_Prepare: CBase_AnalysisTemplate::Sample_PrepareAcquire(connected).\r\n"));
			break;
		}
	}

	if(!bConnected) pcInstru = GetInstrument();

	if(pcInstru == NULL) return IAERROR_INSTRUMENT_NOTCONNECT;

	if(!pcInstru->Instrument_IsReady())
	{
		//ALERT(ICON_CRITICAL, _T("仪器未连接"), _T("样品准备"), NULL);
		return IAERROR_INSTRUMENT_NOTCONNECT;
	}

	bool bNeedDownload = true;
	if(m_pcWindowTask)
	{
		CAnalysisTask* pTask = m_pcWindowTask->GetTask();
		if(pTask)
		{
			const CAnalysisTaskItem* pItem = pTask->GetItem(pcSample);
			if(pItem && pItem->m_bUsingCurrentArgs) bNeedDownload = false;
		}
	}
	if(bNeedDownload)
	{
		//参数比较
		//首先取得当前仪器参数
		CString xmlString;
		if(pcInstru->Base_UploadFromDevice(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY;
		CAnalysisData ad;
		if(ad.LoadFromDocument(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY;
		//然后和样品中的参数进行比较
		CAnalysisData& adSample = pcSample->m_data;
		CStringArray notequal;
		static CString sp(_T("Sample/Parameter/"));
		if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC_PX) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1120) == 0))
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/MainFrame/Temp_ColumnBox"),
				_T("Instrument/MainFrame/Temp_FrontDetector"),
				_T("Instrument/MainFrame/Temp_RearDectetor"),
				_T("Instrument/MainFrame/Temp_FrontInjector"),
				_T("Instrument/MainFrame/Temp_RearInjector")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}
		}
		else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC2400) == 0)
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/MainFrame/Temp_ColumnBox"),
				_T("Instrument/MainFrame/Temp_FrontInjector"),
				_T("Instrument/MainFrame/Temp_RearDectetor")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}
		}
		else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100W) == 0))
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/MainFrame/Temp_ColumnBox"),
				_T("Instrument/MainFrame/Temp_Detector")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}
		}
		else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100P) == 0))
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/MainFrame/Temp_InputDetect"),
				_T("Instrument/MainFrame/Pressure"),
				_T("Instrument/MainFrame/Flow_ZQ"),
				_T("Instrument/MainFrame/Flow_WC")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}
		}
		else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_LC1620A) == 0)
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/Pump/InitFLowAPercent"),
				_T("Instrument/Pump/InitFLowBPercent"),
				_T("Instrument/Pump/InitFLow")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}

			static LPCTSTR vs2[] =
			{
				_T("Instrument/UVDetector/WaveLength")
			};
			for(int i=0; i<sizeof(vs2)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs2[i], ad, vs2[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs2[i]);
			}
		}
		else if(g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0)
		{
			static LPCTSTR vs[] =
			{
				_T("Instrument/Pump/InitFLow")
			};
			for(int i=0; i<sizeof(vs)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs[i], ad, vs[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs[i]);
			}

			static LPCTSTR vs2[] =
			{
				_T("Instrument/Detector/Temp"),
				_T("Instrument/Detector/YZQDL")/*,
											   _T("Instrument/Detector/Range")//*/
			};
			for(int i=0; i<sizeof(vs2)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs2[i], ad, vs2[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs2[i]);
			}

			static LPCTSTR vs3[] =
			{
				_T("Instrument/ColumnBox/Temp")
			};
			for(int i=0; i<sizeof(vs3)/sizeof(LPCTSTR); ++i)
			{
				if(adSample.CompareValue_Double(sp + vs3[i], ad, vs3[i]) != CAnalysisData::CR_EQUAL) notequal.Add(vs3[i]);
			}
		}
		if(!notequal.IsEmpty())
		{
			CString name, sv, cv, tr;
			// 弹出不同对话框
			CString msg(_T("<table border='1'><tr><td>名称</td><td>样品参值</td><td>当前参值</td></tr>"));
			for(int i=0; i<=notequal.GetUpperBound(); ++i)
			{
				const CString& si = notequal.GetAt(i);
				adSample.GetProperty(sp + si, XMLPROP_NAME, name);
				adSample.GetValue_String(sp + si, sv);
				if((ad.GetValue_String(si, cv) != IAERROR_SUCCESS) || cv.IsEmpty()) cv = _T("&nbsp;");
				if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0) && (si == _T("Instrument/Detector/Temp")))
				{
					if(sv == _T("0")) sv = _T("40℃");
					else if(sv == _T("1")) sv = _T("50℃");
					else if(sv == _T("2")) sv = _T("60℃");
					else sv = _T("参数错误");

					if(cv == _T("0")) cv = _T("40℃");
					else if(cv == _T("1")) cv = _T("50℃");
					else if(cv == _T("2")) cv = _T("60℃");
					else cv = _T("参数错误");
				}
				tr.Format(_T("<tr><td>%s</td><td>%s</td><td>%s</td></tr>"), name, sv, cv);
				msg += tr;
			}
			msg += _T("</table>");
			switch(HTMLMessageBox(NULL, msg, _T("当前设置参数与样品中的仪器参数不一致"), _T("采用样品中的仪器参数;采用当前设置参数;取消"), _T(";"), ICON_QUESTION))
			{
			case 0:
				// 采用样品中的仪器参数
				if(adSample.GetValue_XMLString(XMLPATH_SAMPLE_PARAM_INSTRUMENT, xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY;
				if(pcInstru->Base_DownloadToDevice(xmlString) != IAERROR_SUCCESS) return IAERROR_CG_SAMPLE_NOTREADY;
				break;
			case 1:break;
			default://取消或X
				return IAERROR_CG_SAMPLE_NOTREADY;
			}
		}
	}

	if(!bConnected)
	{
		//连接仪器
		int nret = Sample_LinkToInstrument(pcSample, pcInstru, pcSample->GetInstrumentChannel());
		RETURNifERROR(nret);
		CString t;
		t.Format(_T("Sample_Prepare: CBase_AnalysisTemplate::Sample_LinkToInstrument:%d.\r\n"), nret);
		g_TracePersistentlyWithTime(t);
	}

	//设定仪器参数
	int nRet = IAERROR_SUCCESS;

// 	CString cStrXMLParam;
// 
// 	if(IAERROR_SUCCESS!=pcSample->m_data.GetValue_XMLString(_T("Sample\\Parameter\\Instrument"), cStrXMLParam)) 
// 		return IAERROR_XML_ITEMNOTFOUND;//没有找到相应的仪器参数
// 
// 	nRet = Instrument_SetParam(pcInstru, _T("Instrument"), cStrXMLParam);

	if(nRet==IAERROR_CG_INSTRUMENT_ERROR) {
		return IAERROR_CG_INSTRUMENT_ERROR;
	}
	else if(nRet==IAERROR_SUCCESS) {
		return IAERROR_SUCCESS;
	}
	else
		return nRet;

	return IAERROR_CG_SAMPLE_NOTREADY;
}
示例#7
0
BOOL CPPgDirectories::OnApply()
{
	bool testtempdirchanged=false;
	CString testincdirchanged = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR);

	CString strIncomingDir;
	GetDlgItemText(IDC_INCFILES, strIncomingDir);
	MakeFoldername(strIncomingDir);
	if (strIncomingDir.IsEmpty()){
		strIncomingDir = thePrefs.GetDefaultDirectory(EMULE_INCOMINGDIR, true); // will create the directory here if it doesnt exists
		SetDlgItemText(IDC_INCFILES, strIncomingDir);
	}
	else if (thePrefs.IsInstallationDirectory(strIncomingDir)){
		AfxMessageBox(GetResString(IDS_WRN_INCFILE_RESERVED));
		return FALSE;
	}
	else if (strIncomingDir.CompareNoCase(testincdirchanged) != 0 && strIncomingDir.CompareNoCase(thePrefs.GetDefaultDirectory(EMULE_INCOMINGDIR, false)) != 0){
		// if the user chooses a non-default directory which already contains files, inform him that all those files
		// will be shared
		CFileFind ff;
		CString strSearchPath;
		strSearchPath.Format(_T("%s\\*"),strIncomingDir);
		bool bEnd = !ff.FindFile(strSearchPath, 0);
		bool bExistingFile = false;
		while (!bEnd)
		{
			bEnd = !ff.FindNextFile();
			if (ff.IsDirectory() || ff.IsDots() || ff.IsSystem() || ff.IsTemporary() || ff.GetLength()==0 || ff.GetLength()>MAX_EMULE_FILE_SIZE)
				continue;

			// ignore real LNK files
			TCHAR szExt[_MAX_EXT];
			_tsplitpath(ff.GetFileName(), NULL, NULL, NULL, szExt);
			if (_tcsicmp(szExt, _T(".lnk")) == 0){
				SHFILEINFO info;
				if (SHGetFileInfo(ff.GetFilePath(), 0, &info, sizeof(info), SHGFI_ATTRIBUTES) && (info.dwAttributes & SFGAO_LINK)){
					if (!thePrefs.GetResolveSharedShellLinks())
						continue;
				}
			}

			// ignore real THUMBS.DB files -- seems that lot of ppl have 'thumbs.db' files without the 'System' file attribute
			if (ff.GetFileName().CompareNoCase(_T("thumbs.db")) == 0)
				continue;

			bExistingFile = true;
			break;
		}
		if (bExistingFile
			&& AfxMessageBox(GetResString(IDS_WRN_INCFILE_EXISTS), MB_OKCANCEL | MB_ICONINFORMATION) == IDCANCEL)
		{
			return FALSE;
		}
	}
	
	// checking specified tempdir(s)
	CString strTempDir;
	GetDlgItemText(IDC_TEMPFILES, strTempDir);
	if (strTempDir.IsEmpty()){
		strTempDir = thePrefs.GetDefaultDirectory(EMULE_TEMPDIR, true); // will create the directory here if it doesnt exists
		SetDlgItemText(IDC_TEMPFILES, strTempDir);
	}

	int curPos=0;
	CStringArray temptempfolders;
	CString atmp=strTempDir.Tokenize(_T("|"), curPos);
	while (!atmp.IsEmpty())
	{
		atmp.Trim();
		if (!atmp.IsEmpty()) {
			if (CompareDirectories(strIncomingDir, atmp)==0){
					AfxMessageBox(GetResString(IDS_WRN_INCTEMP_SAME));
					return FALSE;
			}	
			if (thePrefs.IsInstallationDirectory(atmp)){
				AfxMessageBox(GetResString(IDS_WRN_TEMPFILES_RESERVED));
				return FALSE;
			}
			bool doubled=false;
			for (int i=0;i<temptempfolders.GetCount();i++)	// avoid double tempdirs
				if (temptempfolders.GetAt(i).CompareNoCase(atmp)==0) {
					doubled=true;
					break;
				}
			if (!doubled) {
				temptempfolders.Add(atmp);
				if (thePrefs.tempdir.GetCount()>=temptempfolders.GetCount()) {
					if( atmp.CompareNoCase(thePrefs.GetTempDir(temptempfolders.GetCount()-1))!=0	)
						testtempdirchanged=true;
				} else testtempdirchanged=true;

			}
		}
		atmp = strTempDir.Tokenize(_T("|"), curPos);
	}

	if (temptempfolders.IsEmpty())
		temptempfolders.Add(strTempDir = thePrefs.GetDefaultDirectory(EMULE_TEMPDIR, true));

	if (temptempfolders.GetCount()!=thePrefs.tempdir.GetCount())
		testtempdirchanged=true;

	// applying tempdirs
	if (testtempdirchanged) {
		thePrefs.tempdir.RemoveAll();
		for (int i=0;i<temptempfolders.GetCount();i++) {
			CString toadd=temptempfolders.GetAt(i);
			MakeFoldername(toadd);
			if (!PathFileExists(toadd))
				CreateDirectory(toadd,NULL);
			if (PathFileExists(toadd))
				thePrefs.tempdir.Add(toadd);
		}
	}
	if (thePrefs.tempdir.IsEmpty())
		thePrefs.tempdir.Add(thePrefs.GetDefaultDirectory(EMULE_TEMPDIR, true));

	thePrefs.m_strIncomingDir = strIncomingDir;
	MakeFoldername(thePrefs.m_strIncomingDir);
	thePrefs.GetCategory(0)->strIncomingPath = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR);

	thePrefs.shareddir_list.RemoveAll();
	m_ShareSelector.GetSharedDirectories(&thePrefs.shareddir_list);
	for (int i = 0; i < m_ctlUncPaths.GetItemCount(); i++)
		thePrefs.shareddir_list.AddTail(m_ctlUncPaths.GetItemText(i, 0));

	// check shared directories for reserved folder names
	POSITION pos = thePrefs.shareddir_list.GetHeadPosition();
	while (pos){
		POSITION posLast = pos;
		const CString& rstrDir = thePrefs.shareddir_list.GetNext(pos);
		if (!thePrefs.IsShareableDirectory(rstrDir))
			thePrefs.shareddir_list.RemoveAt(posLast);
	}

	if (testtempdirchanged)
		AfxMessageBox(GetResString(IDS_SETTINGCHANGED_RESTART));
	
	// on changing incoming dir, update incoming dirs of category of the same path
	if (testincdirchanged.CompareNoCase(thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR)) != 0) {
		CString oldpath;
		bool dontaskagain=false;
		for (int cat=1; cat<=thePrefs.GetCatCount()-1;cat++){
			oldpath=CString(thePrefs.GetCatPath(cat));
			if (oldpath.Left(testincdirchanged.GetLength()).CompareNoCase(testincdirchanged)==0) {

				if (!dontaskagain) {
					dontaskagain=true;
					if (AfxMessageBox(GetResString(IDS_UPDATECATINCOMINGDIRS),MB_YESNO)==IDNO)
						break;
				}
				thePrefs.GetCategory(cat)->strIncomingPath = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR) + oldpath.Mid(testincdirchanged.GetLength());
			}
		}
	}

	theApp.emuledlg->sharedfileswnd->Reload();
	
	SetModified(0);
	return CPropertyPage::OnApply();
}
示例#8
0
void CCallThread::DoEvaMsg(const MSG& msg)
{
	SLZEvaData* pEvaData = (SLZEvaData*)msg.wParam;

	SLZWindow Window;
	BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowByEvaId(pEvaData->GetEvaluatorId(),Window);
	if(flag)
	{
		SLZData data;
		//找出正在呼叫的那条数据
		if(m_rCalledQueData.GetCalledQueData(Window.GetWindowId(),data))
		{
			data.SetEvaluateLevel(pEvaData->GetEvaLevel());
			data.SetIsFinshEva(TRUE);
			CTime curTime = CTime::GetCurrentTime();
			data.SetFinishTime(curTime);
			if(m_rCalledQueData.DeleteCalledQueData(data))//删除正在呼叫的那条数据
			{
				m_rFinshQueData.Add(data);//加入完成队列
			}
		}
		else//不呼叫只评价
		{
			data.SetEvaluateLevel(pEvaData->GetEvaLevel());
			data.SetIsFinshEva(TRUE);
			CTime curTime = CTime::GetCurrentTime();
			data.SetFinishTime(curTime);
			data.SetWindowId(Window.GetWindowId());
			data.SetWindowShowId(Window.GetShowWndId());
			CString staffID = m_map_login[Window.GetWindowId()];
			data.SetStaffId(staffID);
			CString bussinessType;
			/*
			处理业务ID
			*/
			SLZWindow window;
			m_rInlineQueData.m_rWindowTable.QueryWindowById(data.GetWindowId(),window);
			CStringArray arrayQueID;
			window.GetArrayQueId(arrayQueID);
			if(!arrayQueID.IsEmpty())
			{
				bussinessType = arrayQueID[0];
			}
			else
			{
				CMap<int,int,CQueueInfo,CQueueInfo&>::CPair* pCurEva;
				int count = m_map_que.GetCount();
				for(int i=0;i<count;i++)
				{
					pCurEva = m_map_que.PLookup(i);
					bussinessType = pCurEva->value.GetQueID();
					break;
				}
			}
			////////////////////////////////
			data.SetBussinessType(bussinessType);
			data.SetOrganId(theApp.m_logicVariables.strOrganID);
			data.SetOrganName(theApp.m_logicVariables.strOrganNmae);
//			data.SetQueSerialID(_T("1"));
			data.SetQueueNumber(_T("0"));
			data.SetCallTime(curTime);
			data.SetTakingNumTime(curTime);
			m_rFinshQueData.Add(data);//加入完成队列
		}
	}
	if(pEvaData)//释放资源
		delete pEvaData;
}
BOOL CPPgDirectories::OnApply()
{
	bool testtempdirchanged=false;
	CString testincdirchanged=thePrefs.GetIncomingDir();

	CString strIncomingDir;
	GetDlgItemText(IDC_INCFILES, strIncomingDir);
	if (strIncomingDir.IsEmpty()){
		strIncomingDir = thePrefs.GetAppDir() + _T("incoming");
		SetDlgItemText(IDC_INCFILES, strIncomingDir);
	}
	if (thePrefs.IsInstallationDirectory(strIncomingDir)){
		AfxMessageBox(GetResString(IDS_WRN_INCFILE_RESERVED));
		return FALSE;
	}
	
	// checking specified tempdir(s)
	CString strTempDir;
	GetDlgItemText(IDC_TEMPFILES, strTempDir);
	if (strTempDir.IsEmpty()){
		strTempDir = thePrefs.GetAppDir() + _T("temp");
		SetDlgItemText(IDC_TEMPFILES, strTempDir);
	}

	int curPos=0;
	CStringArray temptempfolders;
	CString atmp=strTempDir.Tokenize(_T("|"), curPos);
	while (!atmp.IsEmpty())
	{
		atmp.Trim();
		if (!atmp.IsEmpty()) {
			if (CompareDirectories(strIncomingDir, atmp)==0){
					AfxMessageBox(GetResString(IDS_WRN_INCTEMP_SAME));
					return FALSE;
			}	
			if (thePrefs.IsInstallationDirectory(atmp)){
		AfxMessageBox(GetResString(IDS_WRN_TEMPFILES_RESERVED));
		return FALSE;
	}
			bool doubled=false;
			for (int i=0;i<temptempfolders.GetCount();i++)	// avoid double tempdirs
				if (temptempfolders.GetAt(i).CompareNoCase(atmp)==0) {
					doubled=true;
					break;
				}
			if (!doubled) {
				temptempfolders.Add(atmp);
				if (thePrefs.tempdir.GetCount()>=temptempfolders.GetCount()) {
					if( atmp.CompareNoCase(thePrefs.GetTempDir(temptempfolders.GetCount()-1))!=0	)
						testtempdirchanged=true;
				} else testtempdirchanged=true;

			}
		}
		atmp = strTempDir.Tokenize(_T("|"), curPos);
	}

	if (temptempfolders.IsEmpty())
		temptempfolders.Add(strTempDir = thePrefs.GetAppDir() + _T("temp"));

	if (temptempfolders.GetCount()!=thePrefs.tempdir.GetCount())
		testtempdirchanged=true;

	// applying tempdirs
	if (testtempdirchanged) {
		thePrefs.tempdir.RemoveAll();
		for (int i=0;i<temptempfolders.GetCount();i++) {
			CString toadd=temptempfolders.GetAt(i);
			MakeFoldername( toadd.GetBuffer(MAX_PATH) );
			if (!PathFileExists(toadd))
				CreateDirectory(toadd,NULL);
			if (PathFileExists(toadd))
				thePrefs.tempdir.Add(toadd);
		}
	}

	// incomingdir
	_sntprintf(thePrefs.incomingdir, ARRSIZE(thePrefs.incomingdir), _T("%s"), strIncomingDir);
	MakeFoldername(thePrefs.incomingdir);
	_stprintf(thePrefs.GetCategory(0)->incomingpath,_T("%s"),thePrefs.incomingdir);


	thePrefs.shareddir_list.RemoveAll();
	m_ShareSelector.GetSharedDirectories(&thePrefs.shareddir_list);
	for (int i = 0; i < m_ctlUncPaths.GetItemCount(); i++)
		thePrefs.shareddir_list.AddTail(m_ctlUncPaths.GetItemText(i, 0));

	// check shared directories for reserved folder names
	POSITION pos = thePrefs.shareddir_list.GetHeadPosition();
	while (pos){
		POSITION posLast = pos;
		const CString& rstrDir = thePrefs.shareddir_list.GetNext(pos);
		if (!thePrefs.IsShareableDirectory(rstrDir))
			thePrefs.shareddir_list.RemoveAt(posLast);
	}

	theApp.emuledlg->sharedfileswnd->Reload();

	if (testtempdirchanged)
		AfxMessageBox(GetResString(IDS_SETTINGCHANGED_RESTART));
	
	// on changing incoming dir, update incoming dirs of category of the same path
	if (testincdirchanged.CompareNoCase(thePrefs.GetIncomingDir())!=0) {
		CString oldpath;
		bool dontaskagain=false;
		for (int cat=1; cat<=thePrefs.GetCatCount()-1;cat++){
			oldpath=CString(thePrefs.GetCatPath(cat));
			if (oldpath.Left(testincdirchanged.GetLength()).CompareNoCase(testincdirchanged)==0) {

				if (!dontaskagain) {
					dontaskagain=true;
					if (AfxMessageBox(GetResString(IDS_UPDATECATINCOMINGDIRS),MB_YESNO)==IDNO)
						break;
				}
				_sntprintf(thePrefs.GetCategory(cat)->incomingpath, ARRSIZE(thePrefs.GetCategory(cat)->incomingpath), _T("%s%s"), thePrefs.GetIncomingDir(), oldpath.Mid(testincdirchanged.GetLength()));
			}
		}
	}
	
	SetModified(0);
	return CPropertyPage::OnApply();
}