Esempio n. 1
0
        public ConfigUpdater(Configuration config, VLogger log, int frequency, Delegate method, Platform platform)
        {
            this.config         = config;
            this.logger         = log;
            this.frequency      = frequency;
            this.methodToInvoke = method;
            this.platform       = platform;

            tcb   = ConfigSync;
            timer = new Timer(tcb, null, 500, frequency);

            if (System.IO.Directory.Exists(temporaryZipLocation)) // creating temporary directory location for downloading and holding zips
            {
                Utils.CleanDirectory(logger, temporaryZipLocation);
            }
            Utils.CreateDirectory(logger, temporaryZipLocation);

            this.status = new UpdateStatus(this.frequency);

            ConfigUpdaterWebService webService = new ConfigUpdaterWebService(logger, this);

            string homeIdPart = "";

            if (!string.IsNullOrWhiteSpace(Settings.HomeId))
            {
                homeIdPart = "/" + Settings.HomeId;
            }

            string url = Constants.InfoServiceAddress + homeIdPart + "/config";

            serviceHost = ConfigUpdaterWebService.CreateServiceHost(webService, new Uri(url));
            serviceHost.Open();
            Utils.structuredLog(logger, "I", "ConfigUpdaterWebService initiated at " + url);
        }
Esempio n. 2
0
        public void Reset(Configuration config, VLogger log, int freq, Delegate method)
        {
            lock (this)
            {
                this.config    = config;
                this.logger    = log;
                this.frequency = freq;
                this.timer.Change(this.frequency, this.frequency);
                this.methodToInvoke = method;

                this.serviceHost.Close();

                string homeIdPart = "";
                if (!string.IsNullOrWhiteSpace(Settings.HomeId))
                {
                    homeIdPart = "/" + Settings.HomeId;
                }
                ConfigUpdaterWebService webService = new ConfigUpdaterWebService(logger, this);
                string url = Constants.InfoServiceAddress + homeIdPart + "/config";
                serviceHost = ConfigUpdaterWebService.CreateServiceHost(webService, new Uri(url));
                serviceHost.Open();
                Utils.structuredLog(logger, "I", "ConfigUpdaterWebService initiated at " + url);
            }
        }