当前位置: 首页>>代码示例>>C++>>正文


C++ CServerPath::SetPath方法代码示例

本文整理汇总了C++中CServerPath::SetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerPath::SetPath方法的具体用法?C++ CServerPath::SetPath怎么用?C++ CServerPath::SetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CServerPath的用法示例。


在下文中一共展示了CServerPath::SetPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Verify

bool CBookmarksDialog::Verify()
{
	wxTreeItemId item = m_pTree->GetSelection();
	if (!item)
		return true;

	CBookmarkItemData *data = (CBookmarkItemData *)m_pTree->GetItemData(item);
	if (!data)
		return true;

	const CServer *server;
	if (m_pTree->GetItemParent(item) == m_bookmarks_site)
		server = m_server;
	else
		server = 0;

	const wxString remotePathRaw = XRCCTRL(*this, "ID_BOOKMARK_REMOTEDIR", wxTextCtrl)->GetValue();
	if (!remotePathRaw.empty())
	{
		CServerPath remotePath;
		if (server)
			remotePath.SetType(server->GetType());
		if (!remotePath.SetPath(remotePathRaw))
		{
			XRCCTRL(*this, "ID_BOOKMARK_REMOTEDIR", wxTextCtrl)->SetFocus();
			if (server)
			{
				wxString msg;
				if (server->GetType() != DEFAULT)
					msg = wxString::Format(_("Remote path cannot be parsed. Make sure it is a valid absolute path and is supported by the current site's servertype (%s)."), server->GetNameFromServerType(server->GetType()));
				else
					msg = _("Remote path cannot be parsed. Make sure it is a valid absolute path.");
				wxMessageBoxEx(msg);
			}
			else
				wxMessageBoxEx(_("Remote path cannot be parsed. Make sure it is a valid absolute path."));
			return false;
		}
	}

	const wxString localPath = XRCCTRL(*this, "ID_BOOKMARK_LOCALDIR", wxTextCtrl)->GetValue();

	if (remotePathRaw.empty() && localPath.empty())
	{
		XRCCTRL(*this, "ID_BOOKMARK_LOCALDIR", wxTextCtrl)->SetFocus();
		wxMessageBoxEx(_("You need to enter at least one path, empty bookmarks are not supported."));
		return false;
	}

	bool sync = XRCCTRL(*this, "ID_BOOKMARK_SYNC", wxCheckBox)->GetValue();
	if (sync && (localPath.empty() || remotePathRaw.empty()))
	{
		wxMessageBoxEx(_("You need to enter both a local and a remote path to enable synchronized browsing for this bookmark."), _("New bookmark"), wxICON_EXCLAMATION, this);
		return false;
	}

	return true;
}
开发者ID:juaristi,项目名称:filezilla,代码行数:58,代码来源:bookmarks_dialog.cpp

示例2: OnSearch

void CSearchDialog::OnSearch(wxCommandEvent& event)
{
	if (!m_pState->IsRemoteIdle())
	{
		wxBell();
		return;
	}

	CServerPath path;

	const CServer* pServer = m_pState->GetServer();
	if (!pServer)
	{
		wxMessageBox(_("Connection to server lost."), _("Remote file search"), wxICON_EXCLAMATION);
		return;
	}
	path.SetType(pServer->GetType());
	if (!path.SetPath(XRCCTRL(*this, "ID_PATH", wxTextCtrl)->GetValue()) || path.IsEmpty())
	{
		wxMessageBox(_("Need to enter valid remote path"), _("Remote file search"), wxICON_EXCLAMATION);
		return;
	}

	m_search_root = path;

	// Prepare filter
	wxString error;
	if (!ValidateFilter(error, true))
	{
		wxMessageBox(wxString::Format(_("Invalid search conditions: %s"), error.c_str()), _("Remote file search"), wxICON_EXCLAMATION);
		return;
	}
	m_search_filter = GetFilter();
	if (!CFilterManager::CompileRegexes(m_search_filter))
	{
		wxMessageBox(_("Invalid regular expression in search conditions."), _("Remote file search"), wxICON_EXCLAMATION);
		return;
	}
	m_search_filter.matchCase = XRCCTRL(*this, "ID_CASE", wxCheckBox)->GetValue();

	// Delete old results
	m_results->ClearSelection();
	m_results->m_indexMapping.clear();
	m_results->m_fileData.clear();
	m_results->SetItemCount(0);
	m_visited.clear();
	m_results->RefreshListOnly(true);

	m_results->GetFilelistStatusBar()->Clear();

	// Start
	m_searching = true;
	m_pState->GetRecursiveOperationHandler()->AddDirectoryToVisitRestricted(path, _T(""), true);
	std::list<CFilter> filters; // Empty, recurse into everything
	m_pState->GetRecursiveOperationHandler()->StartRecursiveOperation(CRecursiveOperation::recursive_list, path, filters, true);
}
开发者ID:pappacurds,项目名称:filezilla,代码行数:56,代码来源:search.cpp

