Exemplo n.º 1
0
/*---------------------------------------------------------------------------
**        Name : Release
**      Author : Barry Tang
**        Date : 2010/1/15
** Description : Delete file from disk
**       Input : fileDel, the CUnicodeFile object
**      Output : None
**---------------------------------------------------------------------------*/
BOOL CUnicodeFile::Delete(CUnicodeFile& fileDel)
{
	CString strName = fileDel.GetFileName();
	if (strName.IsEmpty())
	{
		AfxMessageBox(_T("The file is release..."));
		return FALSE;
	}

	int num = strName.GetLength();
	char* operate = new char[num + 5];
	operate[0] = 'D';
	operate[1] = 'e';
	operate[2] = 'l';
	operate[3] = ' ';

	int i;
	for (i = 0; i < num; i++)
	{
		operate[4 + i] = (char)LOWORD(strName.GetAt(i));
	}

	operate[4 + i] = '\0';

	fileDel.Release();

	system(operate);

	delete[] operate;

	return TRUE;
}
Exemplo n.º 2
0
// Number can be: nnnnn[.nnnnnn][[+|-]{E|e}nnn]
CString
XMLRestriction::CheckDouble(CString p_value,bool p_specials)
{
  CString result;
  p_value.TrimLeft('-');
  p_value.TrimLeft('+');

  if(p_specials)
  {
    if(p_value == "INF" || p_value == "NaN")
    {
      return result;
    }
  }
  for(int ind = 0; ind < p_value.GetLength(); ++ind)
  {
    unsigned char ch = p_value.GetAt(ind);
    if(!isspace(ch) && !isdigit(ch) && ch != '.' && ch != '+' && ch != '-' && toupper(ch) != 'E')
    {
      result  = "Not a number: ";
      result += p_value;
      return result;
    }
  }
  return CheckRangeFloat(p_value);
}
Exemplo n.º 3
0
BOOL PhoneInfoMng::Load()
{
	m_ObArr.RemoveAll();
	m_Cnt = 0;

	TCHAR strModuleFileName[256];
	CString strPath;
	memset((void *)strModuleFileName,0,256);


	GetModuleFileName(NULL,strModuleFileName,256);
	strPath = strModuleFileName;
	UINT iPos=-1;

 	for(int i=strPath.GetLength()-1;i>=0;i--)
 	{
		TCHAR ch = strPath.GetAt(i);
		if(ch==L'\\')
 		{
 			iPos = i;
 			break;
 		}
	}
	CString strFullPath = strPath.Left(iPos+1) + _T("Tel\\Tel");


 	CFile DialBookFile;
 	if( !DialBookFile.Open(strFullPath,  CFile::modeReadWrite ) )
		return FALSE;

	if( DialBookFile.GetLength() == 0 )
		return FALSE;
 
	TCHAR* bookBuf = new TCHAR[4096];
	CArchive ar(&DialBookFile,CArchive::load,4096,bookBuf);

	ar >> m_Cnt;	
 	if( m_Cnt == 0 )
		return FALSE;

	CPhoneInfo* temppDialLog;
	m_PhoneInfo = new CPhoneInfo[m_Cnt];
	temppDialLog = m_PhoneInfo;
	
	for( UINT j = 0; j<m_Cnt; j++ )
	{
		temppDialLog->Serialize(ar);
		m_ObArr.Add(temppDialLog);
		temppDialLog++;
	}

	ar.Flush();
	ar.Close();
	DialBookFile.Close();


	delete[] bookBuf;
	
	return TRUE;
}
Exemplo n.º 4
0
// This takes a string and uses it to set the expanded or
// collapsed state of the tree items.
int CStatisticsTree::ApplyExpandedMask(CString theMask, HTREEITEM theItem, int theStringIndex)
{
	HTREEITEM	hCurrent;

	if (theItem == NULL) {
		hCurrent = GetRootItem();
		SetRedraw(false);
		ExpandAll(true);
		m_bExpandingAll = true;
	}
	else
		hCurrent = theItem;

	while (hCurrent != NULL && theStringIndex < theMask.GetLength())
	{
		if (ItemHasChildren(hCurrent) && IsBold(hCurrent)) {
			if (theMask.GetAt(theStringIndex) == '0') Expand(hCurrent, TVE_COLLAPSE);
			theStringIndex++;
			theStringIndex = ApplyExpandedMask(theMask, GetChildItem(hCurrent), theStringIndex);			
		}
		hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
	}
	if (theItem == NULL) {
		SetRedraw(true);
		m_bExpandingAll = true;
	}
	return theStringIndex;
}
Exemplo n.º 5
0
CString
XMLRestriction::CheckFractionDigits(CString p_value)
{
  CString error;
  int pos = p_value.Find('.');
  if(pos >= 0)
  {
    // Take fractin part
    p_value = p_value.Mid(pos + 1);
   
    int count = 0;
    for(int ind = 0; ind < p_value.GetLength(); ++ind)
    {
      if(isdigit(p_value.GetAt(pos)))
      {
        ++count;
      }
      else
      {
        // Stop counting at the 'E' or 'e' sign of the exponent
        break;
      }
    }
    if(count > m_fractionDigits)
    {
      error.Format("Number precision overflow fractionDigits %d/%d",count,m_fractionDigits);
    }
  }
  return error;
}
Exemplo n.º 6
0
//转CString为DWORD,GetIndex(CString szIP)函数中用到
DWORD SEU_QQwry::IPtoDWORD(CString szIP)
{
	DWORD iIP;
	BYTE b[4];
	CString szTemp;
	char ch;
	int iLen;
	int iXB;
	szIP+=".";
	memset(b,0,4);
	iLen=szIP.GetLength();
	iXB=0;
	iIP=0;
	for(int i=0;i<iLen;i++)
	{
		ch=szIP.GetAt(i);
		szTemp+=ch;
		if(ch=='.')
		{
			b[iXB]=atoi(szTemp);
			szTemp="";
			iXB++;
		}
	}
	iIP=b[0]*256*256*256+b[1]*256*256+b[2]*256+b[3];
	return iIP;
}
Exemplo n.º 7
0
BOOL CVolume::ValidateLabel(const CString& strLabel)
{
	CString strTemp = strLabel;
	strTemp.Trim();

	// Check length.
	if (strTemp.IsEmpty() || strTemp.GetLength() >3) return FALSE;

	// Check label.
	strTemp.MakeUpper();
	TCHAR chLabel = strTemp.GetAt(0);
	if (chLabel < _T('A') || chLabel > _T('Z')) return FALSE;

	// Check whole string.
	switch (strTemp.GetLength())
	{
	case 1:
		return TRUE;
	case 2:
		{
			CString strCompare;
			strCompare.Format(_T("%c:"),chLabel);
			return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
		}
	case 3:
		{
			CString strCompare;
			strCompare.Format(_T("%c:\\"),chLabel);
			return strTemp.CompareNoCase(strCompare) ? FALSE : TRUE;
		}
	default: 
		return FALSE;
	}
}
Exemplo n.º 8
0
BOOL CVolumeCollection::IsVolumeExist(const CString& strLabel)
{
	if (!CVolume::ValidateLabel(strLabel)) return FALSE;

	CVolume::ValidateLabel(strLabel);
	return m_dwVolumes & (0x1 << (strLabel.GetAt(0) - _T('A'))) ? TRUE : FALSE;
}
Exemplo n.º 9
0
void CExtIdDetail::check_date_input( CEdit &EditDate ) 
{
	CString DateString;
	EditDate.GetWindowText(DateString);

   int iIsSlash;
   int iIsNum;

   int status = ABP_FAILURE;
   int size = 0;

   TCHAR CurrentChar;

   if( !DateString.IsEmpty() )
   {
      CurrentChar = DateString.GetAt((size = DateString.GetLength() - 1));	   
      if( (iIsNum = isdigit( (int)CurrentChar)) || 
		  !(iIsSlash = strncmp( (LPCTSTR)&CurrentChar, (LPCTSTR)"/", 1)) )
      {
         if( ((iIsNum >= 0) && (iIsNum <= 9)) || (!iIsSlash ) ) status = ABP_SUCCESS;
      }

      if( status == ABP_FAILURE )
      {
	     Beep( 400, 75 );
	     DateString.GetBufferSetLength( size );
      }
   }
   return;
}
void T3000_Default_MainView::OnEnKillfocusEditAesEncrypt()
{
	CString str;
	m_Edit_AESPassword.GetWindowTextW(str);
	if (str.GetLength()<=0)
	{
		return;
	}
	unsigned char AESPwd[16];
	memset(AESPwd, 0, 16);
	for (int i = 0;i<str.GetLength();i++)
	{
		AESPwd[i] = str.GetAt(i);
	}
	int ret = Write_Multi_org(g_tstat_id, AESPwd, 600, 16, 5);
	Read_Multi(g_tstat_id, &product_register_value[599], 599, 100);
	if (product_register_value[599] == 0)
	{
		m_Edit_AESPassword.EnableWindow(FALSE);
		GetDlgItem(IDC_CHECK_PASSWORD)->EnableWindow(FALSE);
	}
	else
	{
		m_Edit_AESPassword.EnableWindow(TRUE);
		m_Edit_AESPassword.SetWindowTextW(GetTextFromReg(600) + GetTextFromReg(604));
		//m_Edit_AESPassword.SetPasswordChar('*');
		((CButton *)GetDlgItem(IDC_CHECK_PASSWORD))->SetCheck(1);
	}
}
Exemplo n.º 11
0
//===========================================================================
int CFAVReaderDlg::CStringHexToInt(CString str)
//===========================================================================
{
	int nRet = 0;
	int count = 1;
	for(int i = str.GetLength()-1; i >= 0; --i)
	{
		int nNum = 0;
		char chText;
		chText = str.GetAt(i);
		if (chText >= '0' && chText <= '9')
		{
			nNum = chText - '0';
		}
		else if (chText >= 'A' && chText <= 'F')
		{
			nNum = chText - 'A' + 10;
		}
		else if (chText >= 'a' && chText <= 'f')
		{
			nNum = chText - 'a' + 10;
		}
		nRet += nNum*count;
		count *= 16;

	}
	return nRet;
}
Exemplo n.º 12
0
void FromAToB(){
	DWORD dwRead, dwWrite;
	char* pReadBuf;
	CString cStrData;
	char* pSendData;
	while (1){
		pReadBuf = new char[101];
		//从匿名通道读入
		if (!ReadFile(hPipeRead, pReadBuf, 101, &dwRead, NULL)){
			printf("read failed\n");
		}
		cStrData.Empty();
		cStrData = pReadBuf;
		while (!cStrData.IsEmpty()){
			pSendData = new char[cStrData.GetLength() + 1];
			memset(pSendData, 0, cStrData.GetLength() + 1);
			for (int i = 0; i < cStrData.GetLength() + 1; i++){
				pSendData[i] = (char)cStrData.GetAt(i);
			}
			//将从A中读入的数据通过匿名通道写入B
			if (!WriteFile(hPipeWrite, pReadBuf, strlen(pReadBuf), &dwWrite, NULL)){
				printf("write failed\n");
			}
		}
	}
	
}
Exemplo n.º 13
0
bool CStringExt::GetAppPath(CString &path)//不包括最后的'\\'
{
	CString sPath;
	GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
	sPath.ReleaseBuffer();
	int i=sPath.GetLength()-1;
	while(i>0)
	{
		if(sPath.GetAt(i)=='/' || sPath.GetAt(i)=='\\') break;
		i--;
	}
	if(i<0) return false;
	if(i==0) path="./";
	else path=sPath.Left(i);
	return true;
}
//when function encounters symbol '|'
//that means either character can be, it 
//calls this function to get these characters
BOOL COXRegExpression::GetEither(CString& sString,int* pnNumber,LPTSTR pchEither)
{
	TCHAR ch;


	if (sString.GetLength()<=(*pnNumber))
	{	
		SetError(OX_REGEXP_ERROR_UNEXPECTED_END_EITHER);
		return FALSE;
	}

	ch=sString.GetAt(*pnNumber);
	(*pnNumber)++;
	switch (ch)
	{
	case TEXT('\\'):
		{
			int nRet=GetSpecialChar(sString, pnNumber, &ch);
			if (nRet==OX_REGEXP_TAG_COMMON_CHAR)
			{
				*pchEither=ch;
				return TRUE;
			}
			else
			{
				if (nRet)
					SetError(OX_REGEXP_ERROR_UNEXPECTED_SPECCHAR);
				return FALSE;
			}
		}
		break;
	case TEXT('*'):
	case TEXT('+'):
	case TEXT('?'):
	case TEXT('.'):
	case TEXT('('):
	case TEXT(')'):
	case TEXT('|'):
	case TEXT('{'):
	case TEXT('}'):
	case TEXT('['):
	case TEXT(']'):
		{
			SetError(OX_REGEXP_ERROR_UNEXPECTED_SPECCHAR);
			return FALSE;
		}
	case TEXT('/'):
			if (GetAsciiChar(sString,pnNumber,&ch))
			{
				*pchEither=ch;
				return TRUE;
			}
			else
				return FALSE;
		break;
	default:
		*pchEither=ch;
		return TRUE;
	}
}
Exemplo n.º 15
0
bool HashSCKey (char *key , CString strkey)
{
	strcpy (key,"qwertyuiopasdfghjk");
	for (int i=0;i<strkey.GetLength();i++)
		key[i] = key[i] ^ strkey.GetAt(i);
	return true;
}
Exemplo n.º 16
0
CString KFunction::GetProductRootPath(void)
{
	CKANRegisterKey reg;
	int nRetCode = 0;
	static CString s_strRootPath;
	TCHAR szTempBuf[MAX_PATH] = {0};

	LPCTSTR szRegAntivirus = _T("SOFTWARE\\Kingsoft\\Antivirus");
	LPCTSTR szKeyPath = _T("ProgramPath");

	if (!s_strRootPath.IsEmpty()) goto Exit0;

	nRetCode = reg.Open(HKEY_LOCAL_MACHINE, szRegAntivirus);
	if (!nRetCode) goto Exit0;

	nRetCode = reg.Read(szKeyPath, szTempBuf, MAX_PATH);
	if (!nRetCode) goto Exit0;

	s_strRootPath = szTempBuf;
	TCHAR ch = s_strRootPath.GetAt(s_strRootPath.GetLength() - 1);
	if (ch != _T('\\') && ch != _T('/'))
	{
		s_strRootPath += _T("\\");
	}
	s_strRootPath.MakeLower();

Exit0:
	return s_strRootPath;
}
/*
 =======================================================================================================================
 =======================================================================================================================
 */
