Scripting - Added script creation

This commit is contained in:
Robert committed 2021-06-21 00:44:57 +02:00
1 parent 8c729055ea
commit 4a69baebb7
11 files changed
+366 -49

No files matched your search

@@ -179,41 +179,10 @@ namespace Artemis.Core.Services
public interface IScriptingService : IArtemisService
{
/// <summary>
/// Gets a read only collection of all active global scripts
/// </summary>
ReadOnlyCollection<GlobalScript> GlobalScripts { get; }
/// <summary>
/// Attempts to create an instance of a global script configured in the provided <see cref="ScriptConfiguration" />
/// </summary>
/// <param name="scriptConfiguration">The script configuration of the script to instantiate</param>
/// <returns>An instance of the script if the script provider was found; otherwise <see langword="null" /></returns>
GlobalScript? CreateScriptInstance(ScriptConfiguration scriptConfiguration);
/// <summary>
/// Attempts to create an instance of a profile script configured in the provided <see cref="ScriptConfiguration" />
/// </summary>
/// <param name="profile">The profile the script is bound to</param>
/// <param name="scriptConfiguration">The script configuration of the script to instantiate</param>
/// <returns>An instance of the script if the script provider was found; otherwise <see langword="null" /></returns>
ProfileScript? CreateScriptInstance(Profile profile, ScriptConfiguration scriptConfiguration);
/// <summary>
/// Attempts to create an instance of a layer script configured in the provided <see cref="ScriptConfiguration" />
/// </summary>
/// <param name="layer">The layer the script is bound to</param>
/// <param name="scriptConfiguration">The script configuration of the script to instantiate</param>
/// <returns>An instance of the script if the script provider was found; otherwise <see langword="null" /></returns>
LayerScript? CreateScriptInstance(Layer layer, ScriptConfiguration scriptConfiguration);
/// <summary>
/// Attempts to create an instance of a layer property script configured in the provided
/// <see cref="ScriptConfiguration" />
/// </summary>
/// <param name="layerProperty">The layer property the script is bound to</param>
/// <param name="scriptConfiguration">The script configuration of the script to instantiate</param>
/// <returns>An instance of the script if the script provider was found; otherwise <see langword="null" /></returns>
PropertyScript? CreateScriptInstance(ILayerProperty layerProperty, ScriptConfiguration scriptConfiguration);
}
}
@@ -532,7 +532,7 @@ namespace Artemis.Core.Services
if (markAsFreshImport)
profileEntity.IsFreshImport = true;
if (_profileRepository.Get(profileEntity.Id) != null)
if (_profileRepository.Get(profileEntity.Id) == null)
_profileRepository.Add(profileEntity);
else
throw new ArtemisCoreException($"Cannot import this profile without {nameof(makeUnique)} being true");