/// <summary> /// Retuns the tank as a CSV line /// </summary> /// <param name="wn8ExpectedValues">To lookup tank name and expected values</param> public string ToString(Wn8ExpectedValues wn8ExpectedValues) { var sb = new StringBuilder(); var e = wn8ExpectedValues[TankId]; Debug.Assert(e != null, "A refernce tank must exist!"); sb.Append(e.Name.SanitizeToCsv()); sb.Append(","); sb.Append(e.TypeName.SanitizeToCsv()); sb.Append(","); sb.Append(TankId); sb.Append(","); sb.Append(All.Battles); sb.Append(","); sb.Append(LastBattle.ToString("yyyy-MM-dd HH:mm:ss")); sb.Append(","); sb.Append(BattleLifeTime.TotalMinutes); sb.Append(","); double wn8 = wn8ExpectedValues.CalculateWn8(TankId, All); sb.Append(wn8); sb.Append(","); sb.Append(All.DamageDealt * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Wins * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Kills * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Spotted * 1.0 / All.Battles); sb.Append(","); sb.Append(All.DroppedCapturePoints * 1.0 / All.Battles); sb.Append(","); sb.Append(All.DamageAssisted * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Shots * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Hits * 1.0 / All.Battles); sb.Append(","); sb.Append(All.Piercings * 1.0 / All.Battles); sb.Append(","); sb.Append(All.DamageDealt * 1.0 / BattleLifeTime.TotalMinutes); sb.Append(","); sb.Append(All.SurvivedBattles * 1.0 / All.Battles); sb.Append(","); if (All.Deaths > 0) { sb.Append(All.Kills * 1.0 / All.Deaths); } sb.Append(","); if (All.DirectHitsReceived > 0) { sb.Append(All.NoDamageDirectHitsReceived * 1.0 / All.DirectHitsReceived); } return(sb.ToString()); }