|
|
@@ -1,6 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Net; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using IllusionPlugin; |
|
|
@@ -28,8 +28,23 @@ namespace TBConsole |
|
|
|
if (_logHandler == null) |
|
|
|
Debug.unityLogger.logHandler = _logHandler = new UnityLogHandler(Debug.unityLogger.logHandler); |
|
|
|
var logTask = _logHandler.CollectLogMessages(); |
|
|
|
var cmdparts = command.Split(' '); |
|
|
|
switch (cmdparts.Length) |
|
|
|
bool inString = false; |
|
|
|
var cmdparts = new List<string>(); |
|
|
|
command = command.Trim(); |
|
|
|
int lastIndex = 0; |
|
|
|
for (int i = 0; i <= command.Length; i++) |
|
|
|
{ |
|
|
|
if (i < command.Length && command[i] == '"') inString = !inString; |
|
|
|
else if (!inString && (i == command.Length || command[i] == ' ')) |
|
|
|
{ |
|
|
|
cmdparts.Add(command.Substring(lastIndex, i - lastIndex).Trim('"')); |
|
|
|
lastIndex = i + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//Console.WriteLine("Command parts: " + cmdparts.Aggregate((a, b) => a + ", " + b)); |
|
|
|
|
|
|
|
switch (cmdparts.Count) |
|
|
|
{ |
|
|
|
case 1: |
|
|
|
ExistingCommands.Call(cmdparts[0]); |
|
|
|