private static List <IndexEntry> BuildUnicodeIndex() { var sw = Stopwatch.StartNew(); var result = new List <IndexEntry>(); var blocks = UnicodeInfo.GetBlocks(); foreach (var block in blocks) { foreach (var codepoint in block.CodePointRange) { if (char.IsSurrogate((char)codepoint)) { continue; } var charInfo = UnicodeInfo.GetCharInfo(codepoint); var displayText = charInfo.Name; if (displayText != null) { result.Add(new(charInfo, displayText, displayText.ToUpperInvariant())); } } } Console.WriteLine("Index built in " + sw.Elapsed); return(result); }
public void Show(MainWindow owner) { this.Owner = owner; cbxBlocks.ItemsSource = UnicodeInfo.GetBlocks().Select(b => $"{b.Name} [{b.CodePointRange.ToString().Replace("..", "-")}]"); cbxCategories.ItemsSource = Enum.GetNames(typeof(UnicodeCategory)); cbxBlocks.SelectedIndex = cbxCategories.SelectedIndex = 0; chxBlockApplies.IsChecked = chxCategoryApplies.IsChecked = false; Show(); }
private static BlockInformation[] GetBlocksInternal() { var blocks = UnicodeInfo.GetBlocks(); var blockViewModel = new BlockInformation[blocks.Length]; for (int i = 0; i < blocks.Length; i++) { var block = blocks[i]; blockViewModel[i] = new BlockInformation(block.Name, BlockMetadata.GetDescription(block.Name), new CodePointRange(block.CodePointRange.FirstCodePoint, block.CodePointRange.LastCodePoint)); } return(blockViewModel); }
private void BuildUnicodeList() { var blocks = UnicodeInfo.GetBlocks(); foreach (var block in blocks) { foreach (var codepoint in block.CodePointRange) { if (char.IsSurrogate((char)codepoint)) { continue; } var charInfo = UnicodeInfo.GetCharInfo(codepoint); var displayText = charInfo.Name; if (displayText != null) { descriptions[codepoint] = displayText; } } } }
private void blockSelection_SelectedIndexChanged(object sender, EventArgs e) { charView.Items.Clear(); UnicodeBlock newB = UnicodeInfo.GetBlocks()[blockSelection.SelectedIndex]; int i = newB.CodePointRange.FirstCodePoint; int range_upper = newB.CodePointRange.LastCodePoint; UnicodeCharInfo uc = new UnicodeCharInfo(); int itemind = 0; string name = "RESERVED CODEPOINT"; while (i <= range_upper) { uc = UnicodeInfo.GetCharInfo(i); charView.Items.Add(UnicodeInfo.GetDisplayText(uc)); if (uc.Name != null) { name = uc.Name; } charView.Items[itemind].ToolTipText = name + "\r\nCode point: U+" + BitConverter.ToString(BitConverter.GetBytes(uc.CodePoint).Reverse().ToArray()).Replace("-", ""); i++; itemind++; } }