private UcdBlock[] LoadBlocks() { List <UcdBlock> list = new List <UcdBlock>(); using (LineReader reader = OpenLineReader("Blocks.txt")) { foreach (NamedRange range in GetNamedRanges(reader)) { list.Add(new UcdBlock(range.Begin, range.End, range.Name)); } } var blocks = list.ToArray(); UcdRange.Sort(blocks); return(blocks); }
private void LoadProperties() { var all = new List <UcdRange <UcdCodeProperty> >(); var map = new Dictionary <string, UcdCodeProperty>(StringComparer.OrdinalIgnoreCase); var list = new List <UcdCodeProperty>(); var _codePropMap = Util.GetPropertyMap(); CodePointProperty _lastValue = (CodePointProperty)(Enum.GetValues(typeof(CodePointProperty)).Length + 1); foreach (var value in Enum.GetValues(typeof(CodePointProperty))) { Debug.WriteLine(value.ToString()); } void ReadFile(string fileName, bool isDerived) { using (LineReader reader = OpenLineReader(fileName)) { foreach (NamedRange range in GetNamedRanges(reader)) { UcdCodeProperty prop; if (!map.TryGetValue(range.Name, out prop)) { CodePointProperty propVal; if (!_codePropMap.TryGetValue(range.Name, out propVal)) { propVal = _lastValue++; _codePropMap.Add(range.Name, propVal); //Debug.WriteLine( $"New Property {range.Name}:{(int)propVal} ({isDerived})" ); } //var val = ParseCodeProperty( range.Name ); prop = new UcdCodeProperty(range.Name, propVal) { IsDerived = isDerived }; map.Add(range.Name, prop); list.Add(prop); } var propRange = new UcdRange <UcdCodeProperty>(range.Begin, range.End, prop); prop.Ranges.Add(propRange); all.Add(propRange); } } } ReadFile("PropList.txt", false); ReadFile("DerivedCoreProperties.txt", true); _allProperties = list.ToArray(); _propertyRanges = all.ToArray(); UcdRange.Sort(_propertyRanges); }