kopia lustrzana https://github.com/dl2alf/AirScout
				
				
				
			Merge with V1.4.x (2)V1.3.3.6
							rodzic
							
								
									36b8938a32
								
							
						
					
					
						commit
						5d83dce0a8
					
				| 
						 | 
				
			
			@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 | 
			
		|||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
 | 
			
		||||
// indem Sie "*" wie unten gezeigt eingeben:
 | 
			
		||||
// [assembly: AssemblyVersion("1.0.*")]
 | 
			
		||||
[assembly: AssemblyVersion("1.3.3.1")]
 | 
			
		||||
[assembly: AssemblyFileVersion("1.3.3.1")]
 | 
			
		||||
[assembly: AssemblyVersion("1.3.3.4")]
 | 
			
		||||
[assembly: AssemblyFileVersion("1.3.3.4")]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ namespace System.Net
 | 
			
		|||
                    throw new TimeoutException("Connection timed out.");
 | 
			
		||||
            }
 | 
			
		||||
            while (!trailer.Contains("\r\n"));
 | 
			
		||||
            Console.WriteLine("Reading content [" + contentlength.ToString() + " bytes]: " + resp);
 | 
			
		||||
            //            Console.WriteLine("Reading content [" + contentlength.ToString() + " bytes]: " + resp);
 | 
			
		||||
            response += resp;
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -91,50 +91,57 @@ namespace System.Net
 | 
			
		|||
            int contentlength = 0;
 | 
			
		||||
            // chunked transfer, first line should contain content length
 | 
			
		||||
            // read stream bytewise until CRLF is detected
 | 
			
		||||
            do
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                count = stream.Read(buff, 0, buff.Length);
 | 
			
		||||
                strcontentlength += Encoding.ASCII.GetString(buff, 0, buff.Length);
 | 
			
		||||
                if (st.ElapsedMilliseconds > timeout)
 | 
			
		||||
                    throw new TimeoutException("Connection timed out.");
 | 
			
		||||
                do
 | 
			
		||||
                {
 | 
			
		||||
                    count = stream.Read(buff, 0, buff.Length);
 | 
			
		||||
                    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"));
 | 
			
		||||
            strcontentlength = strcontentlength.Replace("\r\n", "");
 | 
			
		||||
            contentlength = int.Parse(strcontentlength, System.Globalization.NumberStyles.HexNumber);
 | 
			
		||||
            // finished reading all chunks
 | 
			
		||||
            if (contentlength == 0)
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                Console.WriteLine("Reading chunked content finished");
 | 
			
		||||
                return true;
 | 
			
		||||
                Console.WriteLine("Error while reading chunked content: " + ex.Message);
 | 
			
		||||
            }
 | 
			
		||||
            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"));
 | 
			
		||||
            Console.WriteLine("Reading chunked content [" + contentlength.ToString() + " bytes]: " + resp);
 | 
			
		||||
            // Console.WriteLine("Reading chunked content [" + contentlength.ToString() + " bytes]: " + resp);
 | 
			
		||||
            response += resp;
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string DownloadFile (string url, int timeout, string apikey)
 | 
			
		||||
        public static string DownloadFile(string url, int timeout, string apikey)
 | 
			
		||||
        {
 | 
			
		||||
            string response = "";
 | 
			
		||||
            Uri uri = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,7 +178,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[Export(typeof(IPlaneFeedPlugin))]
 | 
			
		||||
    [Export(typeof(IPlaneFeedPlugin))]
 | 
			
		||||
    [ExportMetadata("Name", "PlaneFeedPlugin")]
 | 
			
		||||
    public class VirtualRadarServerPlugin : IPlaneFeedPlugin
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -377,7 +377,6 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
 | 
			
		|||
            {
 | 
			
		||||
                // deserialize JSON
 | 
			
		||||
                dynamic root = JsonConvert.DeserializeObject(json);
 | 
			
		||||
 | 
			
		||||
                // get local time of request in milliseconds
 | 
			
		||||
                DateTime lt = DateTime.UtcNow;
 | 
			
		||||
                long ltime = (long)(lt - new DateTime(1970, 1, 1)).TotalMilliseconds;
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +409,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
 | 
			
		|||
                    {
 | 
			
		||||
                        PlaneFeedPluginPlaneInfo plane = new PlaneFeedPluginPlaneInfo();
 | 
			
		||||
                        // get hex first
 | 
			
		||||
                        plane.Hex = ReadPropertyString(ac, "Icao").Trim().Replace("\"","");
 | 
			
		||||
                        plane.Hex = ReadPropertyString(ac, "Icao").Trim().Replace("\"", "");
 | 
			
		||||
                        // get position
 | 
			
		||||
                        plane.Lat = ReadPropertyDouble(ac, "Lat");
 | 
			
		||||
                        plane.Lon = ReadPropertyDouble(ac, "Long");
 | 
			
		||||
| 
						 | 
				
			
			@ -549,7 +548,7 @@ namespace AirScout.PlaneFeeds.Plugin.VirtualRadarServer
 | 
			
		|||
            return decrypted;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    [System.Diagnostics.DebuggerNonUserCode]
 | 
			
		||||
        [System.Diagnostics.DebuggerNonUserCode]
 | 
			
		||||
        private string ReadPropertyString(dynamic o, string propertyname)
 | 
			
		||||
        {
 | 
			
		||||
            string s = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 | 
			
		|||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 
 | 
			
		||||
// übernehmen, indem Sie "*" eingeben:
 | 
			
		||||
// [assembly: AssemblyVersion("1.0.*")]
 | 
			
		||||
[assembly: AssemblyVersion("1.3.3.6")]
 | 
			
		||||
[assembly: AssemblyFileVersion("1.3.3.6")]
 | 
			
		||||
[assembly: AssemblyVersion("1.3.3.7")]
 | 
			
		||||
[assembly: AssemblyFileVersion("1.3.3.7")]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												Plik diff jest za duży
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -460,32 +460,50 @@ namespace ScoutBase.Propagation
 | 
			
		|||
            // return null if elevation path is null for whatever reason
 | 
			
		||||
            if (ep == 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;
 | 
			
		||||
                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)
 | 
			
		||||
                //                sw.WriteLine("i;dist1;dist2;f1c1;f1c2;elv;eps1;eps1_min;eps2;eps2_min");
 | 
			
		||||
                for (int i = 0; i < ep.Count; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    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)
 | 
			
		||||
                        eps1_min = eps1;
 | 
			
		||||
                }
 | 
			
		||||
                if (dist2 > nf)
 | 
			
		||||
                {
 | 
			
		||||
                    eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, dist2, ep.Path[i] + f1c2, radius);
 | 
			
		||||
                    if (dist2 > nf)
 | 
			
		||||
                        eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, dist2, ep.Path[i] + f1c2, radius);
 | 
			
		||||
                    else
 | 
			
		||||
                        eps2 = ScoutBase.Core.Propagation.EpsilonFromHeights(h2, nf, ep.Path[i] + f1c2, radius);
 | 
			
		||||
                    if (eps2 > eps2_min)
 | 
			
		||||
                        eps2_min = eps2;
 | 
			
		||||
                }
 | 
			
		||||
                if (caller != null)
 | 
			
		||||
                {
 | 
			
		||||
                    // abort calculation if cancellation pending
 | 
			
		||||
                    if (caller.WorkerSupportsCancellation && caller.CancellationPending)
 | 
			
		||||
                        return null;
 | 
			
		||||
                    if (caller != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        // abort calculation if cancellation pending
 | 
			
		||||
                        if (caller.WorkerSupportsCancellation && caller.CancellationPending)
 | 
			
		||||
                            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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue