| 1 | using System.Collections.Generic;
|
|---|
| 2 | using JetBrains.Annotations;
|
|---|
| 3 | using Utf8Json;
|
|---|
| 4 | using Webserver.Permissions;
|
|---|
| 5 |
|
|---|
| 6 | namespace Webserver.WebAPI.APIs.ServerState {
|
|---|
| 7 | [UsedImplicitly]
|
|---|
| 8 | public class ServerInfo : KeyValueListAbs {
|
|---|
| 9 | public ServerInfo () : base ("ServerInfo") {
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | protected override void iterateList (ref JsonWriter _writer, ref bool _first) {
|
|---|
| 13 | GameServerInfo gsi = ConnectionManager.Instance.LocalServerInfo;
|
|---|
| 14 |
|
|---|
| 15 | IList<GameInfoString> list = EnumUtils.Values<GameInfoString> ();
|
|---|
| 16 | for (int i = 0; i < list.Count; i++) {
|
|---|
| 17 | GameInfoString stringGamePref = list [i];
|
|---|
| 18 | addItem (ref _writer, ref _first, stringGamePref.ToStringCached (), gsi.GetValue (stringGamePref));
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | IList<GameInfoInt> ints = EnumUtils.Values<GameInfoInt> ();
|
|---|
| 22 | for (int i = 0; i < ints.Count; i++) {
|
|---|
| 23 | GameInfoInt intGamePref = ints [i];
|
|---|
| 24 | addItem (ref _writer, ref _first, intGamePref.ToStringCached (), gsi.GetValue (intGamePref));
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | IList<GameInfoBool> prefs = EnumUtils.Values<GameInfoBool> ();
|
|---|
| 28 | for (int i = 0; i < prefs.Count; i++) {
|
|---|
| 29 | GameInfoBool boolGamePref = prefs [i];
|
|---|
| 30 | addItem (ref _writer, ref _first, boolGamePref.ToStringCached (), gsi.GetValue (boolGamePref));
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | public override int DefaultPermissionLevel () => AdminWebModules.PermissionLevelGuest;
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|