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