|
|
@@ -0,0 +1,41 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Net; |
|
|
|
using System.Reflection; |
|
|
|
using IllusionPlugin; |
|
|
|
|
|
|
|
namespace TBConsole |
|
|
|
{ |
|
|
|
public class TBConsoleMod : IEnhancedPlugin |
|
|
|
{ |
|
|
|
public override string Name => "TBConsole"; |
|
|
|
public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
|
|
|
|
|
|
|
private WebServer _server; |
|
|
|
public override void OnApplicationStart() |
|
|
|
{ |
|
|
|
GamecraftModdingAPI.Main.Init(); |
|
|
|
_server = new WebServer(CommandReceived); |
|
|
|
_server.Start(); |
|
|
|
} |
|
|
|
|
|
|
|
public string CommandReceived(string command) |
|
|
|
{ |
|
|
|
return $"Got it: {command}"; |
|
|
|
} |
|
|
|
|
|
|
|
public override void OnApplicationQuit() |
|
|
|
{ |
|
|
|
_server.Stop(); |
|
|
|
GamecraftModdingAPI.Main.Shutdown(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void Main(string[] args) |
|
|
|
{ |
|
|
|
var mod = new TBConsoleMod(); |
|
|
|
mod._server = new WebServer(mod.CommandReceived); |
|
|
|
mod._server.Start(); |
|
|
|
Console.ReadLine(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |