forked from ZeraGmbH/Blockly.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartScript.cs
More file actions
38 lines (33 loc) · 1.04 KB
/
StartScript.cs
File metadata and controls
38 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
namespace BlocklyNet.Scripting;
/// <summary>
/// Base class for the parameters needed to start a new script.
/// </summary>
public abstract class StartScript
{
/// <summary>
/// Name of the script - the type of the script is defined by
/// the type of derived classes.
/// </summary>
[Required, NotNull]
public string Name { get; set; } = null!;
/// <summary>
/// Report the type of the script.
/// </summary>
/// <returns>The type of the script.</returns>
public abstract Type GetScriptType();
/// <summary>
/// Report the model used for this script.
/// </summary>
/// <returns>Unique name of the model.</returns>
public abstract string ModelType { get; }
}
/// <summary>
/// Describes a specific type of script.
/// </summary>
public abstract class StartScript<TScript, TResult> : StartScript where TScript : Script
{
/// <inheritdoc/>
public override Type GetScriptType() => typeof(TScript);
}