void AddSlash(CString &strPath) {
	if (strPath.GetLength() > 0) {
		if (strPath.GetAt(strPath.GetLength() - 1) != '\\') {
			strPath += '\\';
		}
	}
}
Exemplo n.º 18
0
/**
 * Function name    IsIdentifier
 * Description      checks whether String is an st identifier
 * @param           CString String
 * @return          BOOL
 * @exception       -
 * @see             -
*/
BOOL IsIdentifier(CString String)
{
    if (String.IsEmpty())                       // 1
    {
        return FALSE;
    }

	if (IsKeyword(String))
	{
		return FALSE;
	}

    if (String.Find(_T("__")) != -1)            // 2
    {
        // "__" is not allowed within an identifier. 
        return FALSE;
    }

    int StringLength = String.GetLength();

	ASSERT(StringLength > 0);                   // owing to 1

    const int StartIndex = 0;
    _TCHAR c = String.GetAt(StartIndex);
    
    if (!_istalpha(c) &&
        !((c == _T('_')) && (StringLength > 1)))
    {
        // First char is not a-z or A-Z and
        // first char is not    '_'-and-followed-by-an-other-char.
        // ('_' is no valid identifier.
        // String.GetAt(StartIndex + 1) does not equal '_' due to 2.)
        return FALSE;                           
    }

    for (int i = StartIndex + 1; i < StringLength; i++)
    {
        c = String.GetAt(i);
        if ((!_istalnum(c)) && (c != _T('_')))
        {
            // String contains a char which is not a-z, A-Z, 0-9, or '_',                               
            return FALSE;                       
        }
    }

	return TRUE;
}
Exemplo n.º 19
0
CString CSecretDrv2::SecretSerialID(CString strSerial,bool& bSuccess)
{
	bSuccess = true;
	ASSERT(strSerial.GetLength ()==8);
	BYTE bIn[8];
	BYTE bOut[8];
	for(int i =0;i<8;i++)
	{
		char ch = strSerial[i];
		if(ch>'9'||ch<'0')
			bSuccess=false;
	}



	for(int i=0;i<4;i++)
	{
		char ch[5];
		ch[0]=strSerial.GetAt (i*2);
		ch[1]=strSerial.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[2*i]=(BYTE)n;
	}
	bIn[1]=bIn[6]+0x66;
	bIn[3]=bIn[4]+0x55;
	bIn[5]=bIn[6]+0x33;
	bIn[7]=bIn[0]+0x66;

	secret (bOut,bIn);


	CString sOut="";
	for(int i=0;i<8;i++)
	{
		int n = (int)bOut[i];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		sOut+=s;
	}
	return sOut;
}
Exemplo n.º 20
0
CString CSecretDrv2::DesecretSerialID(CString strSerialSecreted,bool& bSuccess)
{
	bSuccess = true;
	ASSERT(strSerialSecreted.GetLength ()==16);
	BYTE bIn[8];
	BYTE bOut[8];


	for(int i=0;i<8;i++)
	{
		char ch[5];
		ch[0]=strSerialSecreted.GetAt (i*2);
		ch[1]=strSerialSecreted.GetAt (i*2+1);
		int n = From16ToInt(ch);
		bIn[i]=(BYTE)n;
	}

	desecret (bOut,bIn);

	if(bOut[1]-0x66!=bOut[6])
		bSuccess=false;
	if(bOut[3]-0x55!=bOut[4])
		bSuccess=false;
	if(bOut[5]-0x33!=bOut[6])
		bSuccess=false;
	if(bOut[7]-0x66!=bOut[0])
		bSuccess=false;


	CString sOut="";
	for(int i=0;i<4;i++)
	{
		int n = (int)bOut[i*2];
		CString s;
		s.Format ("%2x",n);
		if(s[0]==' ')
			s.SetAt (0,'0');
		if(s[1]==' ')
			s.SetAt (1,'0');

		sOut+=s;
	}
	ASSERT(sOut.GetLength ()==8);
	return sOut;

}
Exemplo n.º 21
0
CString mul(CString a,CString b)
{
	
	CString c[20001],d;
	long i,k;
	char v;

	i=j=k=carry=x=y=0;
  
	x=a.GetLength();
	y=b.GetLength();
	
	if(y<x)
		swapValue(a,b);

	x=a.GetLength();
	y=b.GetLength();
	i=y-1;

	for(;i>=0;)
	{
		
   		carry=0;
		v=b.GetAt(i);
		
		for(j=x;j>0;j--)
		{
			k = (a.GetAt(j-1)-'0')*(v-'0')+carry;
			carry = k /10;
			k = k % 10;
			c[i]+=(k+'0');
   		}
		if(carry>0)
			c[i]+=carry+'0';

		c[i].MakeReverse();

		insert(c[i],b.GetLength()-(i+1),"0",0);

		d=add(d,c[i]);

		c[i].Empty();
	   	i--;
	}
	return d;
}
Exemplo n.º 22
0
// 문자열 설정
void CText::setString(CString& string) {

	m_String.RemoveAll();

	for (int i = 0; i < string.GetLength(); i++) {
		m_String.Add(string.GetAt(i));
	}
}
Exemplo n.º 23
0
void SanitizeFilename(CString &str)
//---------------------------------
{
	for(int i = 0; i < str.GetLength(); i++)
	{
		str.SetAt(i, SanitizeFilenameChar(str.GetAt(i)));
	}
}
Exemplo n.º 24
0
CString CSimpleSAH::GetAttribute(LPCSTR lpAttriName)
{
	CString tmp;
	CString tag(strCurTagBuf);
	tag.MakeLower();
	CString attri(lpAttriName);
	attri.MakeLower();

	try{

	CString s;
	int i=0, j=0;
	BOOL found = FALSE;
	while(!found)
	{
		i = tag.Find(attri, i);
		if(i<0)
			break;

		j = tag.Find('=', i);
		s = tag.Mid(i+attri.GetLength(), j-i-attri.GetLength());
		s.TrimLeft();
		if(s.IsEmpty())
		{
			found=TRUE;
			tmp = strCurTagBuf.Mid(j+1);
			if(tmp.GetAt(0) == '\"' || tmp.GetAt(0) == '\'') //quoted string
			{
				tmp = tmp.Right(tmp.GetLength()-1);
				i = tmp.FindOneOf("\'\"\r\n>");
			}
			else
				i = tmp.FindOneOf(" \r\n>\'\"");
			tmp = tmp.Left(i);
			tmp.TrimLeft();
			tmp.TrimRight();
		}
		i += attri.GetLength();
	}
	}
	catch(...)
	{
	}

	return tmp;
}
Exemplo n.º 25
0
BOOL ShellRunExe(LPCTSTR lpszPath, LPCTSTR lpszParams, int iShow, HANDLE* phProcess, BOOL bWait, DWORD dwWaitTime)
{
	CString strPath = lpszPath;
	strPath.Trim();

	ASSERT(strPath.GetLength() > 4 && strPath.Right(4).CompareNoCase(EXE_FILE_EXTEND_NAME) == 0);

#ifdef _WIN32_WCE
	if(strPath.GetAt(0) != PATH_SEPARATOR_CHAR)
#else
	if(strPath.GetAt(1) != DISK_SYMBLE_CHAR)
#endif
	{
		CString strCurPath = ExtractModulePath();
		strPath = strCurPath + strPath;
	}

	SHELLEXECUTEINFO info = {0};

	info.cbSize			= sizeof(SHELLEXECUTEINFO);
	info.lpFile			= strPath;
	info.fMask			= SEE_MASK_FLAG_NO_UI;
	info.nShow			= iShow;
	info.lpParameters	= lpszParams;
	
	if(phProcess || bWait)
		info.fMask		|= SEE_MASK_NOCLOSEPROCESS;

	BOOL isOK = FALSE;

	if(::ShellExecuteEx(&info))
	{
		if(phProcess)
			*phProcess = info.hProcess;

		if(bWait)
		{
			isOK = (::WaitForSingleObject(info.hProcess, dwWaitTime) != WAIT_FAILED) ? TRUE : FALSE;
			::CloseHandle(info.hProcess);
		}
		else
			isOK = TRUE;
	}

	return isOK;
}
Exemplo n.º 26
0
BOOL CDlgDatosCobro::CompruebaNumero(CString strNumero)
{
	BOOL bPunto = FALSE; 

	for (int i = 0; i<strNumero.GetLength(); i++)
	{
		if (strNumero.GetAt(i) < '0' || strNumero.GetAt(i) > '9')
		{ 
			if (strNumero.GetAt(i)== '.' && bPunto == FALSE)
				bPunto = TRUE;
			else
				return FALSE;
		}
	}

	return TRUE;
}
Exemplo n.º 27
0
CString CObjParser::MtlParser(CString s_FileName)
{
	CString sMtlFileName, sFilePath;
	CString ImageName;

	int pos = 0, pos2 = 0, index = 0;

	sFilePath = s_FileName.Mid(0, s_FileName.ReverseFind('\\'));
	sMtlFileName = sFilePath + _T('\\') + g_sMtlFileName;

	CStdioFile ObjFile;

	if(!ObjFile.Open(sMtlFileName,CFile::modeRead))
	{
		AfxMessageBox(_T("Mtl File Error"));
		return _T("Mtl File Error");
	}

	CString sLineBuf;
	while(ObjFile.ReadString(sLineBuf))
	{
		sLineBuf.Replace(_T("\r"), _T(""));
		sLineBuf.Replace(_T("\t"), _T(""));

		if(sLineBuf.GetAt(0) == 'm')
		{
			if(sLineBuf.GetAt(1) == 'a' &&sLineBuf.GetAt(2) == 'p' && sLineBuf.GetAt(3) == '_' && sLineBuf.GetAt(4) == 'K' && sLineBuf.GetAt(5) == 'd')	
			{
				while((ImageName = sLineBuf.Tokenize(_T(" "), pos2 )) !=  _T(""))
				{
					switch(index)
					{
					case 1:
						ObjFile.Close();
						return sFilePath + _T('\\') + ImageName;
						break;
					}
					index++;
				}
			}
		}
	}
	ObjFile.Close();
	return _T("Mtl File Error");
}
Exemplo n.º 28
0
/**
 *	Load list from file "Resi.def"
 *	and we assume the fisrt record as the default one.
 *	and we copy one for reservation
 *	here we use the format as following.
 *	so the current setting is pointing to m_list(CurIndex+1)
 *	<title>
 *	Param1
 *	Param2
 *	...
 *		
 */
