示例#1
0
        public string GenerateCode(IisPoolAndSitesOptions options)
        {
            IISObjectFactory objectFactory = new IISObjectFactory();
            StringBuilder    sb            = new StringBuilder();

            List <SiteDesiredState> sites = objectFactory.BuildSites(options);
            List <PoolDesiredState> pools = objectFactory.BuildPools(options);

            string baseIndent = CodeGenHelpers.GetIndentString(2);
            string code;

            sb.AppendLine(baseIndent + "# Note this code does not detect server level IIS overrides (it assumes the IIS level settings");
            sb.AppendLine(baseIndent + "# have not been overriden).  See the wiki for information about detecting server level changes.\n");

            if (options.IisPoolAndSitesGenerationMode == IisPoolAndSitesGenerationMode.ConfigFileOrder)
            {
                code = GeneratePools(pools);
                sb.AppendLine(code);

                code = GenerateSites(sites);
                sb.AppendLine(code);
            }
            else
            {
                code = GenerateSitesAndPools(sites, pools);
                sb.AppendLine(code);
            }

            return(sb.ToString());
        }
示例#2
0
		public string GenerateCode(IisPoolAndSitesOptions options)
		{
			IISObjectFactory objectFactory = new IISObjectFactory();
			StringBuilder sb = new StringBuilder();

			List<SiteDesiredState> sites = objectFactory.BuildSites(options);
			List<PoolDesiredState> pools = objectFactory.BuildPools(options);

			string baseIndent = CodeGenHelpers.GetIndentString(2);
			string code;

			sb.AppendLine(baseIndent + "# Note this code does not detect server level IIS overrides (it assumes the IIS level settings");
			sb.AppendLine(baseIndent + "# have not been overriden).  See the wiki for information about detecting server level changes.\n");

			if (options.IisPoolAndSitesGenerationMode == IisPoolAndSitesGenerationMode.ConfigFileOrder)
			{
				code = GeneratePools(pools);
				sb.AppendLine(code);

				code = GenerateSites(sites);
				sb.AppendLine(code);
			}
			else
			{
				code = GenerateSitesAndPools(sites, pools);
				sb.AppendLine(code);
			}

			return sb.ToString();
		}