Program.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Net.Http;
  5. using System.Threading.Tasks;
  6. namespace EVCB_OCPP.WSServer
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. Dictionary<long, long> dictionary = new Dictionary<long, long>()
  13. {
  14. { DateTimeOffset.Now.AddDays(-3).ToUnixTimeSeconds(), DateTimeOffset.Now.ToUnixTimeSeconds()},
  15. { DateTimeOffset.Now.AddDays(-2).ToUnixTimeSeconds(), DateTimeOffset.Now.ToUnixTimeSeconds()},
  16. { DateTimeOffset.Now.AddDays(-1).ToUnixTimeSeconds(), DateTimeOffset.Now.ToUnixTimeSeconds()}
  17. };
  18. var ttt= JsonConvert.SerializeObject(dictionary);
  19. Console.WriteLine("====================================================================================================");
  20. Console.WriteLine("====================================================================================================");
  21. Console.WriteLine("== ==");
  22. Console.WriteLine("== ------------ ----------- ------------- ------------- ==");
  23. Console.WriteLine("== --- --- ---- ---------------- ---------------- ==");
  24. Console.WriteLine("== --- --- ---- ---- --- ---- --- ==");
  25. Console.WriteLine("== --- --- ---- ---- --- ---- --- ==");
  26. Console.WriteLine("== --- --- ---- ---- ------------- ---- ------------- ==");
  27. Console.WriteLine("== --- --- ---- ---- ----------- ---- ----------- ==");
  28. Console.WriteLine("== --- --- ---- ---- ---- ==");
  29. Console.WriteLine("== --- --- ---- ---- ---- ==");
  30. Console.WriteLine("== ----------- ----------- ---- ---- ==");
  31. Console.WriteLine("== ==");
  32. Console.WriteLine("====================================================================================================");
  33. Console.WriteLine("====================================================================================================");
  34. ProtalServer s = new ProtalServer();
  35. Console.WriteLine("Starting Server...");
  36. s.Start();
  37. Console.Read();
  38. }
  39. public static object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
  40. {
  41. DateTime? timevalue = null;
  42. if (reader.Value != null)
  43. {
  44. DateTime date = ((DateTime)reader.Value).ToLocalTime();
  45. timevalue = new DateTime(date.Year, date.Month, date.Day, date.TimeOfDay.Hours, date.TimeOfDay.Minutes, date.TimeOfDay.Seconds, 000);
  46. }
  47. return timevalue;
  48. }
  49. }
  50. }