Changes CreateRtf method of DisplayText class to handle U_ID and S\u8902?ID text in display text

Returns text changed in CreateRtf method of DisplayText class
Created DoSearchAndReplace method to DisplayText class
Added logging support to FoundMatches class
This commit is contained in:
Rich 2012-12-04 23:04:40 +00:00
parent 3ca571fab4
commit 308ccc9eaa

View File

@ -137,7 +137,7 @@ namespace Volian.Controls.Library
// lines (the 2 spaces after the first "\par " command and 1 space before 2nd "\par"). Tried other
// combinations that did not work.
if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "")
text = ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Prefix) + @"\par " + text + @" \par ";
text = ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Prefix) + @"\par " + text + @"\par ";
if (_MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
text = text + ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Suffix);
}
@ -199,6 +199,12 @@ namespace Volian.Controls.Library
// actual edit mode are replace words left as is.
if (wordsShouldBeReplaced)
text = DoReplaceWords2(text);
if (_MyItemInfo != null)
{
text = DoSearchAndReplace(text, "<U-ID>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ID);
text = text.Replace(@"<S\u8209?ID>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ProcedureSetID);
text = text.Replace("<U>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Number);
}
// Adjust RO display
if (ROsShouldBeAdjusted)
text = DoTransitionAdjustments(text);
@ -253,9 +259,13 @@ namespace Volian.Controls.Library
indxsym = NextUnicode(text, indxsym + incrindx);//text.IndexOf(@"\u", indxsym + incrindx);
}
}
return text;
}
private string DoSearchAndReplace(string text, string find, string replace)
{
return text.Replace(find, replace);
}
private static string DoColorLinks(string text)
{
string origtext = text;
@ -1581,6 +1591,7 @@ namespace Volian.Controls.Library
#endregion
public class FoundMatches : SortedList<int, FoundMatch>
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private string _Text;
public FoundMatches(string text)
: base()