Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.
Users reporting for no reason may be locked out.
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
// Bind to "entitysessionresult_obj" to get the IEntitySessionResult as the value
// Cast to IEntitySessionResult type
IEntitySessionResult result = (IEntitySessionResult) value;
// Check DNS, Out, Pits, etc
if (result.Out)
return "OUT";
// We need the following information to determine whether to show interval or laps
var pos = result.ClassPosition;
var gap = result.ClassGap;
var laps = result.ClassGapLaps;
var type = result.Session.Type;
if (result.ClassPosition == 1)
return "LAP " + result.CurrentLap.Number;
// If car is lapped AND this is a race session,
// then show nr of gap laps instead of gap time
if (laps > 0 && type == SessionType.Race)
{
if (laps == 1)
return "+1 Lap"; // to avoid incorrect "1 Laps"
else
return "+" + laps + " Laps";
}
// If the car is in the same lap just return the time
// If the car is in same lap but over a minute behind, convert total seconds to proper format
var min = 0;
float sectime;
if (gap > 60)
{
min = (int) (gap / 60);
sectime = gap % 60;
return "+" + min + ":" + sectime.ToString("00.000");
}
else
return "+" + gap.ToString("0.000");
}