mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Update CSharpRunner.cs
Added support for including libraries via comments Example: //using System.Net; Build passing: http://i.pics.rs/Q8ntM.png Tested.
This commit is contained in:
parent
3438e20cb3
commit
e160fb7728
1 changed files with 8 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -49,9 +49,14 @@ namespace MinecraftClient
|
|||
bool scriptMain = true;
|
||||
List<string> script = new List<string>();
|
||||
List<string> extensions = new List<string>();
|
||||
List<string> libs = new List<string>();
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith("//MCCScript"))
|
||||
if (line.StartsWith("//using"))
|
||||
{
|
||||
libs.Add(line.Replace("//", "").Trim());
|
||||
}
|
||||
else if (line.StartsWith("//MCCScript"))
|
||||
{
|
||||
if (line.EndsWith("Extensions"))
|
||||
scriptMain = false;
|
||||
|
|
@ -78,6 +83,7 @@ namespace MinecraftClient
|
|||
"using System.Threading;",
|
||||
"using MinecraftClient;",
|
||||
"using MinecraftClient.Mapping;",
|
||||
String.Join("\n", libs),
|
||||
"namespace ScriptLoader {",
|
||||
"public class Script {",
|
||||
"public CSharpAPI MCC;",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue