2 using System.Collections.Generic;
5 namespace DirectOutput.Scripting
12 private List<Script> InternalList =
new List<Script>();
21 public IEnumerator<Script> GetEnumerator()
32 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
34 return GetEnumerator();
46 public Script
this[
string Filename]
50 FileInfo FI =
new FileInfo(Filename);
51 foreach (
Script S
in InternalList)
53 if (S.
File.FullName == FI.FullName)
return S;
70 public Script this[
int Index]
74 return InternalList[Index];
86 get {
return InternalList.Count; }
95 public void LoadAndAddScripts(
string ScriptDirectory,
string FilePattern =
"*.cs",
bool ThrowExceptions =
false)
97 LoadAndAddScripts(
new DirectoryInfo(ScriptDirectory), FilePattern, ThrowExceptions);
106 public void LoadAndAddScripts(DirectoryInfo ScriptDirectory,
string FilePattern =
"*.cs",
bool ThrowExceptions =
false)
108 LoadAndAddScripts(ScriptDirectory.GetFiles(FilePattern), ThrowExceptions);
116 public void LoadAndAddScripts(IEnumerable<FileInfo> ScriptFiles,
bool ThrowExceptions =
false)
118 foreach (FileInfo F
in ScriptFiles)
120 LoadAndAddScript(F, ThrowExceptions);
130 public void LoadAndAddScript(FileInfo ScriptFile,
bool ThrowExceptions =
false)
133 foreach (
Script S
in InternalList)
135 if (S.
File.FullName == ScriptFile.FullName)
138 Log.
Warning(
"Script file has already been loaded. Will skip: {0}".Build(ScriptFile.FullName));
145 InternalList.Add(
new Script(ScriptFile, ThrowExceptions));