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());
 }
示例#2
0
 public YamlQuery this[string key]
 {
     get
     {
         return(YamlQuery.Mapping(_yamlRoot, key));
     }
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#6
0
        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);
            }
        }
示例#7
0
        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);
            }
        }
示例#8
0
        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);
            }
        }
示例#9
0
        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);
            }
        }
示例#10
0
 private string getYAMLValue(YamlQuery query)
 {
     string result;
     if (!query.TryGetValue(out result))
     {
         result = "Unknown";
     }
     return result;
 }
示例#11
0
        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();
        }
示例#12
0
 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;
 }
示例#13
0
 internal void UpdateResultsInfo(int sessionNumber, YamlQuery query, int position)
 {
     this.Results.SetResults(sessionNumber, query, position);
     this.CurrentResults = this.Results.Current;
 }
示例#14
0
 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();
        }