示例3: SendTransferCommand

int CUpdateWizard::SendTransferCommand()
{
	m_inTransfer = true;

	CFileTransferCommand::t_transferSettings transferSettings;

	CServerPath path;
	wxString file = m_urlFile;
	path.SetPath(file, true);

	CFileTransferCommand cmd(m_localFile, path, file, true, transferSettings);
	return m_pEngine->Command(cmd);
}
开发者ID:madnessw,项目名称:thesnow,代码行数:13,代码来源:updatewizard.cpp

示例4: OnSelectionChanged

void CRemoteViewHeader::OnSelectionChanged(wxCommandEvent& event)
{
	const wxString& dir = event.GetString();
	if (dir == _T(""))
		return;

	CServerPath path = m_path;
	if (!path.SetPath(dir))
	{
		wxBell();
		return;
	}

	if (!m_pState->m_pCommandQueue->Idle())
	{
		wxBell();
		return;
	}

	m_pState->ChangeRemoteDir(path);
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:21,代码来源:viewheader.cpp

示例5: ChangePath

BOOL CServerPath::ChangePath(CString &subdir, BOOL bIsFile /*=FALSE*/)
{
	CServerPath newpath = *this;
	CString dir = subdir;
	if (!(newpath.m_nServerType&FZ_SERVERTYPE_HIGHMASK))
		newpath.m_nServerType = FZ_SERVERTYPE_FTP;
	
	dir.TrimLeft(_T(" "));
	dir.TrimRight(_T(" "));

	if ( dir==_T("") )
	{
		if (newpath.IsEmpty() || bIsFile)
			return FALSE;
		else
		{
			*this=newpath;
			return TRUE;
		}
	}

	switch (newpath.m_nServerType&FZ_SERVERTYPE_HIGHMASK)
	{
	case FZ_SERVERTYPE_FTP:
		switch(newpath.m_nServerType&FZ_SERVERTYPE_SUBMASK)
		{
		case FZ_SERVERTYPE_SUB_FTP_MVS:
		case FZ_SERVERTYPE_SUB_FTP_BS2000:
			subdir.TrimLeft(FTP_MVS_DOUBLE_QUOTA);
			subdir.TrimRight(FTP_MVS_DOUBLE_QUOTA);

			if (subdir.Left(1) == _MPT("'"))
			{
				if (subdir.Right(1) != _MPT("'"))
					return FALSE;

				if (!newpath.SetPath(subdir, bIsFile))
					return FALSE;
			}
			else if (subdir.Right(1) == _MPT("'"))
				return FALSE;
			else if (!newpath.IsEmpty())
			{
				if (m_Prefix != _T("."))
					return FALSE;

				subdir.TrimLeft(_MPT('.'));
				while (subdir.Replace(_T(".."), _T(".")));

				int pos = subdir.Find(_MPT('.'));
				while (pos != -1)
				{
					newpath.m_Segments.push_back(subdir.Left(pos));
					subdir = subdir.Mid(pos + 1);
				}
				if (subdir != _T(""))
				{
					newpath.m_Segments.push_back(subdir);
					newpath.m_Prefix = _T("");
				}
				else
					newpath.m_Prefix = _T(".");

				if (bIsFile)
				{
					if (newpath.m_Prefix == _T("."))
						return false;

					if (newpath.m_Segments.empty())
						return false;
					subdir = newpath.m_Segments.back();
					newpath.m_Segments.pop_back();

					int pos = subdir.Find(_MPT('('));
					int pos2 = subdir.Find(_MPT(')'));
					if (pos != -1)
					{
						if (!pos || pos2 != subdir.GetLength() - 2)
							return false;
						newpath.m_Segments.push_back(subdir.Left(pos));
						subdir = subdir.Mid(pos + 1, pos2 - pos - 1);
					}
					else if (pos2 != -1)
						return false;
					else
						newpath.m_Prefix = _T(".");
				}
			}
			else if (!newpath.SetPath(subdir, bIsFile))
				return FALSE;
			break;
		case FZ_SERVERTYPE_SUB_FTP_VMS:
			{
				int pos1=dir.Find( _T("[") );
				if (pos1==-1)
				{
					int pos2=dir.ReverseFind(_MPT(']'));
					if (pos2!=-1)
						return FALSE;
					if (bIsFile)
//.........这里部分代码省略.........
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:101,代码来源:ServerPath.cpp


注:本文中的CServerPath::SetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。