internal void ParseYaml(YamlQuery query, int position) { this.Position = position + 1; this.ClassPosition = Parser.ParseInt(query["ClassPosition"].GetValue()) + 1; this.Lap = new Laptime(Parser.ParseFloat(query["FastestTime"].GetValue())); this.Lap.LapNumber = Parser.ParseInt(query["FastestLap"].GetValue()); }
public YamlQuery this[string key] { get { return(YamlQuery.Mapping(_yamlRoot, key)); } }
private static YamlQuery Error(YamlQuery parent, string error, string key, object value) { var query = new YamlQuery(parent, true, null, key, value); query.ErrorMessage = error; return(query); }
public YamlQuery this[string key, object value] { get { // Are we in an incorrect path? if (this.IsError) { return(YamlQuery.Error(this, this.ErrorMessage, key, value)); } // Current node should be a sequence node if (this.Node == null) { return(YamlQuery.Error(this, "The YAML query path is incorrect: " + this.QueryPath, key, value)); } var type = this.Node.GetType(); if (type != typeof(YamlSequenceNode)) { return(YamlQuery.Error(this, string.Format("The YAML query path '{0}' is incorrect: expected a YamlSequenceNode, but received a {1}.", this.QueryPath, type.Name), key, value)); } return(new YamlQuery(this, false, (YamlSequenceNode)this.Node, key, value)); } }
internal void SetResults(int sessionNumber, YamlQuery query, int position) { if (!this.HasResult(sessionNumber)) { _sessions.Add(sessionNumber, new DriverSessionResults(_driver, sessionNumber)); } _currentSessionNumber = sessionNumber; var results = this[sessionNumber]; results.ParseYaml(query, position); }
protected YamlQuery(YamlQuery parent, bool error, YamlMappingNode root, string key) { _path = parent == null ? "" : parent.QueryPath; _path += key + ":"; this.IsError = error; if (!error) { // Find next mapping node this.Node = Find(root, key); } }
protected YamlQuery(YamlQuery parent, bool error, YamlSequenceNode root, string key, object value) { _path = parent == null ? "" : parent.QueryPath; _path += string.Format("{0}:{{{1}}}", key, value); // Find sequencing node with matching value this.IsError = error; if (!error) { // Find next mapping node this.Node = FindSequence(root, key, value); } }
private string getYAMLValue(YamlQuery query) { string result; if (!query.TryGetValue(out result)) { result = "Unknown"; } return result; }
internal void ParseYaml(YamlQuery query, int position) { this.IsEmpty = false; this.Position = position; this.ClassPosition = Parser.ParseInt(query["ClassPosition"].GetValue()) + 1; this.Lap = Parser.ParseInt(query["Lap"].GetValue()); this.Time = new Laptime(Parser.ParseFloat(query["Time"].GetValue())); this.FastestLap = Parser.ParseInt(query["FastestLap"].GetValue()); this.FastestTime = new Laptime(Parser.ParseFloat(query["FastestTime"].GetValue())); this.LastTime = new Laptime(Parser.ParseFloat(query["LastTime"].GetValue())); this.LapsLed = Parser.ParseInt(query["LapsLed"].GetValue()); this.LapsComplete = Parser.ParseInt(query["LapsComplete"].GetValue()); this.OutReasonId = Parser.ParseInt(query["ReasonOutId"].GetValue()); this.OutReason = query["ReasonOutStr"].GetValue(); }
private static YamlQuery Error(YamlQuery parent, string error, string key, object value) { var query = new YamlQuery(parent, true, null, key, value); query.ErrorMessage = error; return query; }
internal void UpdateResultsInfo(int sessionNumber, YamlQuery query, int position) { this.Results.SetResults(sessionNumber, query, position); this.CurrentResults = this.Results.Current; }
internal void UpdateQualyResultsInfo(YamlQuery query, int position) { this.QualyResults.ParseYaml(query, position); }
internal void ParseYaml(YamlQuery query, int position) { this.IsEmpty = false; this.Position = position; this.ClassPosition = Parser.ParseInt(query["ClassPosition"].GetValue()) + 1; this.Lap = Parser.ParseInt(query["Lap"].GetValue()); this.Time = new Laptime(Parser.ParseFloat(query["Time"].GetValue())); this.FastestLap = Parser.ParseInt(query["FastestLap"].GetValue()); this.FastestTime = new Laptime(Parser.ParseFloat(query["FastestTime"].GetValue())); this.LastTime = new Laptime(Parser.ParseFloat(query["LastTime"].GetValue())); this.LapsLed = Parser.ParseInt(query["LapsLed"].GetValue()); var previousLaps = this.LapsComplete; this.LapsComplete = Parser.ParseInt(query["LapsComplete"].GetValue()); this.LapsDriven = Parser.ParseInt(query["LapsDriven"].GetValue()); this.FastestTime.LapNumber = this.FastestLap; this.LastTime.LapNumber = this.LapsComplete; // Check if a new lap is completed, and add it to Laps if (this.LapsComplete > previousLaps) { this.Laps.Add(this.LastTime); this.AverageTime = this.Laps.Average(); } this.Incidents = Parser.ParseInt(query["Incidents"].GetValue());; this.OutReasonId = Parser.ParseInt(query["ReasonOutId"].GetValue()); this.OutReason = query["ReasonOutStr"].GetValue(); }