Example #1
0
CString CXMLElement::ToString(BOOL bHeader, BOOL bNewline, BOOL bEncoding, TRISTATE bStandalone) const
{
	CString strXML;
	strXML.Preallocate( 256 );

	if ( bHeader )
	{
		strXML = _T("<?xml version=\"1.0\"");

		if ( bEncoding )
			strXML.Append( _PT(" encoding=\"utf-8\"") );

		if ( bStandalone == TRI_TRUE )
			strXML.Append( _PT(" standalone=\"yes\"") );
		else if ( bStandalone == TRI_FALSE )
			strXML.Append( _PT(" standalone=\"no\"") );

		strXML.Append( _PT("?>") );

		if ( bNewline )
			strXML.Append( _PT("\r\n") );
	}

	ToString( strXML, bNewline );
//	ASSERT( strXML.GetLength() == int( _tcslen(strXML) ) );

	return strXML;
}
int InitPlugin(char* data, int obj_id, HANDLE ExitEvent)
{
    DieEvent=ExitEvent;
    MenuXml.Parse(data,"item");
    xml* child;
    for(int i=0; i<MenuXml.vec.RealCount; i++)
    {
        child=MenuXml.vec[i];
        if(child->name!=NULL)
        {
            if(!_stricmp(child->name,"CallEvent"))
            {
                child=MenuXml.GetItemOnlyChild(child,"Name",1);
                HANDLE h=OpenEvent(EVENT_MODIFY_STATE,0,child->subtext);
                if(h==NULL)
                {
                    CString err;
                    err="Handle for ";
                    err.Append(child->subtext);
                    err.Append(" could not be opened!");
                    ShowError(err);
                }
                else
                    SetEvent(h);
            }
        }
    }
    return 1;
}
CString* CLocalizationEngine::GetFullPathForFileName(const char* aFileName)
{
	CString* lFullPath = NULL;
	CString* lLanguageExtension = NULL;
	TBool lIsLocalizedFile = false;

	//need to check if it is a localized file
	for(TInt lFileIndex = 0; lFileIndex < iFileEntries->GetCount(); lFileIndex++)
	{
		if(iFileEntries->Get(lFileIndex)->FileName->EqualTo(aFileName))
		{
			lIsLocalizedFile = iFileEntries->Get(lFileIndex)->IsLocalizedFile;
			break;
		}
	}

	if(lIsLocalizedFile)
	{
		lLanguageExtension = GetFileExtensionForLanguage(iLanguage);
	}
	else
	{
		lLanguageExtension = new CString(EXTENSION_FOR_UNLOCALIZED);
	}

	lFullPath = new CString(iPathToLocalizationDirectoy->GetData());
	lFullPath->Append(aFileName);
	lFullPath->Append(lLanguageExtension);
	lFullPath->Append(".mp3"); //to avoid compression of the file, we needed to add .mp3 on Android

	delete lLanguageExtension;

	return lFullPath;
}
Example #4
0
CString CSZCommandLineEx::FormatSubCommand(LPCWSTR lpCommandName)
{
    POSITION pos = m_subCommandMap.GetHeadPosition();
    if (!pos)
        return _T("");

    CSubCommandMap::CPair* pPair = m_subCommandMap.GetNext(pos);
    if (!pPair)
        return _T("");

    CString strSubCommand = lpCommandName;
    strSubCommand.Append(_T(" "));
    strSubCommand.Append(pPair->m_key);

    while(pos)
    {
        CSubCommandMap::CPair* pPair = m_subCommandMap.GetNext(pos);
        if (!pPair)
            continue;

        assert(!pPair->m_key.IsEmpty());

        strSubCommand.Append(_T(" | "));
        strSubCommand.Append(pPair->m_key);
    }

    return strSubCommand;
}
Example #5
0
CString SerializeStringArray(vector<CString> input) {
	CString output = _T("");
	for(int i = 0; i < input.size(); i++) {
		output.Append(input[i]);
		output.Append(_T(";"));
	}
	return output;
}
Example #6
0
void AddLog(CEdit*log, CString z)
{
	CString logstr;
	log->GetWindowText(logstr);
	logstr.Append(z);
	logstr.Append(_T("\r\n"));
	log->SetWindowText(logstr);
}
Example #7
0
int CDownloadedListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	LRESULT lRes = DefWindowProc();

	if (Misc::IsVistalater())
		UxTheme_Wrap::SetWindowTheme(m_hWnd, L"Explorer", 0);

	SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_INFOTIP | LVS_EX_DOUBLEBUFFER);

	CImageList ImageList;
	ImageList.Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 1);
	CBitmap bmpOK = AtlLoadBitmap(IDB_DLOK);
	CBitmap	bmpError = AtlLoadBitmap(IDB_DLERROR);
	ImageList.Add(bmpOK, RGB(255, 0, 255));
	ImageList.Add(bmpError, RGB(255, 0, 255));
	SetImageList(ImageList, LVSIL_SMALL);

	struct Column {
		LPCTSTR	columnName;
		int		columnType;
		int		columnFormat;
		int		defaultcolumnWidth;
	};
	Column	clm[] = {
		{ _T("!")			, LVCOLSORT_CUSTOM	, LVCFMT_LEFT	,  20 },
		{ _T("ファイル名")	, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 160 },
		{ _T("URL")			, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 300 },
		{ _T("ファイルパス"), LVCOLSORT_TEXT	, LVCFMT_LEFT	, 300 },
		{ _T("日付")		, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 120 },
		{ _T("サイズ")		, LVCOLSORT_CUSTOM	, LVCFMT_RIGHT	, 100 },
	};

	int nCount = _countof(clm);
	for (int i = 0; i < nCount; ++i) {
		InsertColumn(i, clm[i].columnName, clm[i].columnFormat, clm[i].defaultcolumnWidth);
		SetColumnSortType(i, clm[i].columnType);
	}

	// 設定を読み込む
	CString strIniFile = Misc::GetFullPath_ForExe(_T("Download.ini"));
	CIniFileI pr(strIniFile, _T("DownloadedListView"));
	for (int i = 0; i < nCount; ++i) {
		CString strWidth = _T("ColumnWidth");
		strWidth.Append(i);
		
		SetColumnWidth(i, pr.GetValue(strWidth, clm[i].defaultcolumnWidth));
	}

	unique_ptr<int[]> pColumnOrder(new int[nCount]);
	for (int i = 0; i < nCount; i++) {
		CString strColumnOrder = _T("ColumnOrder");
		strColumnOrder.Append(i);
		pColumnOrder[i] = pr.GetValue(strColumnOrder, i);
	}
	SetColumnOrderArray(nCount, pColumnOrder.get());

	return 0;
}
Example #8
0
CString CSZCommandLineEx::FormatEchoUsage(LPCWSTR lpCommandName, LPCWSTR lpSummary)
{
    CString strEchoUsage  = lpSummary;

    CString strSubCommand           = FormatSubCommand(lpCommandName);
    CString strCommandPresentation  = FormatCommandPresentation(lpCommandName);
    CString strCommandUsage         = FormatCommandUsage();

    strEchoUsage.Append(_T("\n\n"));
    
    if (!strSubCommand.IsEmpty())
    {
        strEchoUsage.Append(strSubCommand);
        if (!strCommandPresentation.IsEmpty())
        {
            strEchoUsage.Append(_T("\n\n"));
            strEchoUsage.Append(_T("    = Or =\n"));
        }
        strEchoUsage.Append(_T("\n"));
    }

    if (!strCommandPresentation.IsEmpty())
    {
        strEchoUsage.Append(strCommandPresentation);
        strEchoUsage.Append(_T("\n\n"));
        strEchoUsage.Append(strCommandUsage);
        strEchoUsage.Append(_T("\n\n"));
    }

    return strEchoUsage;
}
Example #9
0
BOOL CSpecialApp::CleanMyIE2() //
{	

	g_fnScanFile(g_pMain,BEGINPROC(BROWSERSCLEAN_MYIE2),0,0,0);

	if (m_bScan ==TRUE)
	{
		CString strRegPath = _T("HKEY_CURRENT_USER\\Software\\MYIE2");

		HKEY	hRootKey;
		CString strSubKey;
		m_regOpt.CrackRegKey(strRegPath,hRootKey,strSubKey);

		CString strValueName = _T("Folder");
		CString strValueData;
		m_regOpt.GetDefValue(hRootKey,strSubKey,strValueName,strValueData);


		int iLen = strValueData.GetLength();

		if(iLen <= 0)
			goto Exit;

		if (strValueData.GetAt(iLen-1) != _T('\\'))
		{
			strValueData.Append(_T("\\"));
		}

		if (strValueData!=_T(""))
		{

			CString strFileFullPath;
			WIN32_FIND_DATA fd;
			HANDLE hFindFile;

			strFileFullPath = strValueData;
			
			strFileFullPath.Append(_T("Config\\myie.ini"));
			hFindFile = FindFirstFile(strFileFullPath.GetBuffer(), &fd);
			strFileFullPath.ReleaseBuffer();
			if(hFindFile != INVALID_HANDLE_VALUE)
			{	
				//找到文件
				ScanSection(BROWSERSCLEAN_MYIE2,_T("UndoUrl"),strFileFullPath);	
				::FindClose(hFindFile); 
			}
		}
	}

Exit:

	g_fnScanFile(g_pMain,ENDPROC(BROWSERSCLEAN_MYIE2),0,0,0);
	return TRUE;
}
bool MyUPnP::deletePortmap(int eport, const CString& type)
{
	CString args;

	args.Empty();
	args.Append(GetArgString(_T("NewRemoteHost"), _T("")));
	args.Append(GetArgString(_T("NewExternalPort"), eport));
	args.Append(GetArgString(_T("NewProtocol"), type));

	return InvokeCommand(UPNPDELPORTMAP, args);
}
Example #11
0
void AddTransportSuffix(CString &str)
{
	switch (transport)
	{ 
	case MSIP_TRANSPORT_TCP:
		str.Append(_T(";transport=tcp"));
		break;
	case MSIP_TRANSPORT_TLS:
		str.Append(_T(";transport=tls"));
		break;
	}
}
void CPPgDirectories::OnBnClickedSeltempdiradd()
{
	CString paths;
	GetDlgItemText(IDC_TEMPFILES, paths);

	TCHAR buffer[MAX_PATH] = {0};
	//GetDlgItemText(IDC_TEMPFILES, buffer, ARRSIZE(buffer));

	if(SelectDir(GetSafeHwnd(),buffer,GetResString(IDS_SELECT_TEMPDIR))) {
		paths.Append(_T("|"));
		paths.Append(buffer);
		SetDlgItemText(IDC_TEMPFILES, paths);
	}
}
CString UTIL_GetModulePath()
{
		CString path;
		static TCHAR buf[MAX_PATH * 2];
		VERIFY(::GetModuleFileName(GetModuleHandle(NULL), buf, MAX_PATH * 2) > 0);
		
		static TCHAR d[5], dir[MAX_PATH];

		lsplitpath(buf, d, dir,NULL,NULL);

		path.Append(d);
		path.Append(dir);
		return path;
}
bool Application::Upgrade(LPCTSTR updateFilePath, LPCTSTR version) {
  HINSTANCE hInstance = AfxGetResourceHandle();
  HRSRC hResInfo = FindResource(hInstance, MAKEINTRESOURCE(IDR_APP_UPDATE), _T("EXE"));
  if (hResInfo == NULL) {
    return false;
  }  
  HGLOBAL hResData = LoadResource(hInstance, hResInfo);
  if (hResData == NULL) {
    return false;
  }
  int size = SizeofResource(hInstance, hResInfo);  
  const void *data = LockResource(hResData);
  if (data == NULL) {
    return false;
  }
  TCHAR tempFilePath[MAX_PATH];
  GetTempPath(_countof(tempFilePath), tempFilePath);
  GetTempFileName(tempFilePath, _T("~"), 0, tempFilePath);
  PathRemoveExtension(tempFilePath);
  _tcscat(tempFilePath, _T(".exe"));
  TCHAR appDir[MAX_PATH];
  GetModuleFileName(NULL, appDir, _countof(appDir));
  PathRemoveFileSpec(appDir);
  try {
    CFile file(tempFilePath, CFile::modeCreate | CFile::typeBinary | CFile::modeWrite);
    file.Write(data, size);
    file.Close();
  } catch (CException *e) {
    e->Delete();
    return false;
  }
  CString parameters;
  parameters.AppendChar(_T('\"'));
  parameters.Append(updateFilePath);
  parameters.AppendChar(_T('\"'));
  parameters.AppendChar(_T(' '));
  parameters.AppendChar(_T('\"'));
  parameters.Append(appDir);
  parameters.AppendChar(_T('\"'));
  parameters.AppendChar(_T(' '));
  parameters.AppendChar(_T('\"'));
  parameters.Append(version);
  parameters.AppendChar(_T('\"'));

  HINSTANCE instance = ShellExecute(NULL, NULL, tempFilePath, parameters, NULL, SW_SHOW); 
  if ((DWORD)instance <= 32) {
    return false;
  }
  return true;
}
Example #15
0
/**
 * Returns the .git-path (if .git is a file, read the repository path and return it)
 * adminDir always ends with "\"
 */
