- Timestamp:
- Oct 28, 2015, 7:51:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs
r250 r251 13 13 private Dictionary<String, WebAPI> apis = new Dictionary<string, WebAPI> (); 14 14 15 public ApiHandler (string staticPart, string moduleName = null) : base (moduleName) {15 public ApiHandler (string staticPart, string moduleName = null) : base (moduleName) { 16 16 this.staticPart = staticPart; 17 17 18 18 foreach (Type t in Assembly.GetExecutingAssembly ().GetTypes ()) { 19 19 if (!t.IsAbstract && t.IsSubclassOf (typeof(WebAPI))) { 20 ConstructorInfo ctor = t.GetConstructor (new Type [0]);20 ConstructorInfo ctor = t.GetConstructor (new Type [0]); 21 21 if (ctor != null) { 22 WebAPI apiInstance = (WebAPI)ctor.Invoke (new object [0]);22 WebAPI apiInstance = (WebAPI)ctor.Invoke (new object [0]); 23 23 addApi (t.Name.ToLower (), apiInstance); 24 24 } 25 25 } 26 26 } 27 28 // Add dummy types 29 Type dummy_t = typeof (API.Null); 30 ConstructorInfo dummy_ctor = dummy_t.GetConstructor (new Type [0]); 31 if (dummy_ctor != null) { 32 WebAPI dummy_apiInstance = (WebAPI)dummy_ctor.Invoke (new object[0]); 33 34 // Permissions that don't map to a real API 35 addApi("viewallclaims", dummy_apiInstance); 36 addApi("viewallplayers", dummy_apiInstance); 37 } 27 38 } 28 39
Note:
See TracChangeset
for help on using the changeset viewer.