-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code refactor, remove newtonsoft.json
- Loading branch information
Showing
14 changed files
with
231 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
using Geo.Gps.Serialization.Xml.Gpx.Gpx11; | ||
using GPXRide.Enums; | ||
using MudBlazor; | ||
|
||
namespace GPXRide.Classes | ||
{ | ||
public class ConvertTask | ||
{ | ||
public int? Id { get; set; } = null; | ||
public GpxFile OriginalGpxFile { get; set; } = null; | ||
public string FileName { get; set; } | ||
public ItineraryFile ConvertedItineraryFile { get; set; } = null; | ||
public int? Id { get; init; } | ||
public GpxFile OriginalGpxFile { get; set; } | ||
public string FileName { get; init; } | ||
public ItineraryFile ConvertedItineraryFile { get; set; } | ||
public ConvertState State { get; set; } = ConvertState.None; | ||
public ConvertOptions ConvertOptions { get; set; } = new(); | ||
public MudChip SelectedSourceChip { get; set; } | ||
public SourceType SourceType { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes; | ||
public class GpsRow | ||
{ | ||
[JsonPropertyName("rollAngle")] | ||
public double RollAngle { get; set; } | ||
[JsonPropertyName("gear")] | ||
public int Gear { get; set; } | ||
[JsonPropertyName("index")] | ||
public int Index { get; set; } | ||
[JsonPropertyName("engineSpeed")] | ||
public int EngineSpeed { get; set; } | ||
[JsonPropertyName("tripId")] | ||
public string TripId { get; set; } | ||
[JsonPropertyName("throttle")] | ||
public int Throttle { get; set; } | ||
[JsonPropertyName("fix")] | ||
public int Fix { get; set; } | ||
[JsonPropertyName("altitude")] | ||
public double Altitude { get; set; } | ||
[JsonPropertyName("time")] | ||
public string Time { get; set; } | ||
[JsonPropertyName("airTemperature")] | ||
public int AirTemperature { get; set; } | ||
[JsonPropertyName("latitude")] | ||
public double Latitude { get; set; } | ||
[JsonPropertyName("distanceInMeterFromStart")] | ||
public int DistanceInMeterFromStart { get; set; } | ||
[JsonPropertyName("rpm")] | ||
public int Rpm { get; set; } | ||
[JsonPropertyName("longitude")] | ||
public double Longitude { get; set; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes | ||
{ | ||
public class Itinerary | ||
{ | ||
[JsonProperty("length")] | ||
[JsonPropertyName("length")] | ||
public int Length { get; set; } | ||
|
||
[JsonProperty("preferences")] | ||
[JsonPropertyName("preferences")] | ||
public Preferences Preferences { get; set; } = new(); | ||
|
||
[JsonProperty("id")] | ||
[JsonPropertyName("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("creationDate")] | ||
[JsonPropertyName("creationDate")] | ||
public DateTime CreationDate { get; set; } = DateTime.Now; | ||
|
||
[JsonProperty("nations")] | ||
[JsonPropertyName("nations")] | ||
public List<object> Nations { get; set; } = []; | ||
|
||
[JsonProperty("duration")] | ||
[JsonPropertyName("duration")] | ||
public int Duration { get; set; } | ||
|
||
[JsonProperty("stops")] | ||
[JsonPropertyName("stops")] | ||
public List<Stop> Stops { get; set; } = []; | ||
|
||
[JsonProperty("name")] | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("vehicleClass")] | ||
[JsonPropertyName("vehicleClass")] | ||
public string VehicleClass { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes; | ||
|
||
public class JsonDateTimeConverter : JsonConverter<DateTime> | ||
{ | ||
private const string DateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ"; | ||
|
||
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
return DateTime.ParseExact(reader.GetString() ?? string.Empty, DateTimeFormat, null); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value.ToString(DateTimeFormat)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes | ||
{ | ||
public class Preferences | ||
{ | ||
[JsonProperty("motorway")] | ||
[JsonPropertyName("motorway")] | ||
public bool Motorway { get; set; } | ||
|
||
[JsonProperty("tunnel")] | ||
[JsonPropertyName("tunnel")] | ||
public bool Tunnel { get; set; } | ||
|
||
[JsonProperty("dirtRoads")] | ||
[JsonPropertyName("dirtRoads")] | ||
public bool DirtRoads { get; set; } | ||
|
||
[JsonProperty("trains")] | ||
[JsonPropertyName("trains")] | ||
public bool Trains { get; set; } | ||
|
||
[JsonProperty("tollFree")] | ||
[JsonPropertyName("tollFree")] | ||
public bool TollFree { get; set; } | ||
|
||
[JsonProperty("ferry")] | ||
[JsonPropertyName("ferry")] | ||
public bool Ferry { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes | ||
{ | ||
public class Stop | ||
{ | ||
[JsonProperty("date")] | ||
[JsonPropertyName("date")] | ||
public DateTime Date { get; set; } = DateTime.Now; | ||
|
||
[JsonProperty("isMyPosition")] | ||
[JsonPropertyName("isMyPosition")] | ||
public bool IsMyPosition { get; set; } | ||
|
||
[JsonProperty("latitude")] | ||
[JsonPropertyName("latitude")] | ||
public decimal Latitude { get; set; } | ||
|
||
[JsonProperty("city")] | ||
[JsonPropertyName("city")] | ||
public string City { get; set; } | ||
|
||
[JsonProperty("longitude")] | ||
[JsonPropertyName("longitude")] | ||
public decimal Longitude { get; set; } | ||
|
||
[JsonProperty("address")] | ||
[JsonPropertyName("address")] | ||
public string Address { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GPXRide.Classes; | ||
|
||
public class Trip | ||
{ | ||
[JsonPropertyName(nameof(Id))] | ||
public string Id { get; set; } | ||
[JsonPropertyName("bikeModel")] | ||
public string BikeModel { get; set; } | ||
[JsonPropertyName("totalTimeInSeconds")] | ||
public int TotalTimeInSeconds { get; set; } | ||
[JsonPropertyName("downloadedSizeInBytes")] | ||
public int DownloadedSizeInBytes { get; set; } | ||
[JsonPropertyName("maxThrottle")] | ||
public int MaxThrottle { get; set; } | ||
[JsonPropertyName("isCompleted")] | ||
public bool IsCompleted { get; set; } | ||
[JsonPropertyName("startAddress")] | ||
public int StartAddress { get; set; } | ||
[JsonPropertyName("endDate")] | ||
public string EndDate { get; set; } | ||
[JsonPropertyName("skippedRowsForMissingData")] | ||
public int SkippedRowsForMissingData { get; set; } | ||
[JsonPropertyName("countries")] | ||
public string[] Countries { get; set; } | ||
[JsonPropertyName("maxRollAngle")] | ||
public double MaxRollAngle { get; set; } | ||
[JsonPropertyName("uom")] | ||
public string Uom { get; set; } | ||
[JsonPropertyName("title")] | ||
public string Title { get; set; } | ||
[JsonPropertyName("stopAddress")] | ||
public int StopAddress { get; set; } | ||
[JsonPropertyName("startDate")] | ||
public string StartDate { get; set; } | ||
[JsonPropertyName("maxSpeedKmh")] | ||
public int MaxSpeedKmh { get; set; } | ||
[JsonPropertyName("imageName")] | ||
public string ImageName { get; set; } | ||
[JsonPropertyName("totalDistanceInMeters")] | ||
public int TotalDistanceInMeters { get; set; } | ||
[JsonPropertyName("temporaryGpsUnitTripId")] | ||
public int TemporaryGpsUnitTripId { get; set; } | ||
[JsonPropertyName("skippedRowsForInvalidLocation")] | ||
public int SkippedRowsForInvalidLocation { get; set; } | ||
[JsonPropertyName("avgSpeedKmh")] | ||
public double AvgSpeedKmh { get; set; } | ||
[JsonPropertyName("language")] | ||
public string Language { get; set; } | ||
|
||
[JsonIgnore] | ||
public List<GpsRow> GpsRows { get; set; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.