• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davewalker5 / ADS-B-BaseStationReader / 17804934237

17 Sep 2025 04:40PM UTC coverage: 89.917% (-3.8%) from 93.692%
17804934237

push

github

web-flow
Merge pull request #41 from davewalker5/filtered-tracking

Filtered tracking

381 of 461 branches covered (82.65%)

Branch coverage included in aggregate %.

1465 of 1592 new or added lines in 52 files covered. (92.02%)

1465 of 1592 relevant lines covered (92.02%)

38.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.29
/src/BaseStationReader.BusinessLogic/Configuration/TrackerSettingsBuilder.cs
1
using BaseStationReader.Entities.Config;
2
using BaseStationReader.Entities.Interfaces;
3
using BaseStationReader.Entities.Logging;
4
using BaseStationReader.Entities.Tracking;
5

6
namespace BaseStationReader.BusinessLogic.Configuration
7
{
8
    public class TrackerSettingsBuilder : ITrackerSettingsBuilder
9
    {
10
        /// <summary>
11
        /// Construct the application settings from the configuration file and any command line arguments
12
        /// </summary>
13
        /// <param name="parser"></param>
14
        /// <param name="defaultConfigJsonPath"></param>
15
        /// <returns></returns>
16
        public TrackerApplicationSettings BuildSettings(ICommandLineParser parser, string defaultConfigJsonPath)
17
        {
19✔
18
            // If a settings file has been specified, use it in place of the default
19
            var values = parser.GetValues(CommandLineOptionType.SettingsFile);
19✔
20
            var configJsonPath = (values != null) ? values[0] : defaultConfigJsonPath;
19!
21

22
            // Read the config file to provide default settings
23
            var settings = new TrackerConfigReader().Read(configJsonPath);
19✔
24

25
            // Apply the command line values over the defaults
26
            values = parser.GetValues(CommandLineOptionType.Host);
19✔
27
            if (values != null) settings!.Host = values[0];
20✔
28

29
            values = parser.GetValues(CommandLineOptionType.Port);
19✔
30
            if (values != null) settings!.Port = int.Parse(values[0]);
20✔
31

32
            values = parser.GetValues(CommandLineOptionType.SocketReadTimeout);
19✔
33
            if (values != null) settings!.SocketReadTimeout = int.Parse(values[0]);
20✔
34

35
            values = parser.GetValues(CommandLineOptionType.ApplicationTimeout);
19✔
36
            if (values != null) settings!.ApplicationTimeout = int.Parse(values[0]);
20✔
37

38
            values = parser.GetValues(CommandLineOptionType.RestartOnTimeout);
19✔
39
            if (values != null) settings!.RestartOnTimeout = bool.Parse(values[0]);
20✔
40

41
            values = parser.GetValues(CommandLineOptionType.TimeToRecent);
19✔
42
            if (values != null) settings!.TimeToRecent = int.Parse(values[0]);
20✔
43

44
            values = parser.GetValues(CommandLineOptionType.TimeToStale);
19✔
45
            if (values != null) settings!.TimeToStale = int.Parse(values[0]);
20✔
46

47
            values = parser.GetValues(CommandLineOptionType.TimeToRemoval);
19✔
48
            if (values != null) settings!.TimeToRemoval = int.Parse(values[0]);
20✔
49

50
            values = parser.GetValues(CommandLineOptionType.TimeToLock);
19✔
51
            if (values != null) settings!.TimeToLock = int.Parse(values[0]);
20✔
52

53
            values = parser.GetValues(CommandLineOptionType.LogFile);
19✔
54
            if (values != null) settings!.LogFile = values[0];
20✔
55

56
            values = parser.GetValues(CommandLineOptionType.MinimumLogLevel);
19✔
57
            if (values != null && Enum.TryParse<Severity>(values[0], out Severity minimumLogLevel))
19✔
58
            {
1✔
59
                settings!.MinimumLogLevel = minimumLogLevel;
1✔
60
            }
1✔
61

62
            values = parser.GetValues(CommandLineOptionType.EnableSqlWriter);
19✔
63
            if (values != null) settings!.EnableSqlWriter = bool.Parse(values[0]);
20✔
64

65
            values = parser.GetValues(CommandLineOptionType.WriterInterval);
19✔
66
            if (values != null) settings!.WriterInterval = int.Parse(values[0]);
20✔
67

68
            values = parser.GetValues(CommandLineOptionType.WriterBatchSize);
19✔
69
            if (values != null) settings!.WriterBatchSize = int.Parse(values[0]);
20✔
70

71
            values = parser.GetValues(CommandLineOptionType.RefreshInterval);
19✔
72
            if (values != null) settings!.RefreshInterval = int.Parse(values[0]);
20✔
73

74
            values = parser.GetValues(CommandLineOptionType.MaximumRows);
19✔
75
            if (values != null) settings!.MaximumRows = int.Parse(values[0]);
20✔
76

77
            values = parser.GetValues(CommandLineOptionType.ReceiverLatitude);
19✔
78
            if (values != null) settings!.ReceiverLatitude = double.Parse(values[0]);
20✔
79

80
            values = parser.GetValues(CommandLineOptionType.ReceiverLongitude);
19✔
81
            if (values != null) settings!.ReceiverLongitude = double.Parse(values[0]);
20✔
82
            
83
            values = parser.GetValues(CommandLineOptionType.MaximumTrackedDistance);
19✔
84
            if (values != null) settings!.MaximumTrackedDistance = int.Parse(values[0]);
19!
85

86
            values = parser.GetValues(CommandLineOptionType.MaximumTrackedAltitude);
19✔
87
            if (values != null) settings!.MaximumTrackedAltitude = int.Parse(values[0]);
19!
88

89
            values = parser.GetValues(CommandLineOptionType.TrackedBehaviours);
19✔
90
            if (values != null)
19!
NEW
91
            {
×
NEW
92
                settings!.TrackedBehaviours = values[0]
×
NEW
93
                    .Split(',', StringSplitOptions.RemoveEmptyEntries)
×
NEW
94
                    .Select(s => Enum.Parse<AircraftBehaviour>(s))
×
NEW
95
                    .ToList();
×
NEW
96
            }
×
97

98
            return settings;
19✔
99
        }
19✔
100
    }
101
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc