Example #1
0
        } // BuildMapping

        public static Dictionary <string, ServiceDomainMapping> BuildMapping(ServiceMappingsXml mapping)
        {
            Dictionary <string, ServiceDomainMapping> mappings;
            ServiceDomainMapping domainMappings;
            int count;

            var qDomain = from package in mapping.Packages
                          from domain in package.Domains
                          select domain;

            count = qDomain.Count();

            mappings = new Dictionary <string, ServiceDomainMapping>(count);
            foreach (var domain in qDomain)
            {
                domainMappings = new ServiceDomainMapping()
                {
                    DomainRedirection = domain.RedirectDomainName,
                    Logos             = new Dictionary <string, string>(domain.Mappings.Length),
                };
                try
                {
                    mappings.Add(domain.DomainName.ToLowerInvariant(), domainMappings);
                }
                catch (ArgumentException ex) // duplicated key (domain name)
                {
                    throw new ApplicationException(
                              string.Format(Properties.Texts.ExceptionLogosServiceMappingsDuplicatedDomain,
                                            domain.DomainName), ex);
                } // try-catch

                foreach (var mp in domain.Mappings)
                {
                    try
                    {
                        domainMappings.Logos.Add(mp.Name.ToLowerInvariant(), mp.Logo);
                    }
                    catch (ArgumentException ex) // duplicated key (domain service name)
                    {
                        throw new ApplicationException(
                                  string.Format(Properties.Texts.ExceptionLogosServiceMappingsDuplicatedService,
                                                mp.Name, domain.DomainName), ex);
                    } // try-catch
                }     // foreach mp
            }         // foreach domain

            return(mappings);
        } // BuildMapping
Example #2
0
        } // GetFolderForDomain

        private void Init(DomainMappingsXml domainMappings, ServiceMappingsXml serviceMappings)
        {
            DomainMappings  = BuildMapping(domainMappings);
            ServiceMappings = BuildMapping(serviceMappings);
            BasePathLogos   = serviceMappings.BasePath;
        } // Init
Example #3
0
        } // BasePathServiceLogos

        public ServiceLogoMappings(DomainMappingsXml domainMappings, ServiceMappingsXml serviceMappings)
        {
            Init(domainMappings, serviceMappings);
        } // constructor