public void WriteScriptMap() { _loader.EnsureDataLoaded(); _loader.EnsureScriptsLoaded(); EnsureCodeMapBuild(); var map = new Dictionary <int, ScriptSystem>(); foreach (var entry in _loader.GetCodePoints(0, ushort.MaxValue)) { if (entry.Script != 0) { ScriptSystem sys = GetScriptSystem(entry.Script); map.Add(entry.CodeValue, sys); } } #if true1 using (var w = File.CreateText(@"f:\_tests\Del\ScriptMap.txt")) { for (int i = 0; i <= ushort.MaxValue; i++) { if (map.TryGetValue(i, out ScriptSystem value)) { } string text = $"{i:X4} "; if (_loader.TryGetEntry(i, out UnicodeEntry entry)) { if (IsPrintable(entry.Category)) { text += entry + " "; } if (entry.Script != 0) { text += "[" + entry.Script + "] "; } text += entry.Name + " "; } w.WriteLine(text + value); } } #else InterleaveMap imap = new InterleaveMap(); for (int i = 0; i <= ushort.MaxValue; i++) { if (map.TryGetValue(i, out ScriptSystem value)) { imap.Add((char)i, (int)value); } } using (var w = File.Create(@"f:\_tests\Del\ScriptMap.bin")) using (var b = new BinaryWriter(w)){ imap.SaveByte(b); } #endif }
public MapBuild(UcdLoader loader) { _loader = loader; loader.EnsureDataLoaded(); var iocMap = _iocMap = new Dictionary <int, int>(); foreach (var line in File.ReadLines(@"../../bin/OrdinalIgnoreCase.txt")) { var s = line.Split(new[] { ' ' }, 3); if (int.TryParse(s[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture, out int from) && int.TryParse(s[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture, out int to)) { iocMap.Add(from, to); } } }