Changeset 404 for binary-improvements2/WebServer/src/WebAPI/APIs
- Timestamp:
- Feb 16, 2023, 3:50:53 PM (21 months ago)
- Location:
- binary-improvements2/WebServer/src/WebAPI/APIs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/WebAPI/APIs/Command.cs
r402 r404 25 25 26 26 if (string.IsNullOrEmpty (id)) { 27 bool first = true; 28 foreach (IConsoleCommand cc in SdtdConsole.Instance.GetCommands ()) { 29 if (!first) { 27 IList<IConsoleCommand> ccs = SdtdConsole.Instance.GetCommands (); 28 for (int i = 0; i < ccs.Count; i++) { 29 IConsoleCommand cc = ccs [i]; 30 31 if (i > 0) { 30 32 writer.WriteValueSeparator (); 31 33 } 32 33 first = false;34 34 35 35 writeCommandJson (ref writer, cc, permissionLevel); … … 81 81 _writer.WriteString (_command.GetHelp ()); 82 82 83 int commandPermissionLevel = GameManager.Instance.adminTools. GetCommandPermissionLevel (_command.GetCommands ());83 int commandPermissionLevel = GameManager.Instance.adminTools.Commands.GetCommandPermissionLevel (_command.GetCommands ()); 84 84 _writer.WriteRaw (jsonAllowedKey); 85 85 _writer.WriteBoolean (_userPermissionLevel <= commandPermissionLevel); … … 117 117 } 118 118 119 int commandPermissionLevel = GameManager.Instance.adminTools. GetCommandPermissionLevel (command.GetCommands ());119 int commandPermissionLevel = GameManager.Instance.adminTools.Commands.GetCommandPermissionLevel (command.GetCommands ()); 120 120 121 121 if (_context.PermissionLevel > commandPermissionLevel) { -
binary-improvements2/WebServer/src/WebAPI/APIs/ServerInfo.cs
r402 r404 1 using System.Collections.Generic; 1 2 using JetBrains.Annotations; 2 3 using Utf8Json; … … 22 23 GameServerInfo gsi = ConnectionManager.Instance.LocalServerInfo; 23 24 24 bool first = true;25 26 25 IList<GameInfoString> list = EnumUtils.Values<GameInfoString> (); 26 for (int i = 0; i < list.Count; i++) { 27 GameInfoString stringGamePref = list [i]; 27 28 28 foreach (GameInfoString stringGamePref in EnumUtils.Values<GameInfoString> ()) { 29 string value = gsi.GetValue (stringGamePref); 30 31 if (!first) { 29 if (i > 0) { 32 30 writer.WriteValueSeparator (); 33 31 } 34 32 35 first = false;36 37 33 writer.WriteString (stringGamePref.ToStringCached ()); 38 34 writer.WriteNameSeparator (); 39 35 40 36 writer.WriteRaw (keyType); 41 37 writer.WriteString ("string"); 42 38 43 39 writer.WriteRaw (keyValue); 44 writer.WriteString ( value);45 40 writer.WriteString (gsi.GetValue (stringGamePref)); 41 46 42 writer.WriteEndObject (); 47 43 } 48 44 49 foreach (GameInfoInt intGamePref in EnumUtils.Values<GameInfoInt> ()) { 50 int value = gsi.GetValue (intGamePref); 45 IList<GameInfoInt> ints = EnumUtils.Values<GameInfoInt> (); 46 for (int i = 0; i < ints.Count; i++) { 47 GameInfoInt intGamePref = ints [i]; 51 48 52 if ( !first) {49 if (i > 0) { 53 50 writer.WriteValueSeparator (); 54 51 } 55 52 56 first = false;57 58 53 writer.WriteString (intGamePref.ToStringCached ()); 59 54 writer.WriteNameSeparator (); 60 55 61 56 writer.WriteRaw (keyType); 62 57 writer.WriteString ("int"); 63 58 64 59 writer.WriteRaw (keyValue); 65 writer.WriteInt32 ( value);66 60 writer.WriteInt32 (gsi.GetValue (intGamePref)); 61 67 62 writer.WriteEndObject (); 68 63 } 69 64 70 foreach (GameInfoBool boolGamePref in EnumUtils.Values<GameInfoBool> ()) { 71 bool value = gsi.GetValue (boolGamePref); 65 IList<GameInfoBool> prefs = EnumUtils.Values<GameInfoBool> (); 66 for (int i = 0; i < prefs.Count; i++) { 67 GameInfoBool boolGamePref = prefs [i]; 72 68 73 if ( !first) {69 if (i > 0) { 74 70 writer.WriteValueSeparator (); 75 71 } 76 72 77 first = false;78 79 73 writer.WriteString (boolGamePref.ToStringCached ()); 80 74 writer.WriteNameSeparator (); 81 75 82 76 writer.WriteRaw (keyType); 83 77 writer.WriteString ("bool"); 84 78 85 79 writer.WriteRaw (keyValue); 86 writer.WriteBoolean ( value);87 80 writer.WriteBoolean (gsi.GetValue (boolGamePref)); 81 88 82 writer.WriteEndObject (); 89 83 } 90 84 91 85 writer.WriteEndObject (); 92 86
Note:
See TracChangeset
for help on using the changeset viewer.