示例#1
0
int
WPASupplicant::ListNetworks(WifiConfiguredNetworkInfo *dest, unsigned max)
{
  assert(dest != nullptr);
  assert(max > 0);

  if (!SendCommand("LIST_NETWORKS"))
    return -1;

  char buffer[4096];
  ssize_t nbytes = ReadTimeout(buffer, sizeof(buffer) - 1);
  if (nbytes <= 5)
    return -1;

  buffer[nbytes] = 0;

  return ParseListResults(dest, max, buffer);
}
TArray< TSharedRef<ISourceControlLabel> > FSubversionSourceControlProvider::GetLabels( const FString& InMatchingSpec ) const
{
	TArray< TSharedRef<ISourceControlLabel> > Labels;

	// look for each directory that matches the spec in the repository
	FSubversionSourceControlModule& SubversionSourceControl = FModuleManager::LoadModuleChecked<FSubversionSourceControlModule>( "SubversionSourceControl" );

	TArray<FXmlFile> ResultsXml;
	TArray<FString> Files;
	TArray<FString> ErrorMessages;
	Files.Add(GetRepositoryName() / SubversionSourceControl.AccessSettings().GetLabelsRoot());

	if(SubversionSourceControlUtils::RunCommand(TEXT("list"), Files, TArray<FString>(), ResultsXml, ErrorMessages, GetUserName()))
	{
		TArray< TSharedRef<FSubversionSourceControlLabel> > AllLabels;
		ParseListResults(ResultsXml, AllLabels);
		
		for(auto Iter(AllLabels.CreateConstIterator()); Iter; Iter++)
		{
			if((*Iter)->GetName().Contains(InMatchingSpec))
			{
				Labels.Add(*Iter);
			}
		}
	}
	else
	{
		// output errors if any
		for (int32 ErrorIndex = 0; ErrorIndex < ErrorMessages.Num(); ++ErrorIndex)
		{
			FMessageLog("SourceControl").Warning(FText::FromString(ErrorMessages[ErrorIndex]));
		}
	}

	return Labels;
}