Code changes in Planefeeds

Included zlib.dll project
pull/1/head
dl2alf 2019-03-21 12:25:33 +01:00
rodzic faca122f83
commit 00b34f156b
25 zmienionych plików z 407 dodań i 347 usunięć

Wyświetl plik

@ -69,6 +69,14 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AirScout.Aircrafts\AirScout.Aircrafts.csproj">
<Project>{288a26ec-b690-41a2-84e5-61c9b7b74046}</Project>
<Name>AirScout.Aircrafts</Name>
</ProjectReference>
<ProjectReference Include="..\AirScout.Core\AirScout.Core.csproj">
<Project>{41b66be4-6086-4ae3-be31-c81ee6b10154}</Project>
<Name>AirScout.Core</Name>
</ProjectReference>
<ProjectReference Include="..\ScoutBase\ScoutBase.Core\ScoutBase.Core.csproj">
<Project>{ee86e933-d883-4b18-80eb-0fba55ec67c6}</Project>
<Name>ScoutBase.Core</Name>

Wyświetl plik

@ -12,6 +12,8 @@ using System.Data.SQLite;
using System.ComponentModel;
using System.Windows.Forms;
using Newtonsoft.Json;
using AirScout.Core;
using AirScout.Aircrafts;
namespace AirScout.AircraftPositions
{
@ -934,6 +936,98 @@ namespace AirScout.AircraftPositions
#endregion
#region PlaneInfo
public int PlaneInfoBulkInsertOrUpdateIfNewer(List<PlaneInfo> planes)
{
if (planes == null)
return 0;
int i = 0;
lock (db)
{
db.BeginTransaction();
foreach (PlaneInfo plane in planes)
{
try
{
// update aircraft information
if (PlaneInfoChecker.Check_Hex(plane.Hex) && PlaneInfoChecker.Check_Call(plane.Call))
AircraftPositionData.Database.AircraftPositionInsertOrUpdateIfNewer(new AircraftPositionDesignator(plane.Hex, plane.Call, plane.Lat, plane.Lon, plane.Alt, plane.Track, plane.Speed, plane.Time));
}
catch (Exception ex)
{
Log.WriteMessage(ex.ToString());
return -1;
}
}
db.Commit();
}
return i;
}
public int PlaneInfoBulkInsertOrUpdateIfNewer(BackgroundWorker caller, List<PlaneInfo> planes)
{
if (planes == null)
return 0;
int i = 0;
lock (db)
{
db.BeginTransaction();
foreach (PlaneInfo plane in planes)
{
try
{
// update aircraft information
if (PlaneInfoChecker.Check_Hex(plane.Hex) && PlaneInfoChecker.Check_Call(plane.Call))
AircraftPositionData.Database.AircraftPositionInsertOrUpdateIfNewer(new AircraftPositionDesignator(plane.Hex, plane.Call, plane.Lat, plane.Lon, plane.Alt, plane.Track, plane.Speed, plane.Time));
}
catch (Exception ex)
{
db.Rollback();
Log.WriteMessage(ex.ToString());
return -1;
}
// abort if called from background worker and cancellation pending
if (caller != null)
{
if (caller.WorkerSupportsCancellation && caller.CancellationPending)
{
db.Rollback();
return -1;
}
}
}
db.Commit();
}
return i;
}
public List<PlaneInfo> PlaneInfoGetAll(DateTime newerthan)
{
List<PlaneInfo> l = new List<PlaneInfo>();
int i = SupportFunctions.DateTimeToUNIXTime(newerthan);
// SELECT max(AircraftPositions.Lastupdated) AS LastUpdated, Call, Reg, AircraftPositions.Hex, Lat, Lon, Track, Alt, Speed, TypeCode, Manufacturer, Model, Category FROM AircraftPositions INNER JOIN Aircrafts ON AircraftPositions.Hex = Aircrafts.Hex INNER JOIN AircraftTypes ON AircraftTypes.ICAO = Aircrafts.TypeCode WHERE AircraftPositions.LastUpdated > 1500000 GROUP BY AircraftPositions.Hex
DataTable Result = db.Select("SELECT max(AircraftPositions.Lastupdated) AS LastUpdated, Call, Reg, AircraftPositions.Hex, Lat, Lon, Track, Alt, Speed, TypeCode, Manufacturer, Model, Category FROM AircraftPositions INNER JOIN Aircrafts ON AircraftPositions.Hex = Aircrafts.Hex INNER JOIN AircraftTypes ON AircraftTypes.ICAO = Aircrafts.TypeCode WHERE AircraftPositions.LastUpdated > " + i.ToString() + " GROUP BY AircraftPositions.Hex");
if (!IsValid(Result) || (Result.Rows.Count == 0))
return l;
foreach (DataRow row in Result.Rows)
{
PlaneInfo info = new PlaneInfo(row);
try
{
l.Add(info);
}
catch (Exception ex)
{
Log.WriteMessage("Error inserting PlaneInfo[" + info.ToString() + "]: " + ex.ToString());
}
}
return l;
}
#endregion
}
}

