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 #region RestMethods
//http://127.0.0.1:8080/HelloWorld/name/{username}?type=status //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 ret = new Dictionary<string, string>();
var type = parameters["type"]; var type = parameters["type"];
@ -38,15 +38,5 @@ namespace TShockAPI {
return null; return null;
} }
#endregion #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 bool OverridePort;
public static PacketBufferer PacketBuffer; public static PacketBufferer PacketBuffer;
public static MaxMind.GeoIPCountry Geo; public static MaxMind.GeoIPCountry Geo;
public static RestManager RestApi; public static Rest RestApi;
public static RestManager RestManager;
/// <summary> /// <summary>
/// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded. /// 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); Regions = new RegionManager(DB);
Itembans = new ItemManager(DB); Itembans = new ItemManager(DB);
RememberedPos = new RemeberedPosManager(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) if (Config.EnableGeoIP)
Geo = new MaxMind.GeoIPCountry(Path.Combine(SavePath, "GeoIP.dat")); Geo = new MaxMind.GeoIPCountry(Path.Combine(SavePath, "GeoIP.dat"));
@ -204,9 +207,6 @@ namespace TShockAPI
if (Initialized != null) if (Initialized != null)
Initialized(); Initialized();
RestApi.RegisterRestfulCommands();
} }
catch (Exception ex) catch (Exception ex)
{ {