示例#1
0
void ThreadCheckVersion()
{
	//app dir
	CString myAppDir;
	CMyCommApp *myApp = (CMyCommApp *)AfxGetApp();
	CMainFrame * myMain = (CMainFrame *) myApp->GetMainWnd();
	CStdioFile myfile;
	myAppDir = myApp->m_AppDir;
	CString vertext = myAppDir + "\\version";
	if(!myfile.Open(vertext,CFile::modeRead))
	{
		
		CString myver;
		char s[256];
		_tcscpy(s,vertext.GetBuffer(vertext.GetLength())) ;
		if(myMain->DonwLoadFile("https://github.com/liquanhai/LSDComm/version/ver.txt",
			s))
			myMain->m_IsNewVertxt = TRUE;
		return;
	}
	else{
	   CString myverion;
	   myfile.ReadString(myverion); //line:1
	   myverion.TrimLeft();  myverion.TrimRight();
       if (atof(myApp->m_AppVersion)<atof(myverion))
	   {
			//new version
			CMyCommView * myview = (CMyCommView *) myMain->GetActiveView();
			//myview->m_EditLogger.AddText(vertext);
			//myview->m_EditLogger.AddText(myApp->m_AppVersion+"\r\n");
			myview->m_EditLogger.AddText(">>最新版本:"+myverion+"\r\n");
			CString strLine;
			myfile.ReadString(strLine); // downfilename line:2
			myApp->m_downfileexefilename = strLine;
			myfile.ReadString(strLine); //line:3
			myview->m_EditLogger.AddText(">>"+strLine +"\r\n");
			myview->m_EditLogger.AddText(">>升级点击主菜单的[帮助]->[在线升级]\r\n");

			myfile.Close();
			myMain->m_IsNewVertxt = TRUE;
	   }
	   else{
		   
		   char s[256];
		   _tcscpy(s,vertext.GetBuffer(vertext.GetLength())) ;
		   if(myMain->DonwLoadFile("https://github.com/liquanhai/LSDComm/version/ver.txt",
			   s))
				myMain->m_IsNewVertxt = TRUE;
		   myfile.Close();
		   
		   return;
	   }
	}
	
}
示例#2
0
void ThreadCheckVersion()
{
#if 1
	//app dir
	CString myAppDir;
	CMyCommApp *myApp = (CMyCommApp *)AfxGetApp();
	CMainFrame * myMain = (CMainFrame *) myApp->GetMainWnd();
	CStdioFile myfile;
	myAppDir = myApp->m_AppDir;
	CString vertext = myAppDir + "\\version";
	if(!myfile.Open(vertext,CFile::modeRead))
	{
		
		CString myver;
		char s[256];
		_tcscpy(s,vertext.GetBuffer(vertext.GetLength())) ;
		if(myMain->DonwLoadFile("http://git.oschina.net/yihui/lsdcomm/raw/master/release/version.txt",
			s))
			myMain->m_IsNewVertxt = TRUE;
		return;
	}
	else{
	   CString myverion;
	   myfile.ReadString(myverion); //line:1
	   myverion.TrimLeft();  myverion.TrimRight();
       if (atof(myApp->m_AppVersion)<atof(myverion))
	   {
			//new version
			CMyCommView * myview = (CMyCommView *) myMain->GetActiveView();
			//myview->m_EditLogger.AddText(vertext);
			//myview->m_EditLogger.AddText(myApp->m_AppVersion+"\r\n");
			myview->m_EditLogger.AddText(">>Latest Version:"+myverion+"\r\n");
			CString strLine;
			myfile.ReadString(strLine); // downfilename line:2
			myApp->m_downfileexefilename = strLine;
			myfile.ReadString(strLine); //line:3
			myview->m_EditLogger.AddText(">>"+strLine +"\r\n");
			myview->m_EditLogger.AddText(">>Click menu[Help]->[Upgrade]\r\n");

			myfile.Close();
			myMain->m_IsNewVertxt = TRUE;
	   }
	   else{
		   char s[256];
		   _tcscpy(s,vertext.GetBuffer(vertext.GetLength())) ;
		   if(myMain->DonwLoadFile("http://git.oschina.net/yihui/lsdcomm/raw/master/release/version.txt",
			   s))
				myMain->m_IsNewVertxt = TRUE;
		   myfile.Close();
		   
		   return;
	   }
	}
#endif
}
示例#3
0
void CUpgradeDlg::OnOK()
{
    // TODO: Add extra validation here
    if (!m_IsUpgrade) {
        CDialog::OnOK();
        return;
    };

    char s[256],s2[256];
    _tcscpy(s,m_StrLocalfile.GetBuffer(m_StrLocalfile.GetLength())) ;
    _tcscpy(s2,m_strdownfile.GetBuffer(m_strdownfile.GetLength())) ;
    CMainFrame * myMain = (CMainFrame *)AfxGetMainWnd();
    if(!myMain->DonwLoadFile(s2,s))
    {
        AfxMessageBox(_T("ÎÞ·¨Éý¼¶¡£"));
        return;
    }
    else {
        CDialog::OnOK();
    }

}