private static ServiceElement CreateEnglishUtf8PrimaryLanguageServiceElement() { ServiceElement englishUtf8PrimaryLanguage = LanguageBaseItem.CreateElementSequenceFromList( new LanguageBaseItem[] { LanguageBaseItem.CreateEnglishUtf8PrimaryLanguageItem() }); return(englishUtf8PrimaryLanguage); }
public String GetPrimaryMultiLanguageStringAttributeById(ServiceAttributeId id) { LanguageBaseItem lang = this.GetPrimaryLanguageBaseItem(); if (lang == null) { lang = LanguageBaseItem.CreateEnglishUtf8PrimaryLanguageItem(); } return(GetMultiLanguageStringAttributeById(id, lang)); }
/// <summary> /// Get a list of installed services. /// </summary> /// <returns> /// The installed services. /// </returns> public Dictionary <Guid, string> GetInstalledServices() { var services = new Dictionary <Guid, string>(); foreach (var service in this.InstalledServices) { var serviceNames = string.Empty; var records = this.GetServiceRecords(service); foreach (var record in records.Where(record => record.Contains(UniversalAttributeId.ServiceName) && record.AttributeIds.Contains(UniversalAttributeId.ServiceName))) { try { var serviceName = record.GetMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName, LanguageBaseItem.CreateEnglishUtf8PrimaryLanguageItem()); serviceNames += (serviceNames.Length > 0 ? ", " : "") + serviceName; } catch (KeyNotFoundException) { // Apparently the check is not enough } } services.Add(service, serviceNames); } return(services); }