Esempio n. 1
0
 public async void Run(GetPubIP GetPubIP, GoDaddyAPIClient gd_API, AppConf ConfigObj)
 {
     try
     {
         ArrayList arList = gd_API.API_GetARecordAsync(ConfigObj.GoDaddyURI).Result;
         if (arList[2].Equals(true))
         {
             if (!GetPubIP.GetIP(ConfigObj.WebAddressURL).Equals(arList[1].ToString(), StringComparison.Ordinal))
             {
                 await gd_API.API_UpdateARecordAsync(ConfigObj.GoDaddyURI, GetPubIP.GetIP(ConfigObj.WebAddressURL), ConfigObj.TTL);
             }
             else
             {
                 clLogger.WriteErrorLog("No IP Change detected");
                 clLogger.WriteEventLog("No IP Change detected", EventLogEntryType.Information);
             }
         }
     }
     catch (ProtocolException e)
     {
         clLogger.WriteErrorLog(e);
         clLogger.WriteEventLog(e);
     }
     catch (System.SystemException e)
     {
         clLogger.WriteErrorLog(e);
         clLogger.WriteEventLog(e);
     }
 }
        // Each timer tick -> run Update method
        //public void timer1_tick(object sender, ElapsedEventArgs e)
        public void timer1_tick(object sender, ElapsedEventArgs e)
        {
            IsIPNew          ServiceRun = new IsIPNew();
            GoDaddyAPIClient APIobj     = new GoDaddyAPIClient(ConfigObj.APIKey, ConfigObj.SecretKey, ConfigObj);

            ServiceRun.Run(clGetPubIP, APIobj, ConfigObj);
        }