コード例 #1
0
AutomationPresetRef FAutomationTestPresetManager::AddNewPreset( const FText& PresetName, const TArray<FString>& SelectedTests )
{
	AutomationPresetRef NewPreset = AddNewPreset();
	NewPreset->SetPresetName(PresetName);
	NewPreset->SetEnabledTests(SelectedTests);
	SavePreset(NewPreset);
	return NewPreset;
}
コード例 #2
0
void FAutomationTestPresetManager::SavePreset( const AutomationPresetRef Preset )
{
	TSharedPtr<FJsonObject> PresetJson = FJsonObjectConverter::UStructToJsonObject(Preset.Get());

	if ( PresetJson.IsValid() )
	{
		FString PresetFileName = GetPresetFolder() / Preset->GetID().ToString() + TEXT(".json");
		FArchive* PresetFileWriter = IFileManager::Get().CreateFileWriter(*PresetFileName);

		if ( PresetFileWriter != nullptr )
		{
			TSharedRef<TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(PresetFileWriter, 0);
			FJsonSerializer::Serialize(PresetJson.ToSharedRef(), JsonWriter);

			delete PresetFileWriter;
		}
	}
}
コード例 #3
0
void FAutomationTestPresetManager::RemovePreset( const AutomationPresetRef Preset )
{
	if (Presets.Remove(Preset) > 0)
	{
		// Find the name of the preset on disk
		FString PresetFileName = GetPresetFolder() / Preset->GetID().ToString() + TEXT(".uap");

		// delete the preset on disk
		IFileManager::Get().Delete(*PresetFileName);
	}
}
コード例 #4
0
void FAutomationTestPresetManager::SavePreset( const AutomationPresetRef Preset )
{
	FString PresetFileName = GetPresetFolder() / Preset->GetID().ToString() + TEXT(".uap");
	FArchive* PresetFileWriter = IFileManager::Get().CreateFileWriter(*PresetFileName);

	if (PresetFileWriter != nullptr)
	{
		SavePreset(Preset, *PresetFileWriter);

		delete PresetFileWriter;
	}
}
コード例 #5
0
AutomationPresetPtr FAutomationTestPresetManager::AddNewPreset( const FText& PresetName, const TArray<FString>& SelectedTests )
{
	if ( PresetName.IsEmpty() )
	{
		return nullptr;
	}

	const FName NewNameSlug = MakeObjectNameFromDisplayLabel(PresetName.ToString(), NAME_None);

	if ( !Presets.FindByPredicate([&NewNameSlug] (const AutomationPresetPtr& Preset) { return Preset.IsValid() && Preset->GetID() == NewNameSlug; }) )
	{
		AutomationPresetRef NewPreset = MakeShareable(new FAutomationTestPreset(NewNameSlug));
		NewPreset->SetName(PresetName);
		NewPreset->SetEnabledTests(SelectedTests);

		Presets.Add(NewPreset);

		SavePreset(NewPreset);

		return NewPreset;
	}

	return nullptr;
}
コード例 #6
0
void FAutomationTestPresetManager::SavePreset( const AutomationPresetRef Preset, FArchive& Archive )
{
	Preset->Serialize(Archive);
}