UI - Moved exception viewer to its own seperate window

Conditions - Started adding list conditions
This commit is contained in:
Robert committed 2020-08-11 17:27:11 +02:00
1 parent 930a7b4ef7
commit 6803bc5a37
36 files changed
+930 -471

No files matched your search

@@ -88,9 +88,26 @@ namespace Artemis.Core.Services.Storage.Interfaces
bool RedoUpdateProfile(Profile profile);
/// <summary>
/// Prepares the profile for rendering. You should not need to call this, it is exposed for some niche usage in the core
/// Prepares the profile for rendering. You should not need to call this, it is exposed for some niche usage in the
/// core
/// </summary>
/// <param name="profile"></param>
void InstantiateProfile(Profile profile);
/// <summary>
/// [Placeholder] Exports the profile described in the given <see cref="ProfileDescriptor" /> in a JSON format
/// </summary>
/// <param name="profileDescriptor">The descriptor of the profile to export</param>
/// <returns>The resulting JSON</returns>
string ExportProfile(ProfileDescriptor profileDescriptor);
/// <summary>
/// [Placeholder] Imports the provided base64 encoded GZIPed JSON as a profile for the given
/// <see cref="ProfileModule" />
/// </summary>
/// <param name="json">The content of the profile as JSON</param>
/// <param name="profileModule">The module to import the profile in to</param>
/// <returns></returns>
ProfileDescriptor ImportProfile(string json, ProfileModule profileModule);
}
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events;
@@ -10,6 +11,7 @@ using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.LayerEffect.Abstract;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Core.Utilities;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Repositories.Interfaces;
using Newtonsoft.Json;
@@ -40,6 +42,7 @@ namespace Artemis.Core.Services.Storage
}
public JsonSerializerSettings MementoSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
public JsonSerializerSettings ExportSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
public void ActivateLastActiveProfiles()
{
@@ -222,6 +225,26 @@ namespace Artemis.Core.Services.Storage
InstantiateFolders(profile);
}
public string ExportProfile(ProfileDescriptor profileDescriptor)
{
var profileEntity = _profileRepository.Get(profileDescriptor.Id);
if (profileEntity == null)
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
return JsonConvert.SerializeObject(profileEntity, ExportSettings);
}
public ProfileDescriptor ImportProfile(string json, ProfileModule profileModule)
{
var profileEntity = JsonConvert.DeserializeObject<ProfileEntity>(json, ExportSettings);
// Assign a new GUID to make sure it is unique in case of a previous import of the same content
profileEntity.Id = Guid.NewGuid();
_profileRepository.Add(profileEntity);
return new ProfileDescriptor(profileModule, profileEntity);
}
/// <summary>
/// Initializes the properties on the layers of the given profile
/// </summary>