Merge with V1.4.x (2)V1.3.3.6

pull/2/head
dl2alf 2022-01-02 09:22:23 +01:00
rodzic 36b8938a32
commit 5d83dce0a8
6 zmienionych plików z 2881 dodań i 2787 usunięć

Wyświetl plik

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben: // indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.1")] [assembly: AssemblyVersion("1.3.3.4")]
[assembly: AssemblyFileVersion("1.3.3.1")] [assembly: AssemblyFileVersion("1.3.3.4")]

Wyświetl plik

@ -74,7 +74,7 @@ namespace System.Net
throw new TimeoutException("Connection timed out."); throw new TimeoutException("Connection timed out.");
} }
while (!trailer.Contains("\r\n")); while (!trailer.Contains("\r\n"));
Console.WriteLine("Reading content [" + contentlength.ToString() + " bytes]: " + resp); // Console.WriteLine("Reading content [" + contentlength.ToString() + " bytes]: " + resp);
response += resp; response += resp;
return true; return true;
} }
@ -91,50 +91,57 @@ namespace System.Net
int contentlength = 0; int contentlength = 0;
// chunked transfer, first line should contain content length // chunked transfer, first line should contain content length
// read stream bytewise until CRLF is detected // read stream bytewise until CRLF is detected
do try
{ {
count = stream.Read(buff, 0, buff.Length); do
strcontentlength += Encoding.ASCII.GetString(buff, 0, buff.Length); {
if (st.ElapsedMilliseconds > timeout) count = stream.Read(buff, 0, buff.Length);
throw new TimeoutException("Connection timed out."); strcontentlength += Encoding.ASCII.GetString(buff, 0, buff.Length);
if (st.ElapsedMilliseconds > timeout)
throw new TimeoutException("Connection timed out.");
}
while (!strcontentlength.Contains("\r\n"));
strcontentlength = strcontentlength.Replace("\r\n", "");
contentlength = int.Parse(strcontentlength, System.Globalization.NumberStyles.HexNumber);
// finished reading all chunks
if (contentlength == 0)
{
Console.WriteLine("Reading chunked content finished");
return true;
}
int bytesread = 0;
// read content bytewise
while (bytesread < contentlength)
{
bytesread += stream.Read(buff, 0, buff.Length);
// add it to response
resp += Encoding.ASCII.GetString(buff, 0, buff.Length);
if (st.ElapsedMilliseconds > timeout)
throw new TimeoutException("Connection timed out.");
}
string trailer = "";
// reassign buffer
buff = new byte[1];
// read stream bytewise until CRLFCRLF is detected, should be the next two bytes
do
{
count = stream.Read(buff, 0, buff.Length);
trailer += Encoding.ASCII.GetString(buff, 0, buff.Length);
if (st.ElapsedMilliseconds > timeout)
throw new TimeoutException("Connection timed out.");
}
while (!trailer.Contains("\r\n"));
} }
while (!strcontentlength.Contains("\r\n")); catch (Exception ex)
strcontentlength = strcontentlength.Replace("\r\n", "");
contentlength = int.Parse(strcontentlength, System.Globalization.NumberStyles.HexNumber);
// finished reading all chunks
if (contentlength == 0)
{ {
Console.WriteLine("Reading chunked content finished"); Console.WriteLine("Error while reading chunked content: " + ex.Message);
return true;
} }
int bytesread = 0; // Console.WriteLine("Reading chunked content [" + contentlength.ToString() + " bytes]: " + resp);
// read content bytewise
while (bytesread < contentlength)
{
bytesread += stream.Read(buff, 0, buff.Length);
// add it to response
resp += Encoding.ASCII.GetString(buff, 0, buff.Length);
if (st.ElapsedMilliseconds > timeout)
throw new TimeoutException("Connection timed out.");
}
string trailer = "";
// reassign buffer
buff = new byte[1];
// read stream bytewise until CRLFCRLF is detected, should be the next two bytes
do
{
count = stream.Read(buff, 0, buff.Length);
trailer += Encoding.ASCII.GetString(buff, 0, buff.Length);
if (st.ElapsedMilliseconds > timeout)
throw new TimeoutException("Connection timed out.");
}
while (!trailer.Contains("\r\n"));
Console.WriteLine("Reading chunked content [" + contentlength.ToString() + " bytes]: " + resp);
response += resp; response += resp;
return false; return false;
} }
public static string DownloadFile (string url, int timeout, string apikey) public static string DownloadFile(string url, int timeout, string apikey)
{ {
string response = ""; string response = "";
Uri uri = null; Uri uri = null;
@ -209,13 +216,13 @@ namespace System.Net
class MyTlsAuthentication : TlsAuthentication class MyTlsAuthentication : TlsAuthentication
{ {
public TlsCredentials GetClientCredentials(CertificateRequest certificateRequest) public TlsCredentials GetClientCredentials(CertificateRequest certificateRequest)
{ {
return null; return null;
} }
public void NotifyServerCertificate(Certificate serverCertificate) public void NotifyServerCertificate(Certificate serverCertificate)
{ {
} }
} }

Wyświetl plik

@ -178,7 +178,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
} }
[Export(typeof(IPlaneFeedPlugin))] [Export(typeof(IPlaneFeedPlugin))]
[ExportMetadata("Name", "PlaneFeedPlugin")] [ExportMetadata("Name", "PlaneFeedPlugin")]
public class VirtualRadarServerPlugin : IPlaneFeedPlugin public class VirtualRadarServerPlugin : IPlaneFeedPlugin
{ {
@ -297,7 +297,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
APIKey = Settings.APIKey; APIKey = Settings.APIKey;
return; return;
} }
// get AirScout internal key // get AirScout internal key
try try
{ {
@ -377,7 +377,6 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
{ {
// deserialize JSON // deserialize JSON
dynamic root = JsonConvert.DeserializeObject(json); dynamic root = JsonConvert.DeserializeObject(json);
// get local time of request in milliseconds // get local time of request in milliseconds
DateTime lt = DateTime.UtcNow; DateTime lt = DateTime.UtcNow;
long ltime = (long)(lt - new DateTime(1970, 1, 1)).TotalMilliseconds; long ltime = (long)(lt - new DateTime(1970, 1, 1)).TotalMilliseconds;
@ -410,7 +409,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
{ {
PlaneFeedPluginPlaneInfo plane = new PlaneFeedPluginPlaneInfo(); PlaneFeedPluginPlaneInfo plane = new PlaneFeedPluginPlaneInfo();
// get hex first // get hex first
plane.Hex = ReadPropertyString(ac, "Icao").Trim().Replace("\"",""); plane.Hex = ReadPropertyString(ac, "Icao").Trim().Replace("\"", "");
// get position // get position
plane.Lat = ReadPropertyDouble(ac, "Lat"); plane.Lat = ReadPropertyDouble(ac, "Lat");
plane.Lon = ReadPropertyDouble(ac, "Long"); plane.Lon = ReadPropertyDouble(ac, "Long");
@ -549,7 +548,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
return decrypted; return decrypted;
} }
[System.Diagnostics.DebuggerNonUserCode] [System.Diagnostics.DebuggerNonUserCode]
private string ReadPropertyString(dynamic o, string propertyname) private string ReadPropertyString(dynamic o, string propertyname)
{ {
string s = null; string s = null;

Wyświetl plik

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.6")] [assembly: AssemblyVersion("1.3.3.7")]
[assembly: AssemblyFileVersion("1.3.3.6")] [assembly: AssemblyFileVersion("1.3.3.7")]

Wyświetl plik

@ -460,32 +460,50 @@ namespace ScoutBase.Propagation
// return null if elevation path is null for whatever reason // return null if elevation path is null for whatever reason
if (ep == null) if (ep == null)
return null; return null;
for (int i = 0; i < ep.Count; i++) // using (StreamWriter sw = new StreamWriter(File.OpenWrite("propagation.csv")))
{ {
double dist1 = i * stepwidth / 1000.0; // sw.WriteLine("i;dist1;dist2;f1c1;f1c2;elv;eps1;eps1_min;eps2;eps2_min");
double dist2 = (ep.Count - i - 1) * stepwidth / 1000.0; for (int i = 0; i < ep.Count; i++)
double f1c1 = ScoutBase.Core.Propagation.F1Radius(qrg, dist1, dist2) * f1_clearance;
double f1c2 = ScoutBase.Core.Propagation.F1Radius(qrg, dist2, dist1) * f1_clearance;
double nf = NearFieldSuppression / 1000.0;
double eps1;
double eps2;
if (dist1 > nf)
{ {
eps1 = ScoutBase.Core.Propagation.EpsilonFromHeights(h1, dist1, ep.Path[i] + f1c1, radius); double dist1 = i * stepwidth / 1000.0;
double dist2 = (ep.Count - i - 1) * stepwidth / 1000.0;
double f1c1 = ScoutBase.Core.Propagation.F1Radius(qrg, dist1, dist2) * f1_clearance;
double f1c2 = ScoutBase.Core.Propagation.F1Radius(qrg, dist2, dist1) * f1_clearance;
double nf = NearFieldSuppression / 1000.0;
double eps1;
double eps2;
if (dist1 > nf)
eps1 = ScoutBase.Core.Propagation.EpsilonFromHeights(h1, dist1, ep.Path[i] + f1c1, radius);
else
eps1 = ScoutBase.Core.Propagation.EpsilonFromHeights(h1, nf, ep.Path[i] + f1c1, radius);
if (eps1 > eps1_min) if (eps1 > eps1_min)
eps1_min = eps1; eps1_min = eps1;
} if (dist2 > nf)
if (dist2 > nf) eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, dist2, ep.Path[i] + f1c2, radius);
{ else
eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, dist2, ep.Path[i] + f1c2, radius); eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, nf, ep.Path[i] + f1c2, radius);
if (eps2 > eps2_min) if (eps2 > eps2_min)
eps2_min = eps2; eps2_min = eps2;
} if (caller != null)
if (caller != null) {
{ // abort calculation if cancellation pending
// abort calculation if cancellation pending if (caller.WorkerSupportsCancellation && caller.CancellationPending)
if (caller.WorkerSupportsCancellation && caller.CancellationPending) return null;
return null; }
/*
sw.WriteLine(
i.ToString() + ";" +
dist1.ToString("F8") + ";" +
dist2.ToString("F8") + ";" +
f1c1.ToString("F8") + ";" +
f1c2.ToString("F8") + ";" +
ep.Path[i].ToString() + ";" +
eps1.ToString("F8") + ";" +
eps1_min.ToString("F8") + ";" +
eps2.ToString("F8") + ";" +
eps2_min.ToString("F8")
);
*/
} }
} }
PropagationPathDesignator pp = new PropagationPathDesignator(lat1, lon1, h1, lat2, lon2, h2, qrg, radius, f1_clearance, stepwidth, eps1_min, eps2_min, localobstruction); PropagationPathDesignator pp = new PropagationPathDesignator(lat1, lon1, h1, lat2, lon2, h2, qrg, radius, f1_clearance, stepwidth, eps1_min, eps2_min, localobstruction);