/// <summary> /// Decode a part into mData and return the rest /// </summary> /// <param name="raw">The raw METAR input string</param> /// <param name="minMax">The TempMinMax List to fill in</param> /// <returns>The reminder of the input string, (raw minus the processed part)</returns> public static string Decode(string raw, List <T_TempMinMax> minMax) { try { Match match = RE_regular.Match(raw); if (match.Success) { var tmm = new T_TempMinMax(); tmm.Chunks += match.Groups["chunk"].Value; tmm.Temperature = UnitC.FromTemp(match.Groups["temp"].Value); int day = int.Parse(match.Groups["day"].Value); int zHour = int.Parse(match.Groups["hour"].Value); tmm.At = new DateTime(DateTime.Now.Year, DateTime.Now.Month, day, zHour, 0, 0, DateTimeKind.Utc); tmm.IsMax = match.Groups["flag"].Value == "TX"; tmm.IsMin = match.Groups["flag"].Value == "TN"; tmm.Valid = true; minMax.Add(tmm); return(match.Groups["rest"].Value.TrimStart( )); } } catch { ; // DEBUG STOP } return(raw); }
/// <summary> /// Decode a part into mData and return the rest /// </summary> /// <param name="raw">The raw METAR input string</param> /// <param name="temp">The Temperature record to fill in</param> /// <returns>The reminder of the input string, (raw minus the processed part)</returns> public static string Decode(string raw, M_Temp temp) { try { Match match = RE_regular.Match(raw); if (match.Success) { temp.Chunks += match.Groups["chunk"].Value; temp.Temperature = UnitC.FromTemp(match.Groups["temp"].Value); if (match.Groups["dewpt"].Success) { temp.Dewpoint = UnitC.FromTemp(match.Groups["dewpt"].Value); } temp.Valid = true; return(match.Groups["rest"].Value.TrimStart( )); } } catch { ; // DEBUG STOP } return(raw); }