150 lines
3.5 KiB
C#
150 lines
3.5 KiB
C#
using System;
|
|
using CsvHelper.Configuration.Attributes;
|
|
|
|
namespace StarsAssistant.CSV;
|
|
|
|
public class Fleet
|
|
{
|
|
[Index(0)]
|
|
public string FleetName { get; set; } = String.Empty;
|
|
|
|
[Index(1)]
|
|
public int X { get; set; }
|
|
|
|
[Index(2)]
|
|
public int Y { get; set; }
|
|
|
|
[Index(3)]
|
|
public string Planet { get; set; } = String.Empty;
|
|
|
|
[Index(4)]
|
|
public string Destination { get; set; } = String.Empty;
|
|
|
|
[Index(5)]
|
|
public string BattlePlan { get; set; } = String.Empty;
|
|
|
|
[Index(6)]
|
|
public int ShipCount { get; set; }
|
|
|
|
[Index(7)]
|
|
public int Ironium { get; set; }
|
|
|
|
[Index(8)]
|
|
public int Boranium { get; set; }
|
|
|
|
[Index(9)]
|
|
public int Germanium { get; set; }
|
|
|
|
[Index(10)]
|
|
public int Colonists { get; set; }
|
|
|
|
[Index(11)]
|
|
public int Fuel { get; set; }
|
|
|
|
[Index(12)]
|
|
public int OwnerFileId { get; set; }
|
|
|
|
[Ignore()]
|
|
public int ETA { get; private set; }
|
|
|
|
[Index(13)]
|
|
public string CSVETA {
|
|
set {
|
|
if ( value.Length >= 2
|
|
&& int.TryParse(value[..^1], out int result))
|
|
{
|
|
ETA = result;
|
|
} else {
|
|
ETA = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Index(14)]
|
|
public int Warp { get; set; }
|
|
|
|
[Index(15)]
|
|
public int Mass { get; set; }
|
|
|
|
[Index(16)]
|
|
public int Cloak { get; set; }
|
|
|
|
[Index(17)]
|
|
public int Scan { get; set; }
|
|
|
|
[Index(18)]
|
|
public int PenScan { get; set; }
|
|
|
|
[Index(19)]
|
|
public string Task { get; set; } = String.Empty;
|
|
|
|
[Index(20)]
|
|
public int Mining { get; set; }
|
|
|
|
[Index(21)]
|
|
public int Sweep { get; set; }
|
|
|
|
[Index(22)]
|
|
public int Laying { get; set; }
|
|
|
|
[Index(23)]
|
|
public int Terraforming { get; set; }
|
|
|
|
[Index(24)]
|
|
public int Unarmed { get; set; }
|
|
|
|
[Index(25)]
|
|
public int Scout { get; set; }
|
|
|
|
[Index(26)]
|
|
public int Warship { get; set; }
|
|
|
|
[Index(27)]
|
|
public int Utility { get; set; }
|
|
|
|
[Index(28)]
|
|
public int Bomber { get; set; }
|
|
|
|
/// <summary>
|
|
/// This will update a DB Fleet recrod with this CSV Data. DB/EF Handling
|
|
/// has to be done by the caller, we'll take care of none PK properties
|
|
/// only.
|
|
/// </summary>
|
|
/// <param name="dbFleet">record to fill</param>
|
|
public void UpdateDbFleet(Model.Fleet dbFleet)
|
|
{
|
|
if (dbFleet == null)
|
|
throw new InvalidOperationException("Cannot update a null DB fleet instance");
|
|
|
|
dbFleet.FleetName = FleetName;
|
|
dbFleet.X = X;
|
|
dbFleet.Y = Y;
|
|
dbFleet.Planet = Planet;
|
|
dbFleet.Destination = Destination;
|
|
dbFleet.BattlePlan = BattlePlan;
|
|
dbFleet.ShipCount = ShipCount;
|
|
dbFleet.Ironium = Ironium;
|
|
dbFleet.Boranium = Boranium;
|
|
dbFleet.Germanium = Germanium;
|
|
dbFleet.Colonists = Colonists;
|
|
dbFleet.Fuel = Fuel;
|
|
dbFleet.OwnerFileId = OwnerFileId;
|
|
dbFleet.ETA = ETA;
|
|
dbFleet.Warp = Warp;
|
|
dbFleet.Mass = Mass;
|
|
dbFleet.Cloak = Cloak;
|
|
dbFleet.Scan = Scan;
|
|
dbFleet.PenScan = PenScan;
|
|
dbFleet.Task = Task;
|
|
dbFleet.Mining = Mining;
|
|
dbFleet.Sweep = Sweep;
|
|
dbFleet.Laying = Laying;
|
|
dbFleet.Terraforming = Terraforming;
|
|
dbFleet.Unarmed = Unarmed;
|
|
dbFleet.Scout = Scout;
|
|
dbFleet.Warship = Warship;
|
|
dbFleet.Utility = Utility;
|
|
|
|
}
|
|
|
|
} |