public DeployParameters GetDeployParametersByHostName(DeployConfiguration configuration, string hostName)
        {
            if (configuration == null || configuration.Parameters == null)
            {
                return null;
            }

            return configuration.Parameters.Where(p => p.HostName.Equals(hostName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
        }
        public void SaveConfiguration(DeployConfiguration configuration)
        {
            string filename = this.GetFileName();

            using (var stream = new FileStream(filename, FileMode.Create))
            {
                serializer.Serialize(stream, configuration);
            }
        }
        public void SaveDeployParameters(DeployConfiguration configuration, DeployParameters parameters)
        {
            if (configuration == null)
            {
                configuration = new DeployConfiguration();
            }

            if (configuration.Parameters == null)
            {
                configuration.Parameters = new List<DeployParameters>();
            }

            DeployParameters oldparameters = configuration.Parameters.Where(p => p.HostName.Equals(parameters.HostName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (oldparameters != null)
            {
                configuration.Parameters.Remove(oldparameters);
            }

            configuration.Parameters.Add(parameters);
            this.SaveConfiguration(configuration);
        }
Ejemplo n.º 4
0
        private void LoadConfiguration()
        {
            this.configuration = this.confmanager.GetConfiguration();

            if (this.configuration != null && this.configuration.Parameters != null)
            {
                this.cmbHostName.Items.Clear();

                foreach (var parameter in this.configuration.Parameters)
                {
                    this.cmbHostName.Items.Add(parameter.HostName);
                }
            }
        }