コード例 #1
0
ファイル: Taf.cs プロジェクト: fedarovich/metar.net-portable
        /// <summary>
        /// Returns item in code string.
        /// </summary>
        /// <returns></returns>
        public override string ToCode()
        {
            StringBuilder ret = new StringBuilder();

            ret.Append("TAF");
            if (IsCorrected)
            {
                ret.AppendPreSpaced("COR");
            }
            if (IsAmmended)
            {
                ret.AppendPreSpaced("AMD");
            }
            ret.AppendPreSpaced(ICAO);
            ret.AppendPreSpaced(DayTime.ToCode() + "Z");
            if (IsMissing)
            {
                ret.AppendPreSpaced("NIL");
            }

            if (IsMissing == false)
            {
                ret.AppendPreSpaced(Period.ToCode());
                if (IsCancelled)
                {
                    ret.AppendPreSpaced("CNL");
                }
                ret.AppendPreSpaced(base.ToCode());
                if (MaxTemperature != null)
                {
                    ret.AppendPreSpaced(MaxTemperature.ToCode());
                }
                if (MinTemperature != null)
                {
                    ret.AppendPreSpaced(MinTemperature.ToCode());
                }

                foreach (var fItem in Trends)
                {
                    ret.AppendPreSpaced(fItem.ToCode());
                }
            }

            return(ret.ToString());
        }