forked from LiveSplit/LiveSplit.Server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptFactory.cs
More file actions
24 lines (20 loc) · 712 Bytes
/
ScriptFactory.cs
File metadata and controls
24 lines (20 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LiveSplit
{
public class ScriptFactory
{
public static readonly String[] AllScripts = new String[] { "JavaScript", "C#" };
public static IScript Create(String language, String code)
{
var lowerLanguage = language.ToLower();
if (lowerLanguage == "javascript" || lowerLanguage == "js")
return new JavaScriptScript(code);
else if (lowerLanguage == "c#" || lowerLanguage == "cs")
return new CSharpScript(code);
throw new ArgumentException("The language does not exist", "language");
}
}
}