using System.Net;
using skyscraper5.Skyscraper.IO.RemoteStreamReader;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Skyscraper.IO.TunerInterface
{
    [SkyscraperPlugin]
    [TunerFactoryId(2,"skyscraper5 Remote Stream Reader")]
    public class RemoteStreamReaderTunerFactory : ITunerFactory
    {
        public string Hostname { get; set; }

        public int Port { get; set; }

        public IStreamReader CreateStreamReader()
        {
	        IPAddress[] hostAddresses = Dns.GetHostAddresses(Hostname);
	        IPEndPoint remoteIpEndPoint = new IPEndPoint(hostAddresses[0], Port);
            return new RemoteStreamReaderClient(remoteIpEndPoint);
        }
    }
}