bool CRstdSetting::InstallFromFile()
{
	char DirUse[300];
	int epos;
	int count;
	CString line;
	RSTDTYPE rt;
	
	::GetCurrentDirectory(300,DirUse);
	strcat(DirUse,"\\Data\\Default\\Resi.def");
	if(!csf.Open(DirUse,CFile::modeRead))
		return false;
	CurIndex = -1;
	while(csf.ReadString(line))
	{
		if(line.IsEmpty())
			continue;
		if(line.GetAt(0) == '<')
		{
			epos=line.Find('>',0);
			if(epos > 1)
			{
				rt.sTitle = line.Mid(1,epos-1);
				for(count = 0;count<7;count++)
				{
					csf.ReadString(line);
					rt.bUse[count] = (line.GetAt(0) == 'Y');
					csf.ReadString(line);
					rt.dAlpha[count] = atof(line);
					csf.ReadString(line);
					rt.dBeta[count] = atof(line);
					csf.ReadString(line);
					rt.dValue[count] = atof(line);
				}
				m_list.Add(rt);
				if(CurIndex == -1)
					m_list.Add(rt); //add a copy to m_list
				CurIndex++;
			}
			continue;
		}
	}
	csf.Close();
	return (CurIndex != -1);
}
Exemplo n.º 29
0
CString CCodeRuleDlg::CodeString( CString strSource,CString strCodeRule )
{
	CString strDest;

	int len = min(strSource.GetLength(),strCodeRule.GetLength());

	for (int i = 0; i < len; i++)
	{
		if (strCodeRule.GetAt(i) != _T('0'))
		{
			strDest += strSource.GetAt(i);
		}
	}

	strDest += strSource.Mid(len);

	return strDest;
}
Exemplo n.º 30
0
/******************************************************************************
	함수명		: GetColCnt(CString strString)
	함수설명	: 코드문다열의 코드갯수를 샌다
	인자설명	: [IN] strString : 코드문자열
				  
	리턴값		: 코드갯수
	최종수정일	: 2003년 10월 14일
	참고사항	: 
 ******************************************************************************/
int CIDMSComboBox::GetColCnt(CString strString)
{
	int nColCnt = 0;

	for( int i=0 ; i<strString.GetLength() ; i++)
		if( CString(strString.GetAt(i)) == IDMSCOMBOBOX_DELIM ) nColCnt++;
	
	return nColCnt;
}