Ejemplo n.º 1
0
        private string GenerateSite(SiteDesiredState site)
        {
            string code = "";

            code += site.GetCode(2) + "\n";

            foreach (var application in site.Applications)
            {
                if (application.IsRootApplication == false)
                {
                    code += application.GetCode(2) + "\n";
                }

                foreach (var virtualDir in application.VirtualDirectories)
                {
                    if (virtualDir.IsRootOfAnApplication == false)
                    {
                        if ((virtualDir.Key != "") && (virtualDir.Key != application.Key))
                        {
                            code += virtualDir.GetCode(2) + "\n";
                        }
                    }
                }
            }

            return(code);
        }
Ejemplo n.º 2
0
        private string GetSiteHeader(SiteDesiredState site)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(CodeGenHelpers.Indent + CodeGenHelpers.Indent);
            sb.AppendFormat("#================== '{0}' site definition ==================\n", site.Key);

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        private void Initialize(VirtualDirectory virtualDirectory, string siteName, string webApplicationName)
        {
            this.Key = GetVirtualDirectoryVariableName(siteName, virtualDirectory.Path);

            this.IsRootOfAnApplication = (virtualDirectory.Path == "/");

            AddAttribute("Name", virtualDirectory.Path);

            AddAttribute("Ensure", "Present");
            AddAttribute("Website", siteName);
            AddAttribute("PhysicalPath", virtualDirectory.PhysicalPath);
            AddAttribute("WebApplication", FormatWebApplicationName(webApplicationName));
            AddAttribute("DependsOn", "[cWebSite]" + SiteDesiredState.GetSiteKey(siteName));
        }
Ejemplo n.º 4
0
		public List<SiteDesiredState> BuildSites(IISCodeGenerator.IisPoolAndSitesOptions iisOptions)
		{
			ServerManager serverManager = new ServerManager();
			List<SiteDesiredState> siteCodeList = new List<SiteDesiredState>();
			WebConfigPropertyDesiredStateAssembler gen = new WebConfigPropertyDesiredStateAssembler();

			List<WebConfigPropertyDesiredState> authDesiredStateList = gen.GetAuthenticationDesiredStates();

			foreach (var site in serverManager.Sites)
			{
				var siteName = site.Name;
				var siteAuthDesiredStateList = authDesiredStateList.Where(a => CodeGenHelpers.AreEqualCI(a.SiteName, siteName));
				var siteCode = new SiteDesiredState(site, siteAuthDesiredStateList, iisOptions);

				siteCodeList.Add(siteCode);
			}

			return siteCodeList;
		}
Ejemplo n.º 5
0
        public List <SiteDesiredState> BuildSites(IISCodeGenerator.IisPoolAndSitesOptions iisOptions)
        {
            ServerManager           serverManager      = new ServerManager();
            List <SiteDesiredState> siteCodeList       = new List <SiteDesiredState>();
            WebConfigPropertyDesiredStateAssembler gen = new WebConfigPropertyDesiredStateAssembler();

            List <WebConfigPropertyDesiredState> authDesiredStateList = gen.GetAuthenticationDesiredStates();

            foreach (var site in serverManager.Sites)
            {
                var siteName = site.Name;
                var siteAuthDesiredStateList = authDesiredStateList.Where(a => CodeGenHelpers.AreEqualCI(a.SiteName, siteName));
                var siteCode = new SiteDesiredState(site, siteAuthDesiredStateList, iisOptions);

                siteCodeList.Add(siteCode);
            }

            return(siteCodeList);
        }
Ejemplo n.º 6
0
        public List <SiteDesiredState> BuildSites(IISCodeGenerator.IisPoolAndSitesOptions iisOptions)
        {
            ServerManager           serverManager = new ServerManager();
            List <SiteDesiredState> siteCodeList  = new List <SiteDesiredState>();

            List <WebConfigEntry> configEntryList = new WebConfigEntryAssembler().GetWebConfigEntries();

            foreach (var site in serverManager.Sites)
            {
                var siteName = site.Name;
                List <WebConfigEntry> siteConfigEntryList = configEntryList.Where(a => CodeGenHelpers.AreEqualCI(a.SiteName, siteName)).ToList();

                var siteCode = new SiteDesiredState(site, siteConfigEntryList, iisOptions);

                siteCodeList.Add(siteCode);
            }

            return(siteCodeList);
        }
Ejemplo n.º 7
0
		private string GetSiteHeader(SiteDesiredState site)
		{
			StringBuilder sb = new StringBuilder();

			sb.Append(CodeGenHelpers.Indent + CodeGenHelpers.Indent);
			sb.AppendFormat("#================== '{0}' site definition ==================\n", site.Key);

			return sb.ToString();
		}
Ejemplo n.º 8
0
		private string GenerateSite(SiteDesiredState site)
		{
			string code = "";

			code += site.GetCode(2) + "\n";

			foreach (var application in site.Applications)
			{
				if (application.IsRootApplication == false)
				{
					code += application.GetCode(2) + "\n";
				}

				foreach (var virtualDir in application.VirtualDirectories)
				{
					if (virtualDir.IsRootOfAnApplication == false)
					{
						if ((virtualDir.Key != "") && (virtualDir.Key != application.Key))
							code += virtualDir.GetCode(2) + "\n";
					}
				}
			}

			return code;
		}