Select Git revision
ResultFileHelper.cs
Forked from
VECTO / VECTO Sim
Source project has a limited visibility.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CombustionEngineData.cs 13.21 KiB
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Newtonsoft.Json;
using TUGraz.VectoCore.Exceptions;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
namespace TUGraz.VectoCore.Models.SimulationComponent.Data
{
/// <summary>
/// Represents the CombustionEngineData. Fileformat: .veng
/// </summary>
/// <code>
/// {
/// "Header": {
/// "CreatedBy": " ()",
/// "Date": "3/4/2015 12:26:24 PM",
/// "AppVersion": "2.0.4-beta3",
/// "FileVersion": 2
/// },
/// "Body": {
/// "SavedInDeclMode": false,
/// "ModelName": "Generic 24t Coach",
/// "Displacement": 12730.0,
/// "IdlingSpeed": 560.0,
/// "Inertia": 3.8,
/// "FullLoadCurves": [
/// {
/// "Path": "24t Coach.vfld",
/// "Gears": "0 - 99"
/// }
/// ],
/// "FuelMap": "24t Coach.vmap",
/// "WHTC-Urban": 0.0,
/// "WHTC-Rural": 0.0,
/// "WHTC-Motorway": 0.0
/// }
/// }
/// </code>
public class CombustionEngineData : SimulationComponentData
{
/// <summary>
/// A class which represents the json data format for serializing and deserializing the EngineData files.
/// </summary>
public class Data
{
public class DataHeader
{
[JsonProperty(Required = Required.Always)]
public string CreatedBy;
[JsonProperty(Required = Required.Always)]
public DateTime Date;
[JsonProperty(Required = Required.Always)]
public string AppVersion;
[JsonProperty(Required = Required.Always)]
public double FileVersion;
protected bool Equals(DataHeader other)
{
return string.Equals(CreatedBy, other.CreatedBy) && Date.Equals(other.Date) && string.Equals(AppVersion, other.AppVersion) && FileVersion.Equals(other.FileVersion);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;