source: binary-improvements2/WebServer/src/WebAPI/JsonCommons.cs@ 402

Last change on this file since 402 was 402, checked in by alloc, 22 months ago
  • Major refactoring
  • Using Utf8Json for (de)serialization
  • Moving APIs to REST
  • Removing dependencies from WebServer and MapRenderer to ServerFixes
File size: 814 bytes
RevLine 
[402]1using Utf8Json;
2
3namespace Webserver.WebAPI {
4 public static class JsonCommons {
5 private static readonly byte[] jsonKeyPositionX = JsonWriter.GetEncodedPropertyNameWithBeginObject ("x");
6 private static readonly byte[] jsonKeyPositionY = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("y");
7 private static readonly byte[] jsonKeyPositionZ = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("z");
8
9 public static void WritePositionObject (JsonWriter _writer, Vector3i _position) {
10 _writer.WriteRaw (jsonKeyPositionX);
11 _writer.WriteInt32 (_position.x);
12
13 _writer.WriteRaw (jsonKeyPositionY);
14 _writer.WriteInt32 (_position.y);
15
16 _writer.WriteRaw (jsonKeyPositionZ);
17 _writer.WriteInt32 (_position.z);
18
19 _writer.WriteEndObject ();
20 }
21
22 }
23}
Note: See TracBrowser for help on using the repository browser.