From 4c6d09803d303e7e4017567a11a6cf9255d969f4 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 21 Jun 2016 15:15:01 +0000 Subject: [PATCH] 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 --- PROMS/DataLoader/PROMSFixes.Sql | 23 +++++- .../VEPROMS User Interface/dlgExportImport.cs | 6 +- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 2 +- .../Config/ROFSTLookup.cs | 2 + .../Extension/AuditExt.cs | 4 +- .../Extension/ContentExt.cs | 78 +++++++++++++++++-- .../Extension/DisplayText.cs | 7 ++ .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 11 +-- .../Volian.Controls.Library/DisplayHistory.cs | 2 +- PROMS/Volian.Controls.Library/DisplayRO.cs | 2 +- .../Volian.Controls.Library/DisplaySearch.cs | 4 +- .../Volian.Controls.Library/DisplayTabItem.cs | 6 +- PROMS/Volian.Controls.Library/FindReplace.cs | 18 ++++- PROMS/Volian.Controls.Library/StepRTB.cs | 9 ++- PROMS/Volian.Controls.Library/StepTabPanel.cs | 3 +- PROMS/Volian.Controls.Library/VlnFlexGrid.cs | 1 + PROMS/Volian.Controls.Library/vlnTreeView.cs | 2 +- 17 files changed, 149 insertions(+), 31 deletions(-) diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index a0efd1e6..fe9ba473 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -1017,6 +1017,7 @@ BEGIN Set @SearchString = replace(@SearchString,'\%','*') Set @SearchString = replace(@SearchString,'\_','?') Set @SearchString = replace(@SearchString,'-','\u8209?') + Set @SearchString = replace(@SearchString,'\','\u9586?') IF(@SearchString like '[%]%') RETURN @SearchString IF(@SearchString like '%[%]') RETURN @SearchString Set @SearchString = replace('%' + @SearchString + '%','%%','%') @@ -2952,11 +2953,18 @@ RETURNS @FoundContents TABLE WITH EXECUTE AS OWNER AS BEGIN +DECLARE @Dashes varchar(25) +set @Dashes = '\u8209?' +if(@SearchString not like '%\u8209?%') +BEGIN +set @Dashes='-' +END IF(ISNULL(@DocVersionList,'')='') BEGIN INSERT INTO @FoundContents -- Do a case insensitive search select ContentID,Type,Text from contents - where .dbo.vefn_RemoveExtraText(Replace([Text],'-','\u8209?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS + where replace(.dbo.vefn_RemoveExtraText(Replace([Text],'-','\u8209?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters),'\u8209?',@Dashes) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS + --where .dbo.vefn_RemoveExtraText(Replace(Replace([Text],'-','\u8209?'),'\','\u9586?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS -- where Replace([Text],'-','\u8209?') like @SearchString Collate SQL_Latin1_General_CP1_CI_AS --where Replace(Replace([Text],'-','\u8209?'),'\u160?',' ') like @SearchString Collate SQL_Latin1_General_CP1_CI_AS END @@ -2966,7 +2974,8 @@ ELSE select ContentID,Type,Text from contents where [ContentID] in (select [ContentID] from vefn_DVContent(@DocVersionList)) -- bug fix B2014-056 and B2014-102 now use vefn_RemoveExtraText which fixes searching for hard spaces and finding procedure text when it is bolded (or italics or underlined etc) - AND .dbo.vefn_RemoveExtraText(Replace([Text],'-','\u8209?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS + AND Replace(.dbo.vefn_RemoveExtraText(Replace([Text],'-','\u8209?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters),'\u8209?',@Dashes) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS + --AND .dbo.vefn_RemoveExtraText(Replace(Replace([Text],'-','\u8209?'),'\','\u9586?'),@IncludeLinks, @IncludeRtfFormatting, @IncludeSpecialCharacters) like @SearchString Collate SQL_Latin1_General_CP1_CI_AS --AND Replace([Text],'-','\u8209?') like @SearchString Collate SQL_Latin1_General_CP1_CI_AS --AND Replace(Replace([Text],'-','\u8209?'),'\u160?',' ') like @SearchString Collate SQL_Latin1_General_CP1_CI_AS END @@ -3023,6 +3032,7 @@ ELSE BEGIN Declare @SearchStringx nvarchar(200) --kbr set @SearchStringx = replace(@SearchString,'-','\u8209?') --kbr + --set @SearchStringx = replace(replace(@SearchString,'-','\u8209?'),'\','\u9586?') --kbr IF @CaseSensitive = 0 -- Not Case Sensitive BEGIN insert into @FoundContents @@ -5845,6 +5855,7 @@ BEGIN TRY -- Try Block ) DECLARE @NewTopID as int INSERT INTO @Procs select ZZ.ItemID, isnull(Replace(CC.Number,'\u8209?','-'),'') + ':' + substring('0000000000000000' + cast(ItemID as varchar(16)), 1+ len( cast(ItemID as varchar(16))), 16) ProcNum from vefn_SiblingItems(@TopID,0) ZZ Join Contents CC on CC.ContentID = ZZ.ContentID + --INSERT INTO @Procs select ZZ.ItemID, isnull(Replace(Replace(CC.Number,'\u8209?','-'),'\','\u9586?'),'') + ':' + substring('0000000000000000' + cast(ItemID as varchar(16)), 1+ len( cast(ItemID as varchar(16))), 16) ProcNum from vefn_SiblingItems(@TopID,0) ZZ Join Contents CC on CC.ContentID = ZZ.ContentID --select * from @Procs order by ProcNum + cast(ItemID as nvarchar(max)) select top 1 @NewTopID = ItemID from @Procs order by ProcNum INSERT INTO @Organize @@ -5896,6 +5907,7 @@ DECLARE @index int DECLARE @index2 int -- Replace Hard Hyphen with Hyphen SET @text = replace(@text,'\u8209?','-') +--SET @text = replace(replace(@text,'\u8209?','-'),'\u9586?','\') -- Replace Hard Space with Space -- commenting out the bottom two lines will fix the global search for hard space bug (B2014-056) --SET @text = replace(@text,'\u160?',' ') @@ -5965,6 +5977,7 @@ if(@includeSpecialCharacters=0) END -- Replace Hyphen with Hard Hyphen SET @text = replace(@text,'-','\u8209?') +--SET @text = replace(replace(@text,'-','\u8209?'),'\','\u9586?') RETURN @text END @@ -11008,7 +11021,7 @@ with Itemz(ItemCount,ItemID,PreviousID,FromType,CType,Number,Text,PPath, Path) a ) select @Path = path From Itemz where ItemCount=1 and CType=0 OPTION (MAXRECURSION 10000) -return REPLACE(@Path,'\u8209?','-') +return REPLACE(REPLACE(@Path,'\u8209?','-'),'u9586?','\\') END; GO -- Display the status of Proc creation @@ -12335,6 +12348,7 @@ BEGIN insert into @EnhancedDocuments select VN.VersionID,VN.FolderName, VI.ItemID , replace(cc.Number,'\u8209?','-') ProcNum, replace(cc.Text,'\u8209?','-') ProcName +--, replace(replace(cc.Number,'\u8209?','-'),'\u9586?','\') ProcNum, replace(replace(cc.Text,'\u8209?','-'),'\u9586?','\') ProcName , xEnhanced.value('@Type','int') EnhType, xenhanced.value('@ItemID','int') EnhItemID --, xEnhanced.query('.') qEnhanced from (select *, cast(config as xml) xconfig from Contents Where config like '%Enhanced%' and Type =0) CC @@ -12696,6 +12710,7 @@ AS BEGIN declare @ProcNum varchar(255) select @ProcNum = replace(Number,'\u8209?','-') from contents CC + --select @ProcNum = replace(replace(Number,'\u8209?','-'),'\u9586?','\') from contents CC join Items II on II.ContentID = CC.ContentID Where ItemID = @ItemID Begin @@ -12767,9 +12782,11 @@ Insert into @EnhItems-- Procedures select @SourceID SrcItemID, (select ContentID from Items Where ItemID = @SourceID) SrcContentID ,'' SrcConfig ,isnull(VSO.ProcName,replace(CCS.Number,'\u8209?','-')) SrcProcName, null SrcRecID + --,isnull(VSO.ProcName,replace(replace(CCS.Number,'\u8209?','-'),'\u9586?','\')) SrcProcName, null SrcRecID ,@EnhanceID EnhItemID, (select ContentID from Items Where ItemID = @EnhanceID) EnhContentID ,'' EnhConfig ,isnull(VEO.ProcName ,replace(CCE.Number,'\u8209?','-')) EnhProcNam, null EnhRecID + --,isnull(VEO.ProcName ,replace(replace(CCE.Number,'\u8209?','-'),'\u9586?','\')) EnhProcNam, null EnhRecID From vefn_GetOldEnhancedData(@SourceID) VSO cross apply vefn_GetOldEnhancedData(@EnhanceID) VEO JOIN Contents CCS ON VSO.ContentID = CCs.ContentID diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 692ea825..50341c0d 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -119,7 +119,7 @@ namespace VEPROMS } else if (MyProcedure != null) { - txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_")); + txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\","_")); } } private void txtExport_TextChanged(object sender, EventArgs e) @@ -279,7 +279,7 @@ namespace VEPROMS // procedure numbers that contain a hyphen may have the hyphen represented as the unicode character // '\u8209?' or the '-' character. If proc number is same except for hyphen representation, they // should be considered the same procedure (fix for B2016-084) - string hyphenNum = pi.MyContent.Number == null ? "" : pi.MyContent.Number.Replace(@"\u8209?", "-").Replace("\u2011", "-"); + string hyphenNum = pi.MyContent.Number == null ? "" : pi.MyContent.Number.Replace(@"\u8209?", "-").Replace("\u2011", "-").Replace("\u9586?","_").Replace("\u2572", @"\"); string hyphenImpNum = xd.SelectSingleNode("procedure/content/@number").InnerText; // bug fix C2015-044 - jsj // - the cancel button would ignor the user's wishes and proceed with the import (overwriting the existing procedure) @@ -287,7 +287,7 @@ namespace VEPROMS // - our standard unicode dash (\u8209?) before conparing the existing and imported // - also found the Overrite and make a copy of messages looked too similar - fixed that as well. //hyphenImpNum = hyphenImpNum == null ? "" : hyphenImpNum.Replace("\u8030?", "-"); -did not find any reason to have this \u8030? - note retested sourcesafe doc for B2016-084 without this logic and it was fine - hyphenImpNum = hyphenImpNum == null ? "" : hyphenImpNum.Replace(@"\u8209?", "-").Replace("\u2011", "-"); + hyphenImpNum = hyphenImpNum == null ? "" : hyphenImpNum.Replace(@"\u8209?", "-").Replace("\u2011", "-").Replace(@"\u9586?", @"\").Replace("\u2572", @"\"); if (hyphenNum == hyphenImpNum) { diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index cdbe69fc..3114c506 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -2183,7 +2183,7 @@ namespace VEPROMS { MostRecentItem mri = _MyMRIList[i]; ButtonItem btnItem = new ButtonItem(); - string menuTitle = mri.MenuTitle.Replace("\u2011", "-"); + string menuTitle = mri.MenuTitle.Replace("\u2011", "-").Replace("\u2572", @"\"); if (i < 9) btnItem.Text = string.Format("&{0}. {1}", i + 1, menuTitle); else diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs index 5a81ad76..8d431fbe 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs @@ -273,6 +273,8 @@ namespace VEPROMS.CSLA.Library //if the dash is preceeded byte a token remove the space following the token s2 = Regex.Replace(s2, @"(\\[^ \\?]*) \-", @"$1\u8209?"); s2 = s2.Replace("-", @"\u8209?"); + // convert backslashes to a backslash symbol + s2 = s2.Replace(@"\", @"\u9586?"); return s2; } private string FixUnitROs(string val) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs index 20d9d4a5..10d3807f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs @@ -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"); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index b8d5ab74..041b1e72 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -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); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 111f997e..8771250c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -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; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 90446767..5f5c519d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -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 diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.cs b/PROMS/Volian.Controls.Library/DisplayHistory.cs index bfa7a793..7c7eb75d 100644 --- a/PROMS/Volian.Controls.Library/DisplayHistory.cs +++ b/PROMS/Volian.Controls.Library/DisplayHistory.cs @@ -559,7 +559,7 @@ namespace Volian.Controls.Library private static string FixPath(string path) { string itemTitle = Regex.Replace(path, "^..+?\\u0007", ""); - itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-"); + itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace(@"\u8209?", "-").Replace(@"\u9586?",@"\"); return itemTitle; } private void btnViewChronologyReport_Click(object sender, EventArgs e) diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index efed110e..d6326b84 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -119,7 +119,7 @@ namespace Volian.Controls.Library //Spin through ROs looking for the selected text if (MyRTB.SelectedText != "") { - string lookFor = MyRTB.SelectedText.Replace('\u2011', '-'); + string lookFor = MyRTB.SelectedText.Replace('\u2011', '-').Replace(@"\u9586?", @"\\"); List children = null; if (_MyROFST != null) children = _MyROFST.GetROFSTLookup(Mydvi).GetRosByValue(lookFor); if (children != null) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 9054f4ae..44828a5e 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -1236,7 +1236,7 @@ namespace Volian.Controls.Library Cursor = Cursors.WaitCursor; SearchResults = null; bool includeRTFformat = false; - bool includeSpecialChars = true; + bool includeSpecialChars = (TextSearchString != @"\?"); // true; // Build list of selected types that were searched string typstr = null; foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s; @@ -1287,7 +1287,7 @@ namespace Volian.Controls.Library SearchString = TextSearchString; //TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types"; //TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types"); - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix); + SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix); cmbResultsStyleIndex = 3; // display step text in results //} } diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs index 257a6c73..2ae8c564 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs @@ -241,7 +241,7 @@ namespace Volian.Controls.Library Name = "tabItem Item " + _MyItemInfo.ItemID; Text = _MyItemInfo.TabTitle; _MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed); - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-"); + Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); LostFocus += new EventHandler(DisplayTabItem_LostFocus); // @@ -276,7 +276,7 @@ namespace Volian.Controls.Library void _MyItemInfo_Changed(object sender) { Text = _MyItemInfo.TabTitle; - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-"); + Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); } void DisplayTabItem_LostFocus(object sender, EventArgs e) { @@ -308,7 +308,7 @@ namespace Volian.Controls.Library Control = _MyDSOTabPanel; Name = "tabItem Item " + _MyItemInfo.ItemID; Text = _MyItemInfo.TabTitle; - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-"); + Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); LostFocus += new EventHandler(DisplayTabItem_LostFocus); _MyDisplayTabControl.Controls.Add(_MyDSOTabPanel); diff --git a/PROMS/Volian.Controls.Library/FindReplace.cs b/PROMS/Volian.Controls.Library/FindReplace.cs index 99000dc3..9d57409e 100644 --- a/PROMS/Volian.Controls.Library/FindReplace.cs +++ b/PROMS/Volian.Controls.Library/FindReplace.cs @@ -174,16 +174,32 @@ namespace Volian.Controls.Library doingfind = false; this.Visible = false; } + private string FixSymbol(string str) + { + StringBuilder sb = new StringBuilder(); + foreach (char c in str) + { + if (c > 0xff) + sb.Append(string.Format(@"\u{0}?", (int)c)); + else + sb.Append(c); + } + return sb.ToString(); + } private void btnFindNext_Click(object sender, EventArgs e) { AddToComboLists(); doingfind = true; + string fndStr = FixSymbol(cmboFindText.Text.Replace(@"\", @"\u9586?").Replace("-", @"\u8209?").Replace("\xa0", @"\u160?")); while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked)) { ItemInfo next = (cbxReverse.Checked) ? MyEditItem.MyItemInfo.SearchPrev : MyEditItem.MyItemInfo.SearchNext; - while ((next != null) && !next.IsSection && !next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper())) + while ((next != null) && !next.IsSection && !next.MyContent.Text.Contains(fndStr)) + { next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext; + } + if (next != null) Console.WriteLine("next {0} {1}", next.ItemID, next.MyContent.Text); if ((next == null) || next.IsSection) { if (!findingbookmarks) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 9725eac1..30b3be6b 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -1235,6 +1235,7 @@ namespace Volian.Controls.Library int position = SelectionStart; SelectionLength = 0; linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 "); + linkValue = linkValue.Replace("\\u9586?", "\\f1\\u9586?\\f0 "); // backslash symbol linkValue = linkValue.Replace("\\u916?", "\\f1\\u916?\\f0 "); linkValue = linkValue.Replace(@"{", @"\{"); linkValue = linkValue.Replace(@"}", @"\}"); @@ -1939,6 +1940,7 @@ namespace Volian.Controls.Library using (StepRTB srtb = new StepRTB()) { srtb.Rtf = this.SelectedRtf.Replace(@"\u8209?", "-"); + srtb.Rtf = srtb.Rtf.Replace(@"\u9586?", @"\\"); string rtnstr = ""; string ctxt = srtb.Text;//this.SelectedText; if (ctxt.EndsWith("= ' ') @@ -2445,7 +2449,8 @@ namespace Volian.Controls.Library else if (e.KeyChar == '}') AddRtf(@"\}"); else if (e.KeyChar == '\\') - AddRtf(@"\\"); + AddSymbol(@"\u9586?"); // unicode hex 2572 + //AddRtf(@"\\"); else return; e.Handled = true; // flag that it's been handled, otherwise, will get 2 chars. @@ -2504,6 +2509,7 @@ namespace Volian.Controls.Library ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen + ptext = ptext.Replace("\u2572", "\\"); // Replace backslash symbol with backslash character if (didCharReplace) MessageBox.Show("Replacing pasted characters that are not supported by Proms with a '?'."); return ptext; @@ -2750,6 +2756,7 @@ namespace Volian.Controls.Library bool keepgoing = true; while (keepgoing) { + str = str.Replace("\\", "\u2572").Replace("-","\u2011"); int pos = savRTF.Find(str, startpos, _FindOptions); keepgoing = false; if (pos >= 0) diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index 8ac58e5f..2e837321 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -98,8 +98,9 @@ namespace Volian.Controls.Library grd.SetSearchCell(SearchString); } // convert the '-' to the unicode non-breaking dash (\u8209? or \u2011 hex) + // and the '\' to the unicode backslash sybol (\u9586? or \u2572 hex) if (!SelectedEditItem.MyStepRTB.IsRoTable) - SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-','\u2011')); + SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-', '\u2011').Replace('\\','\u2572')); } #endregion #region Contructors diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index 1a0045d7..c92b0495 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -3660,6 +3660,7 @@ namespace Volian.Controls.Library // Now change the Unicode symbols to DOS symbols stepText = stepText.Replace(@"\u8209?", "-"); + stepText = stepText.Replace(@"\u9586?", "\\"); stepText = stepText.Replace(@"\u9474?", "\xB3"); // Vert Line graphic character stepText = stepText.Replace(@"\'b0", "\xB0"); stepText = stepText.Replace(@"\up2 ", "\x9566"); diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index ae0decd7..ca61a596 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -1217,7 +1217,7 @@ namespace Volian.Controls.Library string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; DirectoryInfo di = new DirectoryInfo(PEIPath); if (!di.Exists) di.Create(); - string fileName = PEIPath + "\\Approved_Rev_" + ri.RevisionNumber.Replace(" ","_") + "_" + xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ","_").Replace(@"\u8209?", "-")+".pxml"; + string fileName = PEIPath + "\\Approved_Rev_" + ri.RevisionNumber.Replace(" ","_") + "_" + xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ","_").Replace(@"\u8209?", "-").Replace(@"\u9586?","_")+".pxml"; xd.Save(fileName); MessageBox.Show("Approved procedure saved to import file " + fileName,"Saving TempMod", MessageBoxButtons.OK, MessageBoxIcon.Information); }