Program.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using EVCB_OCPP.Packet.Features;
  2. using EVCB_OCPP.Packet.Messages.Basic;
  3. using EVCB_OCPP.Packet20.Messages;
  4. using EVCB_OCPP.WSServer.Message;
  5. using Newtonsoft.Json;
  6. using Newtonsoft.Json.Linq;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace EVCB_OCPP.WSServer
  13. {
  14. class Program
  15. {
  16. static void Main(string[] args)
  17. {
  18. string tt = "{ \"connectorId\": 1, \"evseId\": 1, \"connectorStatus\": \"Occupied\", \"timestamp\": \"2020-10-28T08:28:47Z\"}";
  19. var gg= JsonConvert.DeserializeObject<StatusNotificationRequest>(tt);
  20. ProtalServer s = new ProtalServer();
  21. Console.WriteLine("Starting Server...");
  22. s.Start();
  23. Console.Read();
  24. }
  25. public static object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
  26. {
  27. DateTime? timevalue = null;
  28. if (reader.Value != null)
  29. {
  30. DateTime date = ((DateTime)reader.Value).ToLocalTime();
  31. timevalue = new DateTime(date.Year, date.Month, date.Day, date.TimeOfDay.Hours, date.TimeOfDay.Minutes, date.TimeOfDay.Seconds, 000);
  32. }
  33. return timevalue;
  34. }
  35. }
  36. }