/// <summary> /// constructor of PropertyData stuct /// </summary> public UnicodeRangeProperty(TextUtil.UnicodeChartType type, string name, string ids, UnicodeRange range) { Type = type; Name = name; CultureIDs = ids; Range = new UnicodeRange(range.StartOfUnicodeRange, range.EndOfUnicodeRange); }
/// <summary> /// Walk through Unicode range database to build up property according to Group attribute /// </summary> public static bool BuildPropertyDataList( UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange, List <UnicodeRangeProperty> dataList, string name, GroupAttributes attribute) { bool isAdded = false; foreach (Group script in unicodeDb.Scripts) { string scriptAttrib = script.GroupName; if (attribute == GroupAttributes.Name) { scriptAttrib = script.Name; } else if (attribute == GroupAttributes.Ids) { scriptAttrib = script.Ids; } if (scriptAttrib.Equals(name, StringComparison.OrdinalIgnoreCase)) { UnicodeRange range = GetRange(script.UnicodeRange, expectedRange); if (null != range) { dataList.Add(new UnicodeRangeProperty(TextUtil.UnicodeChartType.Script, script.Name, script.Ids, range)); isAdded = true; } if (null != script.SubGroups) { foreach (SubGroup subScript in script.SubGroups) { range = GetRange(subScript.UnicodeRange, expectedRange); if (null != range) { dataList.Add(new UnicodeRangeProperty( TextUtil.UnicodeChartType.Script, subScript.SubGroupName, subScript.SubIds, range)); isAdded = true; } } } } } foreach (Group symbol in unicodeDb.SymbolsAndPunctuation) { string symbolAttrib = symbol.GroupName; if (attribute == GroupAttributes.Name) { symbolAttrib = symbol.Name; } else if (attribute == GroupAttributes.Ids) { symbolAttrib = symbol.Ids; } if (symbolAttrib.Equals(name, StringComparison.OrdinalIgnoreCase)) { TextUtil.UnicodeChartType type = TextUtil.UnicodeChartType.Other; if ((symbol.GroupName.ToLower(CultureInfo.InvariantCulture)).Contains("symbols") || (symbol.Name.ToLower(CultureInfo.InvariantCulture)).Contains("symbols")) { type = TextUtil.UnicodeChartType.Symbol; } else if ((symbol.GroupName.ToLower(CultureInfo.InvariantCulture)).Contains("punctuation") || (symbol.Name.ToLower(CultureInfo.InvariantCulture)).Contains("punctuation")) { type = TextUtil.UnicodeChartType.Punctuation; } UnicodeRange range = GetRange(symbol.UnicodeRange, expectedRange); if (null != range) { dataList.Add(new UnicodeRangeProperty(type, symbol.Name, symbol.Ids, range)); isAdded = true; } if (null != symbol.SubGroups) { foreach (SubGroup subSymbol in symbol.SubGroups) { range = GetRange(subSymbol.UnicodeRange, expectedRange); if (null != range) { dataList.Add(new UnicodeRangeProperty(type, subSymbol.SubGroupName, subSymbol.SubIds, range)); isAdded = true; } } } } } return(isAdded); }