RestApi back to Rest, added separate RestManager field.

This commit is contained in:
high 2011-09-05 01:17:54 -04:00
parent 595efa4d41
commit 7cfc219794
2 changed files with 7 additions and 17 deletions

View file

@ -21,7 +21,7 @@ namespace TShockAPI {
#region RestMethods
//http://127.0.0.1:8080/HelloWorld/name/{username}?type=status
object usertest(Dictionary<string, string> verbs, IParameterCollection parameters, RequestEventArgs request)
object usertest(RestVerbs verbs, IParameterCollection parameters, RequestEventArgs request)
{
var ret = new Dictionary<string, string>();
var type = parameters["type"];
@ -38,15 +38,5 @@ namespace TShockAPI {
return null;
}
#endregion
public void Start()
{
Rest.Start();
}
public void Dispose()
{
Rest.Dispose();
}
}
}

View file

@ -69,7 +69,8 @@ namespace TShockAPI
public static bool OverridePort;
public static PacketBufferer PacketBuffer;
public static MaxMind.GeoIPCountry Geo;
public static RestManager RestApi;
public static Rest RestApi;
public static RestManager RestManager;
/// <summary>
/// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded.
@ -175,7 +176,9 @@ namespace TShockAPI
Regions = new RegionManager(DB);
Itembans = new ItemManager(DB);
RememberedPos = new RemeberedPosManager(DB);
RestApi = new RestManager(new Rest(IPAddress.Any, 8080));
RestApi = new Rest(IPAddress.Any, 8080);
RestManager = new RestManager(RestApi);
RestManager.RegisterRestfulCommands();
if (Config.EnableGeoIP)
Geo = new MaxMind.GeoIPCountry(Path.Combine(SavePath, "GeoIP.dat"));
@ -203,10 +206,7 @@ namespace TShockAPI
Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));
if (Initialized != null)
Initialized();
RestApi.RegisterRestfulCommands();
Initialized();
}
catch (Exception ex)
{