Esempio n. 1
0
        public NatsMessage(XDocument doc)
        {
            var root = doc.Root;

            WestMessage = new IndividualNatsMessage(root.Element("Westbound"));
            EastMessage = new IndividualNatsMessage(root.Element("Eastbound"));
        }
Esempio n. 2
0
        private List <NorthAtlanticTrack> TryAddMessage(IndividualNatsMessage msg)
        {
            try
            {
                return(ConvertToTracks(msg));
            }
            catch
            {
                var dir = msg.Direction == NatsDirection.East ? "eastbound" : "westbound";

                statusRecorder.AddEntry(
                    StatusRecorder.Severity.Caution,
                    $"Unable to interpret {dir} tracks.",
                    TrackType.Nats);

                return(new List <NorthAtlanticTrack>());
            }
        }
Esempio n. 3
0
        private static List <NorthAtlanticTrack> ConvertToTracks(IndividualNatsMessage msg)
        {
            char trkStartChar = msg.Direction == NatsDirection.West ? 'A' : 'N';

            var Message = msg.Message;
            var tracks  = new List <NorthAtlanticTrack>();

            for (int i = trkStartChar; i < trkStartChar + 13; i++)
            {
                char id = (char)i;
                int  j  = Message.IndexOf($"\n{id} ");

                if (j < 0)
                {
                    continue;
                }

                j += 2;
                var newLinePos = Message.IndexOf('\n', j);

                var route = Message.Substring(j, newLinePos - j)
                            .Split(DelimiterWords, StringSplitOptions.RemoveEmptyEntries);

                TryConvertNatsLatLon(route);

                tracks.Add(new NorthAtlanticTrack(
                               msg.Direction,
                               id.ToString(),
                               "",
                               "",
                               "",
                               route.ToRouteString()));
            }

            return(tracks);
        }
Esempio n. 4
0
 public NatsMessage(IndividualNatsMessage WestMessage,
                    IndividualNatsMessage EastMessage)
 {
     this.WestMessage = WestMessage;
     this.EastMessage = EastMessage;
 }