bool GitAdminDir::GetAdminDirPath(const CString &projectTopDir, CString &adminDir) const
{
	if (IsBareRepo(projectTopDir))
	{
		adminDir = projectTopDir;
		adminDir.TrimRight('\\');
		adminDir.Append(_T("\\"));
		return true;
	}

	CString sDotGitPath = projectTopDir + _T("\\") + g_GitAdminDir.GetAdminDirName();
	if (CTGitPath(sDotGitPath).IsDirectory())
	{
		sDotGitPath.TrimRight('\\');
		sDotGitPath.Append(_T("\\"));
		adminDir = sDotGitPath;
		return true;
	}
	else
	{
		FILE *pFile;
		_tfopen_s(&pFile, sDotGitPath, _T("r"));

		if (!pFile)
			return false;

		int size = 65536;
		std::unique_ptr<char[]> buffer(new char[size]);
		int length = (int)fread(buffer.get(), sizeof(char), size, pFile);
		fclose(pFile);
		CStringA gitPathA(buffer.get(), length);
		if (length < 8 || gitPathA.Left(8) != "gitdir: ")
			return false;
		CString gitPath = CUnicodeUtils::GetUnicode(gitPathA.Trim().Mid(8)); // 8 = len("gitdir: ")
		gitPath.Replace('/', '\\');
		gitPath.TrimRight('\\');
		gitPath.Append(_T("\\"));
		if (gitPath.GetLength() > 0 && gitPath[0] == _T('.'))
		{
			gitPath = projectTopDir + _T("\\") + gitPath;
			PathCanonicalize(adminDir.GetBuffer(MAX_PATH), gitPath.GetBuffer());
			adminDir.ReleaseBuffer();
			gitPath.ReleaseBuffer();
			return true;
		}
		adminDir = gitPath;
		return true;
	}
}
Example #16
0
void CFilesHashDlg::OnBnClickedOpen()
{
	if(!m_thrdData.threadWorking)
	{
		CString filter;
		TCHAR* nameBuffer;
		POSITION pos;
		nameBuffer = new TCHAR[MAX_FILES_NUM * MAX_PATH + 1];
		nameBuffer[0] = 0;
		filter = FILE_STRING;
		filter.Append(_T("(*.*)|*.*|"));
		CFileDialog dlgOpen(TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT, filter, NULL, 0);
		dlgOpen.GetOFN().lpstrFile = nameBuffer;
		dlgOpen.GetOFN().nMaxFile = MAX_FILES_NUM;
		if(IDOK == dlgOpen.DoModal())
		{
			pos = dlgOpen.GetStartPosition();
			ClearFilePaths();
			for(m_thrdData.nFiles = 0; pos != NULL; m_thrdData.nFiles++)
				m_thrdData.fullPaths.push_back(dlgOpen.GetNextPathName(pos));

			DoMD5();
		}
		delete[] nameBuffer;
	}
}
Example #17
0
void CCalculationCtrlPage::CalculateSeriesPower(int itemIdx)
{
    if((itemIdx < 0) || (itemIdx > (int)m_viewItems.size())) return;

    float viValue = m_viValueEdit.GetFloatValue();

    CResistor resistor = m_viewItems[itemIdx].Resistor;
    CString s;
    float totalPower = 0;
    float current = 0;

    if(m_voltageRadio.GetState()) {
        current = viValue / resistor.Value;
    } else {
        current = viValue;
    }

    for(int i=0; i < (int)resistor.Resistors.size(); ++i) {
        float power = (current * current) * resistor.Resistors[i];
        totalPower += power;
        if(power != 0) {
            s.AppendFormat(
                _T("%.0f Ohm - %.3f W"), resistor.Resistors[i], power
            );
        } else {
            s.AppendFormat(_T("%.0f Ohm"), resistor.Resistors[i]);
        }
        s.Append(L"\r\n");
    }

    if(totalPower != 0) {
        s.AppendFormat(_T("Total: %.3f W"), totalPower);
    }
    m_powerValuesEdit.SetWindowTextW(s);
}
void CPPgDirectories::LoadSettings(void)
{
	GetDlgItem(IDC_INCFILES)->SetWindowText(thePrefs.incomingdir);

	CString tempfolders;
	for (int i=0;i<thePrefs.tempdir.GetCount();i++) {
		tempfolders.Append(thePrefs.GetTempDir(i));
		if (i+1<thePrefs.tempdir.GetCount())
			tempfolders.Append(_T("|") );
	}

	GetDlgItem(IDC_TEMPFILES)->SetWindowText(tempfolders);

	m_ShareSelector.SetSharedDirectories(&thePrefs.shareddir_list);
	FillUncList();
}
Example #19
0
CString GetSIPURI(CString str, bool isSimple, bool isLocal)
{
	CString rab = str;
	rab.MakeLower();
	int pos = rab.Find(_T("sip:"));
	if (pos==-1)
	{
		str=_T("sip:")+str;
	}
	if (!isLocal) {
		pos = str.Find(_T("@"));
		if (accountSettings.accountId && pos==-1) {
			str.Append(_T("@")+accountSettings.account.domain);
		}
	}
	if (str.GetAt(str.GetLength()-1)=='>')
	{
		str = str.Left(str.GetLength()-1);
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str += _T(">");
	} else {
		if (!isSimple) {
			if (!isLocal || !accountSettings.accountId) {
				AddTransportSuffix(str);
			}
		}
		str = _T("<") + str + _T(">");
	}
	return str;
}
void CSubmoduleUpdateDlg::OnBnClickedOk()
{
	CResizableStandAloneDialog::UpdateData(TRUE);
	m_PathList.clear();

	CString selected;
	for (int i = 0; i < m_PathListBox.GetCount(); ++i)
	{
		if (m_PathListBox.GetSel(i))
		{
			if (!selected.IsEmpty())
				selected.AppendChar(L'|');
			CString text;
			m_PathListBox.GetText(i, text);
			m_PathList.push_back(text);
			selected.Append(text);
		}
	}
	m_regPath = selected;

	m_regInit = m_bInit;
	m_regRecursive = m_bRecursive;
	m_regForce = m_bForce;
	m_regRemote = m_bRemote;
	m_regNoFetch = m_bNoFetch;
	m_regMerge = m_bMerge;
	m_regRebase = m_bRebase;

	CResizableStandAloneDialog::OnOK();
}
Example #21
0
bool writeTestKeybyWinAPI( CString& currentPath )
{
    TCHAR cadKey[MAX_PATH];
    _tcscpy( cadKey, _T( "Software\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications\\CBM" ) );

    DWORD dwAccess = KEY_ALL_ACCESS;
    //判断是否64位
    if( IsWow64() )
    {
        dwAccess |= KEY_WOW64_64KEY;
    }

    CRegistry reg;
    bool ret = reg.Open( cadKey, HKEY_LOCAL_MACHINE, dwAccess );
    if( ret )
    {
        //if(reg.Count()>0)
        //{
        reg[_T( "LOADCTRLS" )] = ( DWORD )2;
        currentPath.Append( _T( "\\VVLoader.arx" ) );
        reg[_T( "LOADER" )] = currentPath;
        //}
    }
    reg.Close();

    return ret;
}
void CChinaUnicomConfig::Load()
{
	CString strIniPath = theApp.GetWorkPath();
	strIniPath.Append(_T("\\IBAConfig\\ChinaUnicom.ini"));

	INT nCount = ::GetPrivateProfileInt(_T("Config"), _T("ItemCount"), 0, strIniPath);
	
	for (int i=0; i < nCount; i++)
	{
		CString strKey ;
		strKey.Format(_T("item%d"), i + 1);
		
		ClassIDItem item;
		item.nClassID = ::GetPrivateProfileInt(strKey, _T("classID"), 0, strIniPath);

		::GetPrivateProfileString(strKey, _T("name"), _T("δ֪ÀàÐÍÃû³Æ£¬ÇëÅäÖÃChinaUnicom.ini"), item.strName.GetBuffer(256), 256, strIniPath);
		item.strName.ReleaseBuffer();
		
		::GetPrivateProfileString(strKey, _T("detail"), _T("δ֪ÀàÐÍÃèÊö£¬ÇëÅäÖÃChinaUnicom.ini"), item.strDetail.GetBuffer(256), 256, strIniPath);
		item.strDetail.ReleaseBuffer();

		::GetPrivateProfileString(strKey, _T("time"), _T(""), item.strTime.GetBuffer(256), 256, strIniPath);
		item.strTime.ReleaseBuffer();

		m_mapClassItem.SetAt(item.nClassID, item);
	}
	m_bLoaded = TRUE;
}
Example #23
0
// ----------------------------------------------------------------------------
//
void DMXStudio::log( const char *fmt, ... ) {
    va_list list;
    va_start( list, fmt );

    if ( studio.m_hLog ) {
        time_t rawtime;
        struct tm timeinfo;
        char buffer[80];

        time ( &rawtime );
        localtime_s( &timeinfo, &rawtime );

        strftime( buffer, sizeof(buffer), "[%x %X] ", &timeinfo );

        CString output;
        output = buffer;
        output.AppendFormatV( fmt, list );
        output.Append( "\n" );
        
        // fputs should be a sigle atomic operation (i.e. no log collisions)
        fputs( output, studio.m_hLog );
        fflush( studio.m_hLog );
    }

    va_end( list );
}
Example #24
0
void CCardCreditMethod::SetCardPwd(CString newVal)
{
	CString strPwd;
	newVal.Trim();

	if (newVal.GetLength() > 8)
	{
		CString strTmp;

		strTmp = newVal.Left(8);
		CEncrypt::CalcMac(strTmp, strPwd, m_strPSK, FALSE);

		strTmp = newVal.Mid(8);
		CIBAHelpper::FillString(strTmp, 8, '\0');
		CEncrypt::CalcMac(strTmp, strTmp, m_strPSK, FALSE);
		strPwd.Append(strTmp);
	}
	else
	{
		CIBAHelpper::FillString(newVal, 8, '0');
		CEncrypt::CalcMac(newVal, strPwd, m_strPSK, FALSE);
	}

	m_Params.SetValue(_T("cardPwd"), strPwd);
}
Example #25
0
void InformApp::FindExtensions(void)
{
  m_extensions.clear();
  for (int i = 0; i < 2; i++)
  {
    CString path;
    switch (i)
    {
    case 0:
      path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
      break;
    case 1:
      path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
      break;
    default:
      ASSERT(FALSE);
      break;
    }

    CFileFind find;
    BOOL finding = find.FindFile(path);
    while (finding)
    {
      finding = find.FindNextFile();
      if (!find.IsDots() && find.IsDirectory())
      {
        CString author = find.GetFileName();
        if (author == "Reserved")
          continue;
        if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
          continue;

        path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
        CFileFind find;
        BOOL finding = find.FindFile(path);
        while (finding)
        {
          finding = find.FindNextFile();
          if (!find.IsDirectory())
          {
            CString ext = ::PathFindExtension(find.GetFilePath());
            if (ext.CompareNoCase(".i7x") == 0)
              m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
            else if (ext.IsEmpty() && (i == 1))
            {
              // Rename an old-style extension (with no file extension) to end with ".i7x"
              CString newPath = find.GetFilePath();
              newPath.Append(".i7x");
              if (::MoveFile(find.GetFilePath(),newPath))
                m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
            }
          }
        }
        find.Close();
      }
    }
    find.Close();
  }
  std::sort(m_extensions.begin(),m_extensions.end());
}
Example #26
0
CString CLotteryDlg::print()
{
	CString str = L"本次随机数", tmp;
	for (std::set<size_t>::iterator iter = m_RandNo.begin(); iter != m_RandNo.end(); ++iter)
	{
		tmp.Format(L"%d ", *iter);
		str += tmp;
	}
	str.Append(L"已中奖者");
	str += L"\n";
	size_t indexToAband = 0;
	size_t i = 0;
	for (std::set<size_t>::iterator iter = m_RandNo.begin(); iter != m_RandNo.end(); ++iter)
	{
		if (m_CurPartnerNoInRandList == i++)
		{
			indexToAband = *iter;
			break;
		}
	}
	tmp.Format(L"当前绘制的图片编号为%d\n", indexToAband);
	str += tmp;
	OutputDebugString(str);
	return str;
}
Example #27
0
CString CAutonAI::DebugCrashInfo (void)

