private void updateUnicodeFromStringID()
{
StringID SID = (StringID)lbStringIDs.SelectedItem;
if (SID == null)
return;
lbUnicodes.Enabled = false;
if (cbShowAllUnicodes.Checked)
{
lbUnicodes.DataSource = unicodes;
if (SID.unicodes.Count > 0)
lbUnicodes.SelectedItem = SID.unicodes[0];
}
else
{
lbUnicodes.DataSource = SID.unicodes;
// Sometimes it doesn't properly select a default item and throws errors, so refresh to fix
((CurrencyManager)lbUnicodes.BindingContext[lbUnicodes.DataSource]).Refresh();
#if DEBUG
/*
* This is for debugging of unknown unicode codes only
*/
if (SID.unicodes.Count > 0 && SID.unicodes[0].ToString().Contains("???"))
{
string s = SID.unicodes[0].unicode.ToString();
byte[] tempbytes = System.Text.Encoding.Unicode.GetBytes(s);
string temps = "Unknown Codes:\n";
for(int i = 0; i < tempbytes.Length; i++)
if (tempbytes[i] == 238)
{
temps += tempbytes[i].ToString() + " " + tempbytes[i + 1].ToString() + " " + tempbytes[i + 2].ToString() + "\n";
}
MessageBox.Show(temps);
}
#endif
}
lbUnicodes.Enabled = true;
}