private void enyimConfigSectionToolStripMenuItem_Click(object sender, EventArgs e) { UI.CodeGeneration codeGeneration = new CodeGeneration(); StringBuilder output = new StringBuilder(); output.Append(@" <sectionGroup name=""enyim.com""> <section name=""memcached"" type=""Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"" /> </sectionGroup> <enyim.com> <memcached> <servers> "); if (this._serverConfiguration.Servers != null) { foreach (Business.Server server in this._serverConfiguration.Servers) { IPAddress[] addresses = Dns.GetHostEntry(server.ServerName).AddressList; if (addresses.Length > 0) { foreach (Business.Instance instance in server.Instances) { string ipAddress = addresses[0].ToString(); if (instance.IpAddress != null && instance.IpAddress != String.Empty) { ipAddress = instance.IpAddress; } output.AppendFormat(@" <add address=""{0}"" port=""{1}"" /> <!-- {2} --> " , ipAddress, instance.TcpPort, server.ServerName); } } } } output.Append(@" </servers> <socketPool minPoolSize=""10"" maxPoolSize=""100"" connectionTimeout=""00:00:05"" deadTimeout=""00:02:00"" /> </memcached> </enyim.com> "); codeGeneration.Output = output.ToString(); codeGeneration.Text = "Configuration Section for Enyim MemCacheD API"; codeGeneration.ShowDialog(); }
private void enyimConfigSectionToolStripMenuItem_Click(object sender, EventArgs e) { UI.CodeGeneration codeGeneration = new CodeGeneration(); StringBuilder output = new StringBuilder(); output.Append(@" <sectionGroup name=""enyim.com""> <section name=""memcached"" type=""Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"" /> </sectionGroup> <enyim.com> <memcached> <servers> "); if(this._serverConfiguration.Servers != null) { foreach (Business.Server server in this._serverConfiguration.Servers) { IPAddress[] addresses = Dns.GetHostEntry(server.ServerName).AddressList; if (addresses.Length > 0) { foreach(Business.Instance instance in server.Instances) { string ipAddress = addresses[0].ToString(); if (instance.IpAddress != null && instance.IpAddress != String.Empty) ipAddress = instance.IpAddress; output.AppendFormat(@" <add address=""{0}"" port=""{1}"" /> <!-- {2} --> ", ipAddress, instance.TcpPort, server.ServerName); } } } } output.Append(@" </servers> <socketPool minPoolSize=""10"" maxPoolSize=""100"" connectionTimeout=""00:00:05"" deadTimeout=""00:02:00"" /> </memcached> </enyim.com> "); codeGeneration.Output = output.ToString(); codeGeneration.Text = "Configuration Section for Enyim MemCacheD API"; codeGeneration.ShowDialog(); }