protected override void OnStart(string[] args)
{
Thread.Sleep(10000);
try
{
hostnamesToUpdate = Config.HostnamesToUpdate;
if (string.IsNullOrEmpty(hostnamesToUpdate))
{
throw new ArgumentException("Hostnames To Update were not provided");
}
logger.Info(string.Format("DynamicDnsUpdaterClientTypeId: {0}", Config.DynamicDnsUpdaterClientTypeId));
if(Config.DynamicDnsUpdaterClientTypeId == (int)DynamicDnsUpdaterClientType.DnsOMatic)
{
username = Config.DnsOMaticUsername;
password = Config.DnsOMaticPassword;
if (string.IsNullOrEmpty(username))
{
throw new ArgumentException("Username was not provided");
}
if (string.IsNullOrEmpty(password))
{
throw new ArgumentException("Password was not provided");
}
}
updater = new BespokeUpdater(Config.DynamicDnsUpdaterClientTypeId);
updater.Client.InitializeLastUpdateIpAddresses(hostnamesToUpdate);
timer = new Timer(Update, null, updateStartDelay, updateInterval);
}
catch (Exception ex)
{
logger.Error(ex);
}
}