This commit is contained in:
2010-03-25 14:48:46 +00:00
parent b10ade8a14
commit 2830a93e24
7 changed files with 164 additions and 31 deletions

View File

@@ -306,6 +306,7 @@ namespace VEPROMS.CSLA.Library
_AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr);
_AppendMethods.Add("{Sect Title}", AddTranGetSectionHdr);
_AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionHdr);
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
}
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
{
@@ -325,6 +326,8 @@ namespace VEPROMS.CSLA.Library
tb._FormatData = formatInfo.PlantFormat.FormatData;
// get the format of the transition string based on this transition's index into the TransData part of
// format....
if (tranType > tb._FormatData.TransData.TransTypeList.Count)
tranType = 0;
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat;
tb._TransUI = (E_TransUI)tb._FormatData.TransData.TransTypeList[tranType].TransUI;
tb._FromItem = fromInfo;
@@ -342,10 +345,18 @@ namespace VEPROMS.CSLA.Library
while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1)
{
if (index > startIndex) nonToken = tb._TransFormat.Substring(startIndex, index - startIndex);
if (startIndex == 0 && nonToken != null && nonToken.Length > 0)
{
tb._Results.Append(nonToken);
//textAdded = true;
nonToken = "";
}
int endtokn = tb._TransFormat.IndexOf("}", index);
string token = tb._TransFormat.Substring(index, endtokn - index + 1);
if (_AppendMethods.ContainsKey(token))
textAdded = _AppendMethods[token](textAdded, tb, token, nonToken);
else
tb._Results.Append("\\"+token.Substring(0,token.Length -1)+"\\}");
startIndex = endtokn + 1;
if (startIndex >= tb._TransFormat.Length) break;
}
@@ -548,6 +559,14 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
private static bool AddTranGetSectionNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
{
string retstr = TranGetSectionNumber(tb._ToItem);
if (textAdded) Append(tb, nonToken, false);
Append(tb, retstr, true);
if (retstr != null && retstr != "") return true;
return false;
}
private static string CapFirstLetterOnly(string retstr, int p)
{
string lretstr = retstr;