Ejemplo n.º 1
0
        public static void BuildLanguageList(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            LanguageList lang = new LanguageList();

            dataTable.BeginLoadData();
            Array.ForEach <string>(HygieneUtils.antispamFilterableLanguages, delegate(string code)
            {
                string text     = code.ToUpper().ToString();
                DataRow dataRow = dataTable.NewRow();
                try
                {
                    dataRow["LanguageCode"] = text;
                    dataRow["LanguageName"] = RtlUtil.ConvertToDecodedBidiString(lang.GetDisplayValue(code), RtlUtil.IsRtl);
                    dataRow["Identity"]     = new Identity(text, dataRow["LanguageName"].ToString());
                }
                catch
                {
                    dataRow["LanguageCode"] = text;
                    dataRow["LanguageName"] = text;
                    dataRow["Identity"]     = new Identity(text, text);
                }
                dataTable.Rows.Add(dataRow);
            });
            dataTable.EndLoadData();
        }
Ejemplo n.º 2
0
        public static string GetCountryDisplayName(string locale)
        {
            if (string.IsNullOrEmpty(locale))
            {
                return(string.Empty);
            }
            string result;

            try
            {
                LanguageList languageList = new LanguageList();
                result = RtlUtil.ConvertToDecodedBidiString(languageList.GetDisplayValue(locale), RtlUtil.IsRtl);
            }
            catch (Exception exception)
            {
                DDIHelper.Trace("Failed to locate locale {0}, Error: {1}", new object[]
                {
                    locale,
                    exception.GetTraceFormatter()
                });
                result = locale;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static void GetContentFilterPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow row = dataTable.Rows[0];

            Antispam.contentEmailListParameters.ForEach(delegate(string p)
            {
                if (!row[p].IsNullValue())
                {
                    MultiValuedProperty <SmtpAddress> multiValuedProperty = (MultiValuedProperty <SmtpAddress>)row[p];
                    row[string.Format("str{0}", p)] = multiValuedProperty.ToStringArray <SmtpAddress>().StringArrayJoin("; ");
                }
            });
            List <Identity> list         = new List <Identity>();
            List <Identity> list2        = new List <Identity>();
            LanguageList    languageList = new LanguageList();

            if (!row["RegionBlockList"].IsNullValue())
            {
                foreach (string text in ((MultiValuedProperty <string>)row["RegionBlockList"]))
                {
                    list.Add(new Identity(text.ToString(), Antispam.GetRegionDisplayName(text)));
                }
                row["regionList"] = list.ToArray();
            }
            if (!row["LanguageBlockList"].IsNullValue())
            {
                foreach (string text2 in ((MultiValuedProperty <string>)row["LanguageBlockList"]))
                {
                    list2.Add(new Identity(text2.ToString(), RtlUtil.ConvertToDecodedBidiString(languageList.GetDisplayValue(text2), RtlUtil.IsRtl)));
                }
                row["languageList"] = list2.ToArray();
            }
        }