forked from daveaglick/Scripty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptContext.cs
More file actions
43 lines (35 loc) · 1.17 KB
/
Copy pathScriptContext.cs
File metadata and controls
43 lines (35 loc) · 1.17 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
39
40
41
42
43
using System;
using System.IO;
using Microsoft.CodeAnalysis.MSBuild;
using Scripty.Core.Output;
using Scripty.Core.ProjectTree;
namespace Scripty.Core
{
public class ScriptContext : IDisposable
{
internal ScriptContext(string scriptFilePath, string projectFilePath, ProjectRoot projectRoot)
{
if (string.IsNullOrEmpty(scriptFilePath))
{
throw new ArgumentException("Value cannot be null or empty", nameof(scriptFilePath));
}
if (!Path.IsPathRooted(scriptFilePath))
{
throw new ArgumentException("The script file path must be absolute");
}
ScriptFilePath = scriptFilePath;
ProjectFilePath = projectFilePath;
Project = projectRoot;
Output = new OutputFileCollection(scriptFilePath);
}
public void Dispose()
{
Output.Dispose();
}
public ScriptContext Context => this;
public string ScriptFilePath { get; }
public string ProjectFilePath { get; }
public ProjectRoot Project { get; }
public OutputFileCollection Output { get; }
}
}