Example #1
0
 /// <summary>
 /// Constructor for DynZEService
 /// </summary>
 /// <param name="log">
 ///     The ILog implementation to be used.
 /// </param>
 /// <param name="config">
 ///     An existing AppConfig instance.
 /// </param>
 /// <param name="persistor">
 ///     The persistor to be used.
 /// </param>
 /// <param name="retriever">
 ///     The retriever to be used.
 /// </param>
 /// <param name="updater">
 ///     The updater to be used.
 /// </param>
 public DynZEService(ILog log, AppConfig config, IIPPersistor persistor, IIPRetriever retriever, IIPUpdater updater)
 {
     _log = log;
     _persistor = persistor;
     _retriever = retriever;
     _updater = updater;
     _config = config;
 }
Example #2
0
        /// <summary>
        /// Constructor for CommandUpdater
        /// </summary>
        /// <param name="log">
        ///     The ILog to be used.
        /// </param>
        /// <param name="config">
        ///     The AppConfig to be used.
        /// </param>
        public CommandUpdater(ILog log, AppConfig config)
        {
            _log = log;
            _command = config.Command.Trim();

            if (String.IsNullOrEmpty(_command))
            {
                throw new ArgumentException("Command cannot be null or empty.");
            }
        }
Example #3
0
 private IIPUpdater CreateUpdater(AppConfig config)
 {
     if (config.Mode.ToLower() == "online")
     {
         return new ZoneEditUpdater(_log, config);
     }
     else
     {
         return new CommandUpdater(_log, config);
     }
 }
Example #4
0
        public IService CreateDynZEService()
        {
            var config = new AppConfig();
            var notifier = CreateUpdater(config);

            return new DynZEService(
                _log,
                config,
                new IPPersistor(_log),
                new WebIPRetriever(_log),
                notifier);
        }
Example #5
0
        /// <summary>
        /// Updates ZoneEdit via HTTP.
        /// </summary>
        private static void forceUpdate()
        {
            AppConfig config = new AppConfig();

            try
            {
                // Create the HTTP request
                string uri = @"http://dynamic.zoneedit.com/auth/dynamic.html?host=";
                uri += config.Hosts.Trim();
                var request = HttpWebRequest.Create(uri);
                request.Credentials = new NetworkCredential(config.UserName, config.Password);
                request.PreAuthenticate = true;
                request.Method = "GET";

                var response = request.GetResponse();

                Console.WriteLine(response);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error updating IP. {0}", ex);
            }
        }
 public ZoneEditUpdater(ILog log, AppConfig config)
 {
     _log = log;
     _config = config;
 }
Example #7
0
 /// <summary>
 /// Constructor for IPPersistor
 /// </summary>
 /// <param name="log">
 ///     The ILog implementation to use.
 /// </param>
 public IPPersistor(ILog log)
 {
     _log = log;
     _config = new AppConfig();
 }