| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
							- using System;
 
- using System.Net;
 
- using System.Net.Sockets;
 
- using System.Text;
 
- using Comal.Classes;
 
- using InABox.Clients;
 
- using InABox.Core;
 
- using PRSServices;
 
- namespace PRSServer;
 
- internal class AutoDiscoveryEngine : Engine<AutoDiscoveryServerProperties>
 
- {
 
-     public override void Run()
 
-     {
 
-         var settings = new AutoDiscoverySettings();
 
-         settings.Name = Properties.DisplayName;
 
-         var urls = Properties.ServerURLs;
 
-         if (String.IsNullOrWhiteSpace(urls))
 
-         {
 
-             var url = CoreUtils.GetPropertyValue(Properties, "ServerURL") as String;
 
-             var port = CoreUtils.GetPropertyValue(Properties, "ServerPort");
 
-             urls = !String.IsNullOrWhiteSpace(url) ? $"{url}:{port}" : "";
 
-         }
 
-         settings.URLs = urls.Split(';');
 
-         settings.Protocol = Properties.Protocol;
 
-         settings.LibraryLocation = Properties.LibraryLocation;
 
-         settings.GoogleAPIKey = Properties.GoogleAPIKey;
 
-         var responseData = Encoding.ASCII.GetBytes(Serialization.Serialize(settings));
 
-         while (true)
 
-         {
 
-             var server = new UdpClient(8888);
 
-             var clientEp = new IPEndPoint(IPAddress.Any, 0);
 
-             var clientRequestData = server.Receive(ref clientEp);
 
-             Logger.Send(LogType.Information, "", string.Format("Processing Request from {0}", clientEp));
 
-             server.Send(responseData, responseData.Length, clientEp);
 
-             Logger.Send(LogType.Information, "", string.Format("- Sending: {0} bytes", responseData.Length));
 
-             server.Close();
 
-             Logger.Send(LogType.Information, "", "- Closed");
 
-         }
 
-     }
 
-     public override void Stop()
 
-     {
 
-     }
 
- }
 
 
  |