/// <summary>
        /// The descendant's implementation of the decoding function.
        /// </summary>
        /// <param name="source">Source string to decode.</param>
        /// <returns></returns>
        protected override Metar DecodeCore(string source)
        {
            Metar  ret = new Metar();
            string p   = source;

            ret.Type        = new MetarPrefixDecoder().Decode(ref p);
            ret.IsCorrected = new CORDecoder {
                Required = false
            }.Decode(ref p);
            ret.ICAO      = new ICAODecoder().Decode(ref p);
            ret.Date      = new DayHourMinuteDecoder().Decode(ref p);
            ret.IsMissing = new NILDecoder {
                Required = false
            }.Decode(ref p);
            ret.IsAUTO = new AUTODecoder {
                Required = false
            }.Decode(ref p);
            ret.Wind               = new WindWithVariabilityDecoder().Decode(ref p);
            ret.Visibility         = new VisibilityForMetarDecoder().Decode(ref p);
            ret.Visibility.Runways =
                new RunwayVisibilityListDecoder().Decode(ref p);
            var phenomena = new PhenomInfoDecoder {
                Required = false
            }.Decode(ref p) ?? new PhenomInfo();

            ret.Phenomena = phenomena;
            ret.Clouds    = new CloudInfoWithNCDDecoder {
                Required = false
            }.Decode(ref p);
            ret.Temperature           = new TemperatureDecoder().Decode(ref p);
            ret.DewPoint              = new DewPointDecoder().Decode(ref p);
            ret.Pressure              = new PressureInfoDecoder().Decode(ref p);
            ret.RePhenomens           = new RePhenomInfoDecoder().Decode(ref p);
            ret.WindShears            = new WindShearInfoDecoder().Decode(ref p);
            ret.SeaSurfaceTemperature = new SeaSurfaceTemperatureDecoder {
                Required = false
            }.Decode(ref p);
            ret.SeaState = new SeaStateDecoder {
                Required = false
            }.Decode(ref p);
            ret.RunwayConditions = new RunwayConditionInfoDecoder().Decode(ref p);
            ret.Trend            = new TrendInfoForMetarDecoder {
                Required = false
            }.Decode(ref p);
            ret.Remark = new RemarkDecoder {
                Required = false
            }.Decode(ref p);

            return(ret);
        }
Beispiel #2
0
        /// <summary>
        /// The descendant's implementation of the decoding function.
        /// </summary>
        /// <param name="source">Source string to decode.</param>
        /// <returns></returns>
        protected override Metar _Decode(string source)
        {
            Metar  ret = new Metar();
            string p   = source;

            ret.Type = new MetarPrefixDecoder().Decode(ref p);

            ret.IsCorrected = new CORDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.ICAO = new ICAOWithNumbersDecoder().Decode(ref p);

            ret.Date = new DayHourMinuteDecoder().Decode(ref p);

            ret.IsMissing = new NILDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.IsAUTO = new AUTODecoder()
            {
                Required = false
            }.Decode(ref p);

            var wind = new WindWithVariabilityDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (wind == null)
            {
                wind = new WindWithVariability();
            }
            ret.Wind = wind;

            var visib = new VisibilityForMetarDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (visib == null)
            {
                visib = new VisibilityForMetar();
            }
            ret.Visibility         = visib;
            ret.Visibility.Runways =
                new RunwayVisibilityListDecoder()
            {
                Required = false
            }.Decode(ref p);

            var phenomens = new PhenomInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (phenomens == null)
            {
                phenomens = new Types.PhenomInfo();
            }
            ret.Phenomens = phenomens;

            ret.Clouds = new CloudInfoWithNCDDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Temperature = new TemperatureDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.DewPoint = new DewPointDecoder()
            {
                Required = false
            }.Decode(ref p);

            PressureInfo pi = new PressureInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (pi == null)
            {
                pi = new PressureInfo()
                {
                    QNH = 1013
                }
            }
            ;
            ret.Pressure = pi;

            ret.RePhenomens = new RePhenomInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.WindShears = new WindShearInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.SeaSurfaceTemperature = new SeaSurfaceTemperatureDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.SeaState = new SeaStateDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.RunwayConditions = new RunwayConditionInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Trend = new TrendInfoForMetarDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Remark = new RemarkDecoder()
            {
                Required = false
            }.Decode(ref p);

            return(ret);
        }
    }