forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrossAppDomainExecuteScriptCommand.cs
More file actions
33 lines (29 loc) · 1 KB
/
CrossAppDomainExecuteScriptCommand.cs
File metadata and controls
33 lines (29 loc) · 1 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
using System;
namespace ScriptCs.Command
{
[Serializable]
public class CrossAppDomainExecuteScriptCommand : ICrossAppDomainScriptCommand
{
public Config Config { get; set; }
public string[] ScriptArgs { get; set; }
public CommandResult Result { get; private set; }
public void Execute()
{
if (this.Config == null)
{
throw new InvalidOperationException("The config is missing.");
}
var services = ScriptServicesBuilderFactory.Create(this.Config, this.ScriptArgs).Build();
var command = new ExecuteScriptCommand(
this.Config.ScriptName,
this.ScriptArgs,
services.FileSystem,
services.Executor,
services.ScriptPackResolver,
services.LogProvider,
services.AssemblyResolver,
services.ScriptLibraryComposer);
this.Result = command.Execute();
}
}
}