Ejemplo n.º 1
0
        } // LogosPackage

        public static UiContentProviderIdentification FromXmlConfiguration(Identification identification, IEnumerable <string> uiCultures)
        {
            if (identification == null)
            {
                throw new ArgumentNullException();
            }
            if (uiCultures == null)
            {
                throw new ArgumentNullException();
            }

            var result = new UiContentProviderIdentification();

            // id
            result.Id = identification.Id;

            // identification
            var matching  = LocalizedObject.FindMatchingCultureObject(identification.Localized, uiCultures);
            var localized = (matching != null) ? matching : identification.Localized[0];

            result.DisplayName        = localized.Name;
            result.DisplayDescription = localized.Description;

            // packages names
            result.LogosPackage = identification.LogosPackageName;

            return(result);
        } // FromXmlConfiguration
Ejemplo n.º 2
0
        } // FromXmlConfiguration

        private static IDictionary <string, string> FromSpFriendlyNames(SpFriendlyNames[] spNames, IEnumerable <string> uiCultures)
        {
            if ((spNames == null) || (spNames.Length == 0))
            {
                return(new Dictionary <string, string>());
            } // if

            // get list of localized names; if no culture was matched, get the first item of the array (we asume it's the default culture)
            var matching       = LocalizedObject.FindMatchingCultureObject(spNames, uiCultures);
            var localizedNames = (matching != null) ? matching.Names : spNames[0].Names;

            // populate dictionary
            var result = new Dictionary <string, string>(localizedNames.Length, StringComparer.InvariantCultureIgnoreCase);

            foreach (var serviceProvider in localizedNames)
            {
                result.Add(serviceProvider.Domain, serviceProvider.Name);
            } // foreach

            return(result);
        } // LoadServiceProvider