Profile editor - Added profile duplicate

This commit is contained in:
SpoinkyNL committed 2020-12-17 21:34:41 +01:00
1 parent e61a031485
commit 15759c9289
4 files changed
+26 -19

No files matched your search

@@ -118,7 +118,8 @@ namespace Artemis.Core.Services
/// </summary>
/// <param name="json">The content of the profile as JSON</param>
/// <param name="profileModule">The module to import the profile in to</param>
/// <param name="nameAffix">Text to add after the name of the profile (separated by a dash)</param>
/// <returns></returns>
ProfileDescriptor ImportProfile(string json, ProfileModule profileModule);
ProfileDescriptor ImportProfile(string json, ProfileModule profileModule, string nameAffix = "imported");
}
}
@@ -280,7 +280,7 @@ namespace Artemis.Core.Services
return JsonConvert.SerializeObject(profileEntity, ExportSettings);
}
public ProfileDescriptor ImportProfile(string json, ProfileModule profileModule)
public ProfileDescriptor ImportProfile(string json, ProfileModule profileModule, string nameAffix)
{
ProfileEntity? profileEntity = JsonConvert.DeserializeObject<ProfileEntity>(json, ExportSettings);
if (profileEntity == null)
@@ -288,7 +288,7 @@ namespace Artemis.Core.Services
// Assign a new GUID to make sure it is unique in case of a previous import of the same content
profileEntity.UpdateGuid(Guid.NewGuid());
profileEntity.Name = $"{profileEntity.Name} - Imported";
profileEntity.Name = $"{profileEntity.Name} - {nameAffix}";
_profileRepository.Add(profileEntity);
return new ProfileDescriptor(profileModule, profileEntity);