예제 #1
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);
	}
}
예제 #2
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;
	}
}
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;
		}
	}
}