private VisualTopoModel ParseSet(VisualTopoModel model, StreamReader sr, bool decimalDegrees, bool ignoreRadialBeams)
        {
            VisualTopoSet set = new VisualTopoSet();

            string setHeader = sr.ReadLine();

            if (setHeader.StartsWith("[Configuration "))
            {
                sr.ReadToEnd(); // skip until end of stream
                return(model);
            }

            // Set header
            var data        = setHeader.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            var headerSlots = data[0].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            set.Color = this.ParseColor(headerSlots);
            set.Name  = data.Length > 1 ? data[1].Trim() : string.Empty;

            sr.Skip(1);
            var dataLine = sr.ReadLine();

            do
            {
                VisualTopoData topoData = new VisualTopoData();

                var parts = dataLine.Split(';');
                if (parts.Length > 1)
                {
                    topoData.Comment = parts[1].Trim();
                }
                var slots = parts[0].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                //Debug.Assert(slots.Length == 13);

                // Parse data line
                topoData = this.ParseData(topoData, slots, decimalDegrees, ignoreRadialBeams);
                if (topoData != null)
                {
                    set.Add(topoData);
                }
                dataLine = sr.ReadLine();
            }while (!string.IsNullOrWhiteSpace(dataLine));

            model.Sets.Add(set);

            return(model);
        }
Пример #2
0
 internal static string[] GetSectionHeader(VisualTopoSet set) => new[] { "Section",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "Pente",
                                                                         set.Color.ToRgbString(),
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         "",
                                                                         set.Name };