forked from canneverbe/Ketarin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomSetupInstruction.cs
59 lines (49 loc) · 1.31 KB
/
CustomSetupInstruction.cs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
namespace Ketarin
{
/// <summary>
/// Represents a custom setup instruction (C#) code.
/// </summary>
[Serializable()]
public class CustomSetupInstruction : SetupInstruction
{
#region Properties
/// <summary>
/// Gets or sets the code of the setup instruction.
/// </summary>
public string Code { get; set; }
/// <summary>
/// Gets or sets the type of command.
/// </summary>
public ScriptType Type { get; set; }
public override string Name
{
get
{
return "Custom script";
}
}
#endregion
public CustomSetupInstruction()
{
Type = ScriptType.Batch;
}
public override void Execute()
{
new Command(this.Code, this.Type).Execute(this.Application);
}
public override string ToString()
{
if (string.IsNullOrEmpty(Code))
{
return string.Empty;
}
string[] lines = Code.Split('\n');
if (lines.Length > 0)
{
return lines[0];
}
return base.ToString();
}
}
}