void UDeviceProfileManager::SaveProfiles(bool bSaveToDefaults) { if( !HasAnyFlags( RF_ClassDefaultObject ) ) { if(bSaveToDefaults) { for (int32 DeviceProfileIndex = 0; DeviceProfileIndex < Profiles.Num(); ++DeviceProfileIndex) { UDeviceProfile* CurrentProfile = CastChecked<UDeviceProfile>(Profiles[DeviceProfileIndex]); CurrentProfile->UpdateDefaultConfigFile(); } } else { TArray< FString > DeviceProfileMapArray; for (int32 DeviceProfileIndex = 0; DeviceProfileIndex < Profiles.Num(); ++DeviceProfileIndex) { UDeviceProfile* CurrentProfile = CastChecked<UDeviceProfile>(Profiles[DeviceProfileIndex]); FString DeviceProfileTypeNameCombo = FString::Printf(TEXT("%s,%s"), *CurrentProfile->GetName(), *CurrentProfile->DeviceType); DeviceProfileMapArray.Add(DeviceProfileTypeNameCombo); CurrentProfile->SaveConfig(CPF_Config, *DeviceProfileFileName); } GConfig->SetArray(TEXT("DeviceProfiles"), TEXT("DeviceProfileNameAndTypes"), DeviceProfileMapArray, DeviceProfileFileName); GConfig->Flush(false, DeviceProfileFileName); } ManagerUpdatedDelegate.Broadcast(); } }
void UDeviceProfileManager::InternalSaveProfiles() { TArray< FString > DeviceProfileMapArray; for(int32 DeviceProfileIndex = 0; DeviceProfileIndex < Profiles.Num(); ++DeviceProfileIndex) { UDeviceProfile* CurrentProfile = CastChecked<UDeviceProfile>( Profiles[DeviceProfileIndex] ); FString DeviceProfileTypeNameCombo = FString::Printf( TEXT("%s,%s"), *CurrentProfile->GetName(), *CurrentProfile->DeviceType ); DeviceProfileMapArray.Add( DeviceProfileTypeNameCombo ); CurrentProfile->SaveConfig(CPF_Config, *DeviceProfileFileName); } GConfig->SetArray( TEXT( "DeviceProfiles" ), TEXT( "DeviceProfileNameAndTypes" ), DeviceProfileMapArray, DeviceProfileFileName ); GConfig->Flush( false, DeviceProfileFileName ); }