Wyświetl plik

@ -56,8 +56,7 @@
<Compile Include="AircraftType.cs" />
<Compile Include="Aircraft.cs" />
<Compile Include="AircraftDatabaseUpdater.cs" />
<Compile Include="PlaneCategory.cs" />
<Compile Include="PlaneInfo.cs" />
<Compile Include="PlaneInfoChecker.cs" />
<Compile Include="PlaneInfoCache.cs" />
<Compile Include="PlaneInfoConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -69,6 +68,10 @@
<Compile Include="AircraftDatabase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AirScout.Core\AirScout.Core.csproj">
<Project>{41b66be4-6086-4ae3-be31-c81ee6b10154}</Project>
<Name>AirScout.Core</Name>
</ProjectReference>
<ProjectReference Include="..\ScoutBase\ScoutBase.Core\ScoutBase.Core.csproj">
<Project>{ee86e933-d883-4b18-80eb-0fba55ec67c6}</Project>
<Name>ScoutBase.Core</Name>

Wyświetl plik

@ -12,6 +12,7 @@ using System.Data.SQLite;
using Newtonsoft.Json;
using System.Windows.Forms;
using System.ComponentModel;
using AirScout.Core;
namespace AirScout.Aircrafts
{
@ -2392,7 +2393,7 @@ namespace AirScout.Aircrafts
try
{
// update aircraft information
if (PlaneInfo.Check_Hex(plane.Hex) && PlaneInfo.Check_Call(plane.Call) && PlaneInfo.Check_Reg(plane.Reg) && PlaneInfo.Check_Type(plane.Type))
if (PlaneInfoChecker.Check_Hex(plane.Hex) && PlaneInfoChecker.Check_Call(plane.Call) && PlaneInfoChecker.Check_Reg(plane.Reg) && PlaneInfoChecker.Check_Type(plane.Type))
AircraftData.Database.AircraftInsertOrUpdateIfNewer(new AircraftDesignator(plane.Hex, plane.Call, plane.Reg, plane.Type, plane.Time));
// update aircraft type information
if (!String.IsNullOrEmpty(plane.Type))

Wyświetl plik

@ -12,6 +12,7 @@ using System.Data;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Data.SQLite;
using AirScout.Core;
namespace AirScout.Aircrafts
{

Wyświetl plik

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AirScout.Core;
namespace AirScout.Aircrafts
{

Wyświetl plik

@ -1,206 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading;
using System.ComponentModel;
using System.Globalization;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
using ScoutBase.Core;
using System.Reflection;
using AirScout.Core;
namespace AirScout.Aircrafts
{
// holds the complete aircraft info
public class PlaneInfo
public static class PlaneInfoChecker
{
public DateTime Time { get; set; }
public string Call { get; set; }
public string Reg { get; set; }
public string Hex { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
private double _Alt;
public double Alt
{
get
{
return _Alt;
}
set
{
_Alt = value;
_Alt_m = UnitConverter.ft_m(value);
}
}
private double _Alt_m;
public double Alt_m
{
get
{
return _Alt_m;
}
}
public double Track = 0;
private double _Speed;
public double Speed
{
get
{
return _Speed;
}
set
{
_Speed = value;
_Speed_kmh = UnitConverter.kts_kmh(value);
}
}
private double _Speed_kmh;
public double Speed_kmh
{
get
{
return _Speed_kmh;
}
}
public string Type { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public PLANECATEGORY Category { get; set; }
public LatLon.GPoint IntPoint = null;
public double IntQRB = double.MaxValue;
public double AltDiff = 0;
public int Potential = 0;
public double Eps1 = 0;
public double Eps2 = 0;
public double Theta1 = 0;
public double Theta2 = 0;
public double Angle = 0;
public double Squint = 0;
public double SignalStrength = double.MinValue;
public bool Ambiguous = false;
public string Comment = "";
public PlaneInfo()
{
Time = DateTime.UtcNow;
Call = "";
Reg = "";
Hex = "";
Lat = 0;
Lon = 0;
Alt = 0;
Track = 0;
Speed = 0;
Type = "";
Manufacturer = "";
Model = "";
Category = PLANECATEGORY.NONE;
}
public PlaneInfo(DateTime time, string call, string reg, string hex, double lat, double lon, double track, double alt, double speed, string type, string manufacturer, string model, PLANECATEGORY category)
{
Time = time.ToUniversalTime();
Call = call;
Reg = reg;
Hex = hex;
Lat = lat;
Lon = lon;
Alt = alt;
Track = track;
Speed = speed;
Type = type;
Manufacturer = manufacturer;
Model = model;
Category = category;
}
// LEGACY!!!
public PlaneInfo (DataRow row)
{
Time = SupportFunctions.UNIXTimeToDateTime(System.Convert.ToInt32(row[0]));
Call = (string)row[1];
Reg = (string)row[2];
Hex = (string)row[3];
Lat = (double)row[4];
Lon = (double)row[5];
Track = System.Convert.ToInt32(row[6]);
Alt = System.Convert.ToInt32(row[7]);
Speed = System.Convert.ToInt32(row[8]);
Type = (string)row[9];
Manufacturer = (string)row[10];
Model = (string)row[11];
Category = (PLANECATEGORY)row[12];
}
public PlaneInfo (PlaneInfo plane)
{
this.Ambiguous = plane.Ambiguous;
this.Alt = plane.Alt;
this.AltDiff = plane.AltDiff;
this.Angle = plane.Angle;
this.Call = plane.Call;
this.Category = plane.Category;
this.Comment = plane.Comment;
this.Eps1 = plane.Eps1;
this.Eps2 = plane.Eps2;
this.Theta1 = plane.Theta1;
this.Theta2 = plane.Theta2;
this.Hex = plane.Hex;
this.IntPoint = plane.IntPoint;
this.IntQRB = plane.IntQRB;
this.Lat = plane.Lat;
this.Lon = plane.Lon;
this.Manufacturer = plane.Manufacturer;
this.Model = plane.Model;
this.Potential = plane.Potential;
this.Reg = plane.Reg;
this.SignalStrength = plane.SignalStrength;
this.Speed = plane.Speed;
this.Squint = plane.Squint;
this.Time = plane.Time;
this.Track = plane.Track;
this.Type = plane.Type;
}
public override string ToString()
{
string s = "";
PropertyInfo[] properties = this.GetType().GetProperties();
foreach (PropertyInfo p in properties)
{
if (p.PropertyType.Name.ToUpper() == "STRING")
{
string v = (string)p.GetValue(this, null);
if (v == null)
v = "[null]";
else if (v.Length == 0)
v = "[empty]";
s = s + p.Name + ": " + v + "\n";
}
else if (p.PropertyType.Name.ToUpper() == "DATETIME")
{
DateTime dt = (DateTime)p.GetValue(this, null);
s = s + p.Name + ": " + dt.ToString("yyyy-MM-dd HH:mm:ss") + "\n";
}
else
{
object o = p.GetValue(this, null);
if (o == null)
s = s + p.Name + ": " + "[null]" + "\n";
else
s = s + p.Name + ": " + o.ToString() + "\n";
}
}
return s;
}
public static bool Check_Hex(string hex)
{
@ -246,7 +53,7 @@ namespace AirScout.Aircrafts
// Type B callsign?
if (char.IsNumber(call[2]))
{
airline = call.Substring(0,2);
airline = call.Substring(0, 2);
if (AircraftData.Database.AirlineFindByIATA(airline) == null)
return false;
}
@ -394,5 +201,4 @@ namespace AirScout.Aircrafts
}
}
}
}

Wyświetl plik

@ -47,6 +47,8 @@
<ItemGroup>
<Compile Include="BandSettings.cs" />
<Compile Include="Enums.cs" />
<Compile Include="PlaneCategory.cs" />
<Compile Include="PlaneInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>

Wyświetl plik

@ -5,7 +5,7 @@ using System.Text;
using ScoutBase.Core;
using System.Reflection;
namespace AirScout.Aircrafts
namespace AirScout.Core
{
public enum PLANECATEGORY
{

Wyświetl plik

@ -0,0 +1,207 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading;
using System.ComponentModel;
using System.Globalization;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
using ScoutBase.Core;
using System.Reflection;
namespace AirScout.Core
{
// holds the complete aircraft info
public class PlaneInfo
{
public DateTime Time { get; set; }
public string Call { get; set; }
public string Reg { get; set; }
public string Hex { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
private double _Alt;
public double Alt
{
get
{
return _Alt;
}
set
{
_Alt = value;
_Alt_m = UnitConverter.ft_m(value);
}
}
private double _Alt_m;
public double Alt_m
{
get
{
return _Alt_m;
}
}
public double Track = 0;
private double _Speed;
public double Speed
{
get
{
return _Speed;
}
set
{
_Speed = value;
_Speed_kmh = UnitConverter.kts_kmh(value);
}
}
private double _Speed_kmh;
public double Speed_kmh
{
get
{
return _Speed_kmh;
}
}
public string Type { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public PLANECATEGORY Category { get; set; }
public LatLon.GPoint IntPoint = null;
public double IntQRB = double.MaxValue;
public double AltDiff = 0;
public int Potential = 0;
public double Eps1 = 0;
public double Eps2 = 0;
public double Theta1 = 0;
public double Theta2 = 0;
public double Angle = 0;
public double Squint = 0;
public double SignalStrength = double.MinValue;
public bool Ambiguous = false;
public string Comment = "";
public PlaneInfo()
{
Time = DateTime.UtcNow;
Call = "";
Reg = "";
Hex = "";
Lat = 0;
Lon = 0;
Alt = 0;
Track = 0;
Speed = 0;
Type = "";
Manufacturer = "";
Model = "";
Category = PLANECATEGORY.NONE;
}
public PlaneInfo(DateTime time, string call, string reg, string hex, double lat, double lon, double track, double alt, double speed, string type, string manufacturer, string model, PLANECATEGORY category)
{
Time = time.ToUniversalTime();
Call = call;
Reg = reg;
Hex = hex;
Lat = lat;
Lon = lon;
Alt = alt;
Track = track;
Speed = speed;
Type = type;
Manufacturer = manufacturer;
Model = model;
Category = category;
}
// LEGACY!!!
public PlaneInfo (DataRow row)
{
Time = SupportFunctions.UNIXTimeToDateTime(System.Convert.ToInt32(row[0]));
Call = (string)row[1];
Reg = (string)row[2];
Hex = (string)row[3];
Lat = (double)row[4];
Lon = (double)row[5];
Track = System.Convert.ToInt32(row[6]);
Alt = System.Convert.ToInt32(row[7]);
Speed = System.Convert.ToInt32(row[8]);
Type = (string)row[9];
Manufacturer = (string)row[10];
Model = (string)row[11];
Category = (PLANECATEGORY)row[12];
}
public PlaneInfo (PlaneInfo plane)
{
this.Ambiguous = plane.Ambiguous;
this.Alt = plane.Alt;
this.AltDiff = plane.AltDiff;
this.Angle = plane.Angle;
this.Call = plane.Call;
this.Category = plane.Category;
this.Comment = plane.Comment;
this.Eps1 = plane.Eps1;
this.Eps2 = plane.Eps2;
this.Theta1 = plane.Theta1;
this.Theta2 = plane.Theta2;
this.Hex = plane.Hex;
this.IntPoint = plane.IntPoint;
this.IntQRB = plane.IntQRB;
this.Lat = plane.Lat;
this.Lon = plane.Lon;
this.Manufacturer = plane.Manufacturer;
this.Model = plane.Model;
this.Potential = plane.Potential;
this.Reg = plane.Reg;
this.SignalStrength = plane.SignalStrength;
this.Speed = plane.Speed;
this.Squint = plane.Squint;
this.Time = plane.Time;
this.Track = plane.Track;
this.Type = plane.Type;
}
public override string ToString()
{
string s = "";
PropertyInfo[] properties = this.GetType().GetProperties();
foreach (PropertyInfo p in properties)
{
if (p.PropertyType.Name.ToUpper() == "STRING")
{
string v = (string)p.GetValue(this, null);
if (v == null)
v = "[null]";
else if (v.Length == 0)
v = "[empty]";
s = s + p.Name + ": " + v + "\n";
}
else if (p.PropertyType.Name.ToUpper() == "DATETIME")
{
DateTime dt = (DateTime)p.GetValue(this, null);
s = s + p.Name + ": " + dt.ToString("yyyy-MM-dd HH:mm:ss") + "\n";
}
else
{
object o = p.GetValue(this, null);
if (o == null)
s = s + p.Name + ": " + "[null]" + "\n";
else
s = s + p.Name + ": " + o.ToString() + "\n";
}
}
return s;
}
}
}

Wyświetl plik

@ -10,6 +10,7 @@ using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using LibADSB;
@ -340,6 +341,9 @@ namespace AirScout.PlaneFeeds
MinAlt = args.MinAlt;
MaxAlt = args.MaxAlt;
// keep history settings from arguments
KeepHistory = args.KeepHistory;
// check boundaries
if ((MaxLat <= MinLat) || (MaxLon <= MinLon))
{

Wyświetl plik

@ -107,6 +107,10 @@
<Project>{288a26ec-b690-41a2-84e5-61c9b7b74046}</Project>
<Name>AirScout.Aircrafts</Name>
</ProjectReference>
<ProjectReference Include="..\AirScout.Core\AirScout.Core.csproj">
<Project>{41b66be4-6086-4ae3-be31-c81ee6b10154}</Project>
<Name>AirScout.Core</Name>
</ProjectReference>
<ProjectReference Include="..\ScoutBase\ScoutBase.Core\ScoutBase.Core.csproj">
<Project>{EE86E933-D883-4B18-80EB-0FBA55EC67C6}</Project>
<Name>ScoutBase.Core</Name>

Wyświetl plik

@ -9,6 +9,7 @@ using System.Windows;
using System.Globalization;
using System.Net;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using ScoutBase.Core;

Wyświetl plik

@ -11,6 +11,7 @@ using System.Net;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using Newtonsoft.Json;

Wyświetl plik

@ -9,6 +9,7 @@ using System.Windows;
using System.Globalization;
using System.Net;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using ScoutBase.Core;

Wyświetl plik

@ -12,6 +12,7 @@ using System.Net;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using Newtonsoft.Json;

Wyświetl plik

@ -11,6 +11,7 @@ using System.Globalization;
using System.Net;
using System.IO;
using System.Xml.Serialization;
using AirScout.Core;
using AirScout.Aircrafts;
using ScoutBase.Core;
@ -206,6 +207,10 @@ namespace AirScout.PlaneFeeds.Generic
MinAlt = args.MinAlt;
MaxAlt = args.MaxAlt;
// keep history settings from arguments
KeepHistory = args.KeepHistory;
Status = STATUS.OK;
// narrow args according to QSO partners
@ -270,7 +275,8 @@ namespace AirScout.PlaneFeeds.Generic
planes.Add(info);
}
ReportProgress((int)PROGRESS.PLANES, planes);
AircraftData.Database.PlaneInfoBulkInsertOrUpdateIfNewer(planes);
// do not update anything in database
// AircraftData.Database.PlaneInfoBulkInsertOrUpdateIfNewer(planes);
string msg = "[" + start.ToString("HH:mm:ss") + "] " +
count.ToString() + " Positions randomized.";
this.ReportProgress((int)PROGRESS.STATUS, msg);

Wyświetl plik

@ -9,6 +9,7 @@ using System.Windows;
using System.Globalization;
using System.Net;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using Newtonsoft.Json;

Wyświetl plik

@ -10,6 +10,7 @@ using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using LibADSB;

Wyświetl plik

@ -9,7 +9,9 @@ using System.Windows;
using System.Globalization;
using System.Net;
using System.IO;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.AircraftPositions;
using AirScout.PlaneFeeds.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -224,7 +226,6 @@ namespace AirScout.PlaneFeeds
LogDirectory = args.LogDirectory;
TmpDirectory = args.TmpDirectory;
DatabaseDirectory = args.DatabaseDirectory;
KeepHistory = args.KeepHistory;
// set boundaries from arguments
MaxLat = args.MaxLat;
@ -238,6 +239,9 @@ namespace AirScout.PlaneFeeds
MinAlt = args.MinAlt;
MaxAlt = args.MaxAlt;
// keep history settings from arguments
KeepHistory = args.KeepHistory;
// intialize variables
VC.AddVar("APPDIR", AppDirectory);
VC.AddVar("DATADIR", AppDataDirectory);
@ -369,7 +373,7 @@ namespace AirScout.PlaneFeeds
// get hex first
plane.Hex = ReadPropertyString(o, "Icao");
// do basic check on hex --> is strictly needed as identifier
if (!PlaneInfo.Check_Hex(plane.Hex))
if (!PlaneInfoChecker.Check_Hex(plane.Hex))
{
if (Properties.Settings.Default.VR_LogErrors)
Log.WriteMessage("Incorrect aircraft data received [Hex]: " + plane.Hex);
@ -378,7 +382,7 @@ namespace AirScout.PlaneFeeds
}
// get position and do basic check on lat/lon
plane.Lat = ReadPropertyDouble(o, "Lat");
if (!PlaneInfo.Check_Lat(plane.Lat))
if (!PlaneInfoChecker.Check_Lat(plane.Lat))
{
if (Properties.Settings.Default.VR_LogErrors)
Log.WriteMessage("Incorrect aircraft data received [Lat]: " + plane.Lat.ToString("F8", CultureInfo.InvariantCulture));
@ -386,7 +390,7 @@ namespace AirScout.PlaneFeeds
continue;
}
plane.Lon = ReadPropertyDouble(o, "Long");
if (!PlaneInfo.Check_Lon(plane.Lon))
if (!PlaneInfoChecker.Check_Lon(plane.Lon))
{
if (Properties.Settings.Default.VR_LogErrors)
Log.WriteMessage("Incorrect aircraft data received [Lon]: " + plane.Lon.ToString("F8", CultureInfo.InvariantCulture));
@ -397,7 +401,7 @@ namespace AirScout.PlaneFeeds
// 2017-07-23: take "GAlt" (corrected altitude by air pressure) rather than "Alt"
plane.Alt = ReadPropertyDoubleToInt(o, "GAlt");
// do basic chekc on altitude
if (!PlaneInfo.Check_Alt(plane.Alt))
if (!PlaneInfoChecker.Check_Alt(plane.Alt))
{
// try to recover altitude from previuos messages
PlaneInfo info = null;
@ -421,7 +425,7 @@ namespace AirScout.PlaneFeeds
// get callsign
plane.Call = ReadPropertyString(o, "Call");
// do basic check --> try to recover from cache if check fails or set it to [unknown]
if (!PlaneInfo.Check_Call(plane.Call))
if (!PlaneInfoChecker.Check_Call(plane.Call))
{
PlaneInfo info = null;
if (PlanePositions.TryGetValue(plane.Hex, out info))
@ -432,7 +436,7 @@ namespace AirScout.PlaneFeeds
plane.Call = "[unknown]";
}
// still unknown --> try to recover last known call from database
if (!PlaneInfo.Check_Call(plane.Call))
if (!PlaneInfoChecker.Check_Call(plane.Call))
{
AircraftDesignator ad = AircraftData.Database.AircraftFindByHex(plane.Hex);
if (ad != null)
@ -445,7 +449,7 @@ namespace AirScout.PlaneFeeds
// get registration
plane.Reg = ReadPropertyString(o, "Reg");
// do basic check --> try to recover from cache if check fails or set it to [unknown]
if (!PlaneInfo.Check_Reg(plane.Reg))
if (!PlaneInfoChecker.Check_Reg(plane.Reg))
{
PlaneInfo info = null;
if (PlanePositions.TryGetValue(plane.Hex, out info))
@ -456,7 +460,7 @@ namespace AirScout.PlaneFeeds
plane.Reg = "[unknown]";
}
// still unknown --> try to recover last known reg from database
if (!PlaneInfo.Check_Reg(plane.Reg))
if (!PlaneInfoChecker.Check_Reg(plane.Reg))
{
AircraftDesignator ad = AircraftData.Database.AircraftFindByHex(plane.Hex);
if (ad != null)
@ -469,7 +473,7 @@ namespace AirScout.PlaneFeeds
// get track
plane.Track = ReadPropertyDoubleToInt(o, "Trak");
// do basic check
if (!PlaneInfo.Check_Track(plane.Track))
if (!PlaneInfoChecker.Check_Track(plane.Track))
{
if (Properties.Settings.Default.VR_LogErrors)
Log.WriteMessage("Incorrect aircraft data received [Track]: " + plane.Track.ToString("F8", CultureInfo.InvariantCulture));
@ -479,7 +483,7 @@ namespace AirScout.PlaneFeeds
// get speed
plane.Speed = ReadPropertyDoubleToInt(o, "Spd");
// do basic check
if (!PlaneInfo.Check_Speed(plane.Speed))
if (!PlaneInfoChecker.Check_Speed(plane.Speed))
{
// try to recover speed from previous messages
PlaneInfo info = null;
@ -516,7 +520,7 @@ namespace AirScout.PlaneFeeds
}
// get type info
plane.Type = ReadPropertyString(o, "Type");
if (!PlaneInfo.Check_Type(plane.Type))
if (!PlaneInfoChecker.Check_Type(plane.Type))
{
AircraftDesignator ad = AircraftData.Database.AircraftFindByHex(plane.Hex);
if (ad != null)
@ -539,7 +543,7 @@ namespace AirScout.PlaneFeeds
if (plane.Type == "A388")
plane.Category = PLANECATEGORY.SUPERHEAVY;
// try to recover type info from database if check fails
if (!PlaneInfo.Check_Manufacturer(plane.Manufacturer) || !PlaneInfo.Check_Model(plane.Model))
if (!PlaneInfoChecker.Check_Manufacturer(plane.Manufacturer) || !PlaneInfoChecker.Check_Model(plane.Model))
{
AircraftTypeDesignator td = AircraftData.Database.AircraftTypeFindByICAO(plane.Type);
if (td != null)
@ -592,6 +596,9 @@ namespace AirScout.PlaneFeeds
this.ReportProgress((int)PROGRESS.PLANES, planes);
// update global database
AircraftData.Database.PlaneInfoBulkInsertOrUpdateIfNewer(this, planes);
// update position database if enabled
if (KeepHistory)
AircraftPositionData.Database.PlaneInfoBulkInsertOrUpdateIfNewer(planes);
st.Stop();
string msg = "[" + DateTime.UtcNow.ToString("HH:mm:ss") + "] " +
total.ToString() + " Positions updated from " + url + ", " +

Wyświetl plik

@ -12,6 +12,7 @@ using System.IO;
using System.Data;
using System.Windows.Forms;
using System.Xml.Serialization;
using AirScout.Core;
using AirScout.Aircrafts;
using AirScout.PlaneFeeds.Generic;
using Newtonsoft.Json;

Wyświetl plik

@ -6301,7 +6301,7 @@ namespace AirScout
{
info.Time = DateTime.MinValue;
}
if (PlaneInfo.Check(info) &&
if (PlaneInfoChecker.Check(info) &&
(info.Alt_m >= Properties.Settings.Default.Planes_MinAlt) &&
(info.Alt_m <= Properties.Settings.Default.Planes_MaxAlt) &&
(info.Lat >= Properties.Settings.Default.MinLat) &&

Wyświetl plik

@ -155,30 +155,6 @@ namespace AirScout.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\Database\\calls.txt")]
public string Calls_FileName {
get {
return ((string)(this["Calls_FileName"]));
}
set {
this["Calls_FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\Database\\call3.txt")]
public string WSJTCalls_FileName {
get {
return ((string)(this["WSJTCalls_FileName"]));
}
set {
this["WSJTCalls_FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1000")]
@ -206,9 +182,9 @@ namespace AirScout.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("NONE")]
public global::AirScout.Aircrafts.PLANECATEGORY Planes_Filter_Min_Category {
public global::AirScout.Core.PLANECATEGORY Planes_Filter_Min_Category {
get {
return ((global::AirScout.Aircrafts.PLANECATEGORY)(this["Planes_Filter_Min_Category"]));
return ((global::AirScout.Core.PLANECATEGORY)(this["Planes_Filter_Min_Category"]));
}
set {
this["Planes_Filter_Min_Category"] = value;
@ -443,18 +419,6 @@ namespace AirScout.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Database\\localobstructions.txt")]
public string LocalObstruction_FileName {
get {
return ((string)(this["LocalObstruction_FileName"]));
}
set {
this["LocalObstruction_FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
@ -1391,30 +1355,6 @@ namespace AirScout.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\Database\\Airlines.txt")]
public string Database_Airlines_FileName {
get {
return ((string)(this["Database_Airlines_FileName"]));
}
set {
this["Database_Airlines_FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://www.flugzeuginfo.net/table_airlinecodes_airline_en.php")]
public string Database_Airlines_URL {
get {
return ((string)(this["Database_Airlines_URL"]));
}
set {
this["Database_Airlines_URL"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
@ -1547,18 +1487,6 @@ namespace AirScout.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\Database")]
public string Database_Directory {
get {
return ((string)(this["Database_Directory"]));
}
set {
this["Database_Directory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("10")]
@ -1595,18 +1523,6 @@ namespace AirScout.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\ElevationData")]
public string Elevation_Directory {
get {
return ((string)(this["Elevation_Directory"]));
}
set {
this["Elevation_Directory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::AirScout.Watchlist Watchlist {
@ -1948,7 +1864,6 @@ Digital data base on the World Wide Web (URL: http://www.ngdc.noaa.gov/mgg/topo/
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("DL2ALF")]
public global::System.Collections.Generic.List<System.String> MyCalls {
get {
return ((global::System.Collections.Generic.List<System.String>)(this["MyCalls"]));
@ -2113,5 +2028,29 @@ Digital data base on the World Wide Web (URL: http://www.ngdc.noaa.gov/mgg/topo/
this["Planes_KeepHistory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\Database")]
public string Database_Directory {
get {
return ((string)(this["Database_Directory"]));
}
set {
this["Database_Directory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("\\ElevationData")]
public string Elevation_Directory {
get {
return ((string)(this["Elevation_Directory"]));
}
set {
this["Elevation_Directory"] = value;
}
}
}
}

Wyświetl plik

@ -35,12 +35,6 @@
<Setting Name="DXHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">30</Value>
</Setting>
<Setting Name="Calls_FileName" Type="System.String" Scope="User">
<Value Profile="(Default)">\Database\calls.txt</Value>
</Setting>
<Setting Name="WSJTCalls_FileName" Type="System.String" Scope="User">
<Value Profile="(Default)">\Database\call3.txt</Value>
</Setting>
<Setting Name="Watchlist_MaxCount" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1000</Value>
</Setting>
@ -107,9 +101,6 @@
<Setting Name="Alarm_Activate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="LocalObstruction_FileName" Type="System.String" Scope="User">
<Value Profile="(Default)">Database\localobstructions.txt</Value>
</Setting>
<Setting Name="Path_Cubic_Spline" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
@ -344,12 +335,6 @@
<Setting Name="Airports_Activate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Database_Airlines_FileName" Type="System.String" Scope="User">
<Value Profile="(Default)">\Database\Airlines.txt</Value>
</Setting>
<Setting Name="Database_Airlines_URL" Type="System.String" Scope="User">
<Value Profile="(Default)">http://www.flugzeuginfo.net/table_airlinecodes_airline_en.php</Value>
</Setting>
<Setting Name="Map_Update" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
@ -383,9 +368,6 @@
<Setting Name="Log_Directory" Type="System.String" Scope="User">
<Value Profile="(Default)">\Log</Value>
</Setting>
<Setting Name="Database_Directory" Type="System.String" Scope="User">
<Value Profile="(Default)">\Database</Value>
</Setting>
<Setting Name="Locator_MaxLength" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">10</Value>
</Setting>
@ -395,9 +377,6 @@
<Setting Name="Locator_SmallLettersForSubsquares" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Elevation_Directory" Type="System.String" Scope="User">
<Value Profile="(Default)">\ElevationData</Value>
</Setting>
<Setting Name="Watchlist" Type="AirScout.Watchlist" Scope="User">
<Value Profile="(Default)" />
</Setting>
@ -515,7 +494,7 @@ MEaSUREs data and products are available at no charge from the LP DAAC.See https
<Value Profile="(Default)" />
</Setting>
<Setting Name="MyCalls" Type="System.Collections.Generic.List&lt;System.String&gt;" Scope="User">
<Value Profile="(Default)">DL2ALF</Value>
<Value Profile="(Default)" />
</Setting>
<Setting Name="Map_SmallMarkers" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
@ -556,5 +535,11 @@ MEaSUREs data and products are available at no charge from the LP DAAC.See https
<Setting Name="Planes_KeepHistory" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Database_Directory" Type="System.String" Scope="User">
<Value Profile="(Default)">\Database</Value>
</Setting>
<Setting Name="Elevation_Directory" Type="System.String" Scope="User">
<Value Profile="(Default)">\ElevationData</Value>
</Setting>
</Settings>
</SettingsFile>

Wyświetl plik

@ -42,12 +42,6 @@
<setting name="DXHeight" serializeAs="String">
<value>30</value>
</setting>
<setting name="Calls_FileName" serializeAs="String">
<value>\Database\calls.txt</value>
</setting>
<setting name="WSJTCalls_FileName" serializeAs="String">
<value>\Database\call3.txt</value>
</setting>
<setting name="Watchlist_MaxCount" serializeAs="String">
<value>1000</value>
</setting>
@ -114,9 +108,6 @@
<setting name="Alarm_Activate" serializeAs="String">
<value>False</value>
</setting>
<setting name="LocalObstruction_FileName" serializeAs="String">
<value>Database\localobstructions.txt</value>
</setting>
<setting name="Path_Cubic_Spline" serializeAs="String">
<value>True</value>
</setting>
@ -351,12 +342,6 @@
<setting name="Airports_Activate" serializeAs="String">
<value>True</value>
</setting>
<setting name="Database_Airlines_FileName" serializeAs="String">
<value>\Database\Airlines.txt</value>
</setting>
<setting name="Database_Airlines_URL" serializeAs="String">
<value>http://www.flugzeuginfo.net/table_airlinecodes_airline_en.php</value>
</setting>
<setting name="Map_Update" serializeAs="String">
<value>1</value>
</setting>
@ -390,9 +375,6 @@
<setting name="Log_Directory" serializeAs="String">
<value>\Log</value>
</setting>
<setting name="Database_Directory" serializeAs="String">
<value>\Database</value>
</setting>
<setting name="Locator_MaxLength" serializeAs="String">
<value>10</value>
</setting>
@ -402,9 +384,6 @@
<setting name="Locator_SmallLettersForSubsquares" serializeAs="String">
<value>False</value>
</setting>
<setting name="Elevation_Directory" serializeAs="String">
<value>\ElevationData</value>
</setting>
<setting name="Connectivity_URL" serializeAs="String">
<value>http://www.airscout.eu</value>
</setting>
@ -554,6 +533,12 @@ MEaSUREs data and products are available at no charge from the LP DAAC.See https
<setting name="Planes_KeepHistory" serializeAs="String">
<value>False</value>
</setting>
<setting name="Database_Directory" serializeAs="String">
<value>\Database</value>
</setting>
<setting name="Elevation_Directory" serializeAs="String">
<value>\ElevationData</value>
</setting>
</AirScout.Properties.Settings>
</userSettings>
<startup>