//	DebugCrashInfo
//
//	Returns debug crash info

	{
	CString sResult;

	sResult.Append(CONSTLIT("CAutonAI\r\n"));
	sResult.Append(strPatternSubst(CONSTLIT("Order: %d\r\n"), (int)GetCurrentOrder()));
	sResult.Append(strPatternSubst(CONSTLIT("m_State: %d\r\n"), m_State));
	sResult.Append(strPatternSubst(CONSTLIT("m_pDest: %s\r\n"), CSpaceObject::DebugDescribe(m_pDest)));
	sResult.Append(strPatternSubst(CONSTLIT("m_pTarget: %s\r\n"), CSpaceObject::DebugDescribe(m_pTarget)));

	return sResult;
	}
Example #28
0
CString CWorkThread::GetOutputName()
{
	CString szFlvPath = m_szOutputPath;
	CString szFlvName;
	m_qiyiFile.GetFileTitle(szFlvName);
	INT nLen = szFlvName.GetLength();
	szFlvName.Delete(nLen-4, 4);
	szFlvName.Append(_T(".FLV"));

	nLen = szFlvPath.GetLength();
	if (nLen > 3)
	{
		szFlvPath.Append(_T("\\"));
	}
	szFlvPath += szFlvName;
	return szFlvPath;
}
static bool WincredExists()
{
	CString path = g_Git.ms_LastMsysGitDir;
	if (g_Git.ms_LastMsysGitDir.Right(1) != _T("\\"))
		path.AppendChar(_T('\\'));
	path.Append(_T("..\\libexec\\git-core\\git-credential-wincred.exe"));
	return !!PathFileExists(path);
}
Example #30
0
BOOL	CDLListWindow::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
	m_nDownloading	= 0;
	WM_DLCOMPLETE	= ::RegisterWindowMessage(REGISTERMESSAGE_DLCOMPLETE);

	DoDataExchange(DDX_LOAD);

	m_editDLFolder = m_cmbDLFolder.GetDlgItem(1001);

	// ダイアログリサイズ初期化
    DlgResize_Init(true, true, WS_THICKFRAME | WS_CLIPCHILDREN);

	for (int i = 1; i <= 5; ++i) {
		CString str;
		str.Append(i);
		m_cmbParallelDL.AddString(str);
	}

	/* 設定を復元する */
	CIniFileI pr(CDLOptions::s_DLIniFilePath, _T("DLList"));
	m_cmbParallelDL.SetCurSel(pr.GetValue(_T("ParallelDL"), 0));

	CRect rcWindow;
	rcWindow.top	= pr.GetValue(_T("top"), -1);
	rcWindow.left	= pr.GetValue(_T("left"), -1);
	rcWindow.right	= pr.GetValue(_T("right"), -1);
	rcWindow.bottom	= pr.GetValue(_T("bottom"), -1);
	if (rcWindow != CRect(-1, -1, -1, -1))
		MoveWindow(rcWindow);	// 位置を復元

	// リストビューを準備
	m_DLList.InsertColumn(0, _T("URL"));
	m_DLList.SetColumnWidth(0, pr.GetValue(_T("ColumnWidthURL"), 300));


	int nCount = (int)CDLOptions::s_vecImageDLFolderHistory.size();
	for (int i = 0; i < nCount; ++i) {
		m_cmbDLFolder.AddString(CDLOptions::s_vecImageDLFolderHistory[i]);
	}

	// ImageDLFolderのパスに設定
	m_cmbDLFolder.SetWindowText(CDLOptions::strImgDLFolderPath);


	m_cmbDLOption.AddString(_T("上書きの確認をする"));
	m_cmbDLOption.AddString(_T("上書きの確認をしない"));
	m_cmbDLOption.AddString(_T("連番を付ける"));
	m_cmbDLOption.SetCurSel(pr.GetValue(_T("DLOption"), 0));

	RegisterDragDrop();

	CMessageLoop *pLoop = _Module.GetMessageLoop();
	pLoop->AddMessageFilter(this);

	return FALSE;
}