B2026-025_Unicode_removed_from_RO_menu_titles_in_treeview #729

Merged
jjenko merged 5 commits from B2026-025_Unicode_removed_from_RO_menu_titles_in_treeview into Development 2026-03-10 13:23:59 -04:00
3 changed files with 49 additions and 7 deletions
@@ -2142,7 +2142,20 @@ namespace RODBInterface
wraccid = accid; wraccid = accid;
string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now); string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now);
string xmlstr = GenerateXmlString(ro, false); string xmlstr = GenerateXmlString(ro, false);
string strUpdate = "UPDATE " + ro.GetAttribute("Table") + " SET Info = '" + xmlstr + "'"; StringBuilder xmlstrTmp = new StringBuilder(); // B2026-025 prep the info field data so it will be saved correctly.
char[] chrAry = xmlstr.ToCharArray();
foreach (int chr in chrAry)
{
if (chr > 166)
mschill marked this conversation as resolved Outdated
Outdated
Review

should this be 160 or 166?

In ctlXMLEdit.cs you have:

			{
				if (chr > 166)
				{
					result1.Append($"\\u{(int)chr}?");
				}
				else
				{
					result1.Append((char)chr);
				}

could be mistaken, but would think this would be consistent?

should this be 160 or 166? In ctlXMLEdit.cs you have: { if (chr > 166) { result1.Append($"\\u{(int)chr}?"); } else { result1.Append((char)chr); } could be mistaken, but would think this would be consistent?
{
xmlstrTmp.Append($"\\u{(int)chr}?");
}
else
{
xmlstrTmp.Append((char)chr);
}
}
string strUpdate = "UPDATE " + ro.GetAttribute("Table") + " SET Info = '" + xmlstrTmp.ToString() + "'";
mschill marked this conversation as resolved Outdated
Outdated
Review

here - it looks like you are concatenating a stringbuilder with a string --- should

this line have xmlstrTmp.ToString() instead?

here - it looks like you are concatenating a stringbuilder with a string --- should this line have xmlstrTmp.ToString() instead?
Outdated
Review

Well in my testing the data was saved just fine, but I will added the tostring(). I do not think it will hurt.

Well in my testing the data was saved just fine, but I will added the tostring(). I do not think it will hurt.
if (movedRO) if (movedRO)
{ {
VlnXmlElement parent = (VlnXmlElement)ro.ParentNode; VlnXmlElement parent = (VlnXmlElement)ro.ParentNode;
1
@@ -2186,6 +2199,20 @@ namespace RODBInterface
} }
string xmlstr = GenerateXmlString(ro, false); string xmlstr = GenerateXmlString(ro, false);
StringBuilder xmlstrTmp = new StringBuilder(); // B2026-025 prep the info field data so it will be saved correctly.
char[] chrAry = xmlstr.ToCharArray();
foreach (int chr in chrAry)
{
if (chr > 166)
mschill marked this conversation as resolved Outdated
Outdated
Review

should this be 160 or 166?

In ctlXMLEdit.cs you have:

			{
				if (chr > 166)
				{
					result1.Append($"\\u{(int)chr}?");
				}
				else
				{
					result1.Append((char)chr);
				}

could be mistaken, but would think this would be consistent?

should this be 160 or 166? In ctlXMLEdit.cs you have: { if (chr > 166) { result1.Append($"\\u{(int)chr}?"); } else { result1.Append((char)chr); } could be mistaken, but would think this would be consistent?
{
xmlstrTmp.Append($"\\u{(int)chr}?");
}
else
{
xmlstrTmp.Append((char)chr);
}
}
string wraccid = null; string wraccid = null;
if (ro.HasAttribute("AccPageID")) if (ro.HasAttribute("AccPageID"))
{ {
1
@@ -2209,13 +2236,13 @@ namespace RODBInterface
// strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageID, ModDateTime, Info ) "; // strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageID, ModDateTime, Info ) ";
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, AccPageID, Info ) "; strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, AccPageID, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID"); strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID");
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstr + "');"; strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstrTmp.ToString() + "');";
mschill marked this conversation as resolved Outdated
Outdated
Review

here - it looks like you are concatenating a stringbuilder with a string --- should

this line have xmlstrTmp.ToString() instead?

here - it looks like you are concatenating a stringbuilder with a string --- should this line have xmlstrTmp.ToString() instead?
} }
else else
{ {
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, Info ) "; strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID"); strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID");
strInsert = strInsert + "','" + dt + "','" + xmlstr + "');"; strInsert = strInsert + "','" + dt + "','" + xmlstrTmp.ToString() + "');";
mschill marked this conversation as resolved Outdated
Outdated
Review

here - it looks like you are concatenating a stringbuilder with a string --- should

this line have xmlstrTmp.ToString() instead?

here - it looks like you are concatenating a stringbuilder with a string --- should this line have xmlstrTmp.ToString() instead?
} }
} }
@@ -2223,7 +2250,7 @@ namespace RODBInterface
{ {
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageId, ModDateTime, Info ) "; strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageId, ModDateTime, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.RRO + ",'" + ro.GetAttribute("ParentID"); strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.RRO + ",'" + ro.GetAttribute("ParentID");
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstr + "');"; strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstrTmp.ToString() + "');";
mschill marked this conversation as resolved Outdated
Outdated
Review

here - it looks like you are concatenating a stringbuilder with a string --- should

this line have xmlstrTmp.ToString() instead?

here - it looks like you are concatenating a stringbuilder with a string --- should this line have xmlstrTmp.ToString() instead?
} }
try try
@@ -2631,7 +2658,20 @@ namespace RODBInterface
} }
} }
StatMsgWindow.StatusMessage = echild.GetAttribute("MenuTitle"); StatMsgWindow.StatusMessage = echild.GetAttribute("MenuTitle");
str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2 + "'"; StringBuilder tinfo2Tmp = new StringBuilder(); // B2026-025 prep the info field data so it will be saved correctly.
char[] chrAry = tinfo2.ToCharArray();
foreach (int chr in chrAry)
{
if (chr > 166)
mschill marked this conversation as resolved Outdated
Outdated
Review

should this be 160 or 166?

In ctlXMLEdit.cs you have:

			{
				if (chr > 166)
				{
					result1.Append($"\\u{(int)chr}?");
				}
				else
				{
					result1.Append((char)chr);
				}

could be mistaken, but would think this would be consistent?

should this be 160 or 166? In ctlXMLEdit.cs you have: { if (chr > 166) { result1.Append($"\\u{(int)chr}?"); } else { result1.Append((char)chr); } could be mistaken, but would think this would be consistent?
{
tinfo2Tmp.Append($"\\u{(int)chr}?");
}
else
{
tinfo2Tmp.Append((char)chr);
}
}
str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2Tmp.ToString() + "'";
mschill marked this conversation as resolved Outdated
Outdated
Review

here - it looks like you are concatenating a stringbuilder with a string --- should

str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2Tmp + "'";

be

str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2Tmp.ToString() + "'";

?

here - it looks like you are concatenating a stringbuilder with a string --- should str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2Tmp + "'"; be str = "UPDATE " + echild.GetAttribute("Table") + " SET Info = '" + tinfo2Tmp.ToString() + "'"; ?
str = str + ", ModDateTime = '" + dt + "' WHERE RecID = '" + echild.GetAttribute("RecID") + "';"; str = str + ", ModDateTime = '" + dt + "' WHERE RecID = '" + echild.GetAttribute("RecID") + "';";
DBE.Command(str); DBE.Command(str);
DBE.Reader(); DBE.Reader();
@@ -96,6 +96,7 @@ using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using ROFields; using ROFields;
using VlnStatus; using VlnStatus;
using System.Text.RegularExpressions;
//using VlnProfiler; //don't forget to add VlnProfiler to the reference list //using VlnProfiler; //don't forget to add VlnProfiler to the reference list
namespace RODBInterface namespace RODBInterface
@@ -517,6 +518,7 @@ namespace RODBInterface
strtmp.Append(" "); strtmp.Append(" ");
cnt++; cnt++;
} }
text = Regex.Replace(text, @"\\u([0-9]{1,4})\?", m => int.TryParse(m?.Groups[1]?.Value, out int result) ? Convert.ToChar(result).ToString() : ""); //B2026-025 Unicode removed from RO menu titles in treeview.
mschill marked this conversation as resolved Outdated
Outdated
Review

