MUDCompiler:
- Now compiles scripts contained under a MUDCompiler/bin/debug/Scripts folder. MudEngine: - ScriptEngine now wraps scripts inside a default namespace. MUDScripts MUST not be placed within a namespace inside the script. The Engine handles it automatically.
This commit is contained in:
parent
fe05693fee
commit
0f87ac233a
4 changed files with 73 additions and 2 deletions
|
@ -46,6 +46,12 @@
|
|||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MudEngine\MudEngine.csproj">
|
||||
<Project>{498943A8-DF5A-4DB0-B506-0BFF44788657}</Project>
|
||||
<Name>MudEngine</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MudEngine.Scripting;
|
||||
|
||||
namespace MUDCompiler
|
||||
{
|
||||
class Program
|
||||
|
@ -20,11 +22,44 @@ namespace MUDCompiler
|
|||
|
||||
string command = Console.ReadLine();
|
||||
|
||||
//command error checking.
|
||||
if (String.IsNullOrEmpty(command))
|
||||
{
|
||||
Console.WriteLine("Invalid Command!");
|
||||
System.Threading.Thread.Sleep(1000); //wait before shutting down so user sees invalid command
|
||||
}
|
||||
else if (Convert.ToInt16(command) >= 3)
|
||||
{
|
||||
Console.WriteLine("Invalid Command!");
|
||||
System.Threading.Thread.Sleep(1000); //wait before shutting down so user sees invalid command
|
||||
}
|
||||
|
||||
switch (Convert.ToInt16(command))
|
||||
{
|
||||
case 1:
|
||||
CompileScripts();
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void CompileScripts()
|
||||
{
|
||||
ScriptEngine se = new ScriptEngine(ScriptEngine.ScriptTypes.SourceFiles);
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Compiling...");
|
||||
|
||||
se.Initialize();
|
||||
se.ScriptExtension = ".mud";
|
||||
se.ScriptPath = "Scripts";
|
||||
if (se.CompileScripts())
|
||||
Console.WriteLine("Compiling completed without error.");
|
||||
else
|
||||
Console.WriteLine(se.ErrorMessage);
|
||||
|
||||
Console.WriteLine("Press any key to exit.");
|
||||
Console.Read();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue