diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index e58c921a..27925aae 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -253,8 +253,6 @@ namespace Volian.Controls.Library } private string DoTransitionAdjustments(string text) { - if (_MyItemInfo.ItemID == 230 || _MyItemInfo.ItemID == 154 || _MyItemInfo.ItemID == 1932) - Console.Write(""); string strippedText = StaticStripRtfCommands(text); string lookFor = string.Format(@""); MatchCollection matches = Regex.Matches(text, lookFor); @@ -1163,153 +1161,153 @@ namespace Volian.Controls.Library } #endregion #region ReplaceWords - private string DoReplaceWords(string Text) - { - ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList; - foreach (ReplaceStr rs in rsl) - { - if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps. - bool replaceit = false; + //private string DoReplaceWords(string Text) + //{ + // ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList; + // foreach (ReplaceStr rs in rsl) + // { + // if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps. + // bool replaceit = false; - // note that the order of this check is important. Check in this order... - // background here - if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High)>0) replaceit = true; - else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true; - else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true; - else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true; - else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true; - else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; - //else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; - else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true; + // if (_MyItemInfo.ItemID == 2557) Console.WriteLine("here"); + // // note that the order of this check is important. Check in this order... + // // background here + // if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High)>0) replaceit = true; + // else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true; + // else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true; + // else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true; + // else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true; + // else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; + // //else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; + // else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true; - if (replaceit) - { - // CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace - // with the ReplaceWith string as is - if ((rs.Flag & E_ReplaceFlags.CaseInsens) > 0) - { - //string res = ""; - //string fortest = Text.ToUpper(); - ////string pat = @"(?<=\W|^)" + rs.ReplaceWord.ToUpper() + @"(?=\W|$)"; - //// jsj 07Jun2010 HardSpaces defeat replaceword logic - //string pat = @"(?<=\W|^)(? 0) + // { + // //string res = ""; + // //string fortest = Text.ToUpper(); + // ////string pat = @"(?<=\W|^)" + rs.ReplaceWord.ToUpper() + @"(?=\W|$)"; + // //// jsj 07Jun2010 HardSpaces defeat replaceword logic + // //string pat = @"(?<=\W|^)(? 0) - { - // only in Maine Yankee - we don't need to do this one. - } - // CASEINSENSFIRST: Do ReplaceWords for all words that exactly match the ReplaceWord, - // except the case where the first character may be different - else if ((rs.Flag & E_ReplaceFlags.CaseInsensFirst) > 0) - { - // only used in V.C. Summer - we don't need to do this either. - } - else - { - // If there are Regex Control Characters '\[]()' prefix them with backslash - string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0"); - //string pat = @"(?<=\W|^)" + replaceWord + @"(?=\W|$)"; - // jsj 07Jun2010 HardSpaces defeat replaceword logic - //string pat = @"(?<=\W|^)(? 0) + // { + // // only in Maine Yankee - we don't need to do this one. + // } + // // CASEINSENSFIRST: Do ReplaceWords for all words that exactly match the ReplaceWord, + // // except the case where the first character may be different + // else if ((rs.Flag & E_ReplaceFlags.CaseInsensFirst) > 0) + // { + // // only used in V.C. Summer - we don't need to do this either. + // } + // else + // { + // // If there are Regex Control Characters '\[]()' prefix them with backslash + // string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0"); + // //string pat = @"(?<=\W|^)" + replaceWord + @"(?=\W|$)"; + // // jsj 07Jun2010 HardSpaces defeat replaceword logic + // //string pat = @"(?<=\W|^)(? 0) replaceit = true; - else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true; - else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true; - else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true; - else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true; - else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; - //else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; - else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true; + // // note that the order of this check is important. Check in this order... + // // background here + // if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High) > 0) replaceit = true; + // else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true; + // else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true; + // else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true; + // else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true; + // else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; + // //else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; + // else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true; - if (replaceit) - { - // CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is - RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None; - string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0"); - string pat = @"(?<=\W|^)(? dicReplaceRegex = new Dictionary(); private string DoReplaceWords2(string Text) { if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps. FoundMatches myMatches = new FoundMatches(Text); - myMatches.Add(regFindLink, null); + //KBR myMatches.Add(regFindLink, null); ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList; // Loop through text looking for words to be replaced foreach (ReplaceStr rs in rsl) { bool replaceit = false; - // note that the order of this check is important. Check in this order... // background here if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High) > 0) replaceit = true; @@ -1326,20 +1324,20 @@ namespace Volian.Controls.Library if (!dicReplaceRegex.ContainsKey(rs)) { // CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is - RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None; + //RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline; + RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase: RegexOptions.None; string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0"); string pat = @"(?<=\W|^)(? myLink.Index && myMatch.Index < (myLink.Index + myLink.Length)) return true;