forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatchCompiler.cs
More file actions
31 lines (25 loc) · 1.03 KB
/
Copy pathPatchCompiler.cs
File metadata and controls
31 lines (25 loc) · 1.03 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
using System;
namespace ModuleManager.Patches
{
public static class PatchCompiler
{
public static IPatch CompilePatch(UrlDir.UrlConfig urlConfig, Command command, string name)
{
if (urlConfig == null) throw new ArgumentNullException(nameof(urlConfig));
if (name == null) throw new ArgumentNullException(nameof(name));
if (name == string.Empty) throw new ArgumentException("can't be empty", nameof(name));
INodeMatcher nodeMatcher = new NodeMatcher(name);
switch (command)
{
case Command.Edit:
return new EditPatch(urlConfig, nodeMatcher);
case Command.Copy:
return new CopyPatch(urlConfig, nodeMatcher);
case Command.Delete:
return new DeletePatch(urlConfig, nodeMatcher);
default:
throw new ArgumentException("invalid command for a root node: " + command, nameof(command));
}
}
}
}