Supporting logic to handle the use of the backslash character

Supporting logic to handle the use of the backslash character, and question marks
Supporting logic to handle the use of the backslash character, dashes, and symbols
Supporting logic to handle the use of the backslash character and dashes
This commit is contained in:
2016-06-21 15:15:01 +00:00
parent 66b9792324
commit 4c6d09803d
17 changed files with 149 additions and 31 deletions

View File

@@ -48,7 +48,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string itemTitle = Regex.Replace(this.MyItemInfo.SearchPath, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-").Replace(@"\u9586?", @"\");
return string.Format("{0} Annotation {1}", itemTitle, this.ListString());
}
}
@@ -88,7 +88,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string itemTitle = Regex.Replace(this.Path, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-").Replace(@"\u9586?",@"\");
return string.Format("{4} item {0} by {1} on {2} @ {3}", this.ActionWhat, this.UserID, this.ActionWhen == DateTime.MinValue ? this.DTS.ToShortDateString() : this.ActionWhen.ToShortDateString(), this.ActionWhen == DateTime.MinValue ? this.DTS.ToShortTimeString() : this.ActionWhen.ToShortTimeString(), itemTitle);
//return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
//return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");

View File

@@ -78,10 +78,11 @@ namespace VEPROMS.CSLA.Library
Transition.Delete(tran.TransitionID);
break;
}
else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
//else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
else if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")) != (newvalue.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")))
{
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
break; // Text has been processed
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
break; // Text has been processed
}
}
}
@@ -113,7 +114,7 @@ namespace VEPROMS.CSLA.Library
myLength += mg.Groups[3].Length;
}
string gg = MyGrid.Data.Substring(myIndex, myLength);
if (newvalue.Contains(@"\u8209?"))
if (newvalue.Contains(@"\u8209?")) // process dash
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
@@ -121,7 +122,7 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u8593?"))
if (newvalue.Contains(@"\u8593?")) // process carrot/delta
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
@@ -129,6 +130,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8593?", m.Groups[1].Value + @"\u8593?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u9586?")) // process backslash
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
if (gg != newvalue)
{
MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength);
@@ -199,6 +208,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
if (gg.Contains(@"\u9586?")) // process backslash symbol
{
Match mmm = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (mmm == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
Text = part1 + part2 + part3;
break; // Text has been processed
}
@@ -255,6 +272,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
if (gg.Contains(@"\u9586?"))
{
Match mmm = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (mmm == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
Text = part1 + part2 + part3;
break; // Text has been processed
}
@@ -339,6 +364,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
if (gg.Contains(@"\u9586?"))
{
Match mmm = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (mmm == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
//System.Text.RegularExpressions.Group g2 = m.Groups[2];
//if (g2.Value.StartsWith(@"\u8209?"))
//{
@@ -406,6 +439,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u9586?"))
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
if (gg != newvalue)
{
MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength);
@@ -516,6 +557,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8593?", m.Groups[1].Value + @"\u8593?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u9586?"))
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
if (gg != newvalue)
{
retval = gg;
@@ -638,7 +687,8 @@ namespace VEPROMS.CSLA.Library
string gg = Text.Substring(myIndex, myLength);
MyContentMessage = string.Format("ContentExt.ContentInfo:Content:{0}, {1}, {2}", this.ContentID, tran.TransitionID, gg);
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
//if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9586?",@"\\")) != (newvalue.Replace("\\u8209?", "-").Replace(@"\u9586?",@"\\")))
{
_Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
if (newvalue == "?")
@@ -707,6 +757,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8593?", m.Groups[1].Value + @"\u8593?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u9586?"))
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m == null)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
MyGridMessage = string.Format("ContentExt.ContentInfo:Grid:{0}, {1}, {2}", this.ContentID, tran.TransitionID, gg);
if (gg != newvalue)
{
@@ -838,6 +896,14 @@ namespace VEPROMS.CSLA.Library
else
newvalue = newvalue.Replace(@"\u8593?", m.Groups[1].Value + @"\u8593?" + m.Groups[3].Value);
}
if (newvalue.Contains(@"\u9586?"))
{
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
if (m.Groups.Count < 3)
newvalue = newvalue.Replace(@"\u9586?", @"\\");
else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value);
}
if (gg != newvalue)
{
string prefix1 = MyGrid.Data.Substring(0,mmg.Index);

View File

@@ -186,6 +186,13 @@ namespace VEPROMS.CSLA.Library
text =Regex.Replace(text, @"(?<=\\[^\\?' \r\n\t]+)\\u8209\?", " -");
text = text.Replace(@"\u8209?", "-");
}
// Replace backslash symbol with normal backslash so the PDF search for backslashes will work properly
if (text.Contains(@"\u9586?") && epMode == E_EditPrintMode.Print)
{
// Handle RTF Tokens followed immediately by a backslash
text =Regex.Replace(text, @"(?<=\\[^\\?' \r\n\t]+)\\u9586\?", @" \\");
text = text.Replace(@"\u9586?", @"\\");
}
_MyStaticItemInfo = _MyItemInfo;
text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted, underlineAfterDashSpace, epMode);
_MyStaticItemInfo = null;

View File

@@ -2484,6 +2484,7 @@ namespace VEPROMS.CSLA.Library
retval = StripLinks(retval);
retval = ReplaceSpecialCharacters(retval);
retval = retval.Replace("\u2011", "-");
retval = retval.Replace("\u2572", @"\"); // replace backslash symbol with a backslash
retval = Regex.Replace(retval, @"\\line ?", ";"); // better handing of hard returns - replace with semi-colon for use on tree view
retval = retval.Replace("\r\n", ";");
retval = retval.Replace("\n", ";"); //added for consistency checking with approved version
@@ -2931,19 +2932,19 @@ namespace VEPROMS.CSLA.Library
if (MyContent.MyEntry == null)
{
if (DisplayNumber == string.Empty)
return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "...";
return DisplayNumber.Replace("\u2011", "-");
return DisplayText.Replace("\u2011", "-").Replace("\u2572", @"\\").Split(" ,.;:-_".ToCharArray())[0] + "...";
return DisplayNumber.Replace("\u2011", "-").Replace("\u2572", @"\\");
}
if (MyContent.Number != "") // Add LIB to the Section Number
return ((MyContent.MyEntry.MyDocument.LibTitle ?? "") == "" ? "" : "\u1D38\u1D35\u1D2E ") + DisplayNumber;
if (MyContent.MyEntry.MyDocument.LibTitle != "")
{
if (DisplayText.Length <= 7) return "\u1D38\u1D35\u1D2E " + DisplayText.Replace("\u2011", "-");
if (DisplayText.Length <= 7) return "\u1D38\u1D35\u1D2E " + DisplayText.Replace("\u2011", "-").Replace("\u2572", @"\\");
return "\u1D38\u1D35\u1D2E " + DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "...";
}
if (DisplayText.Length <= 10)
return DisplayText.Replace("\u2011", "-");
return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "...";
return DisplayText.Replace("\u2011", "-").Replace("\u2572", @"\\");
return DisplayText.Replace("\u2011", "-").Replace("\u2572", @"\\").Split(" ,.;:-_".ToCharArray())[0] + "...";
}
}
#endregion