Should commented out code be removed?

Should commented out code be removed?
if ((cnt + text.Length) > frmt2) // longer than the field length? if ((cnt + text.Length) > frmt2) // longer than the field length?
mschill marked this conversation as resolved
Review

Does there need to be a null check / try parse here?

Does there need to be a null check / try parse here?
strtmp.Append(text.Substring(0,frmt2-cnt)); strtmp.Append(text.Substring(0,frmt2-cnt));
else else
+1 -1
View File
@@ -1404,7 +1404,7 @@ namespace Volian.Controls.Library
var pattern = @"\\u([0-9]{1,4})\?"; // RO Editor add symbols C2022 - 003 var pattern = @"\\u([0-9]{1,4})\?"; // RO Editor add symbols C2022 - 003
foreach (Match match in Regex.Matches(linkValue, pattern, RegexOptions.IgnoreCase)) foreach (Match match in Regex.Matches(linkValue, pattern, RegexOptions.IgnoreCase))
{ {
linkValue = linkValue.Replace(match.Value, "\\f1 " + match.Value + " \\f0"); linkValue = linkValue.Replace(match.Value, "\\f1 " + match.Value + "\\f0");
} }
linkValue = linkValue.Replace(@"{", @"\{"); linkValue = linkValue.Replace(@"{", @"\{");