public void sText(ltext tokenInLanguage) { int i = 0; int iCount = m_sText.Length; for (i = 0; i < iCount; i++) { if (i < tokenInLanguage.sText_Length) { m_sText[i] = tokenInLanguage.sText(i); } } }
public TemplateToken(ltext token_prefix, ltext TokenInLanguage, object Replacement, string sFormat) { lt = new ltext(); lt.sText(TokenInLanguage); if (token_prefix != null) { int i = 0; int iCount = lt.sText_Length; for (i = 0; i < iCount; i++) { if (TokenInLanguage.sText(i) != null) { if (TokenInLanguage.sText(i).Contains(START_TAG)) { continue; } else { string token = null; token = START_TAG + token_prefix.sText(i) + "_" + TokenInLanguage.sText(i)+ END_TAG; lt.sText(i,token); } } } } else { int i = 0; int iCount = lt.sText_Length; for (i = 0; i < iCount; i++) { if (TokenInLanguage.sText(i) != null) { if (TokenInLanguage.sText(i).Contains(START_TAG)) { continue; } else { string token = null; token = START_TAG + TokenInLanguage.sText(i) + END_TAG; lt.sText(i,token); } } } } if (Replacement is string) { replacement = (string) Replacement; } else if (Replacement is int) { replacement = Convert.ToString(Replacement); } else if (Replacement is DateTime) { DateTime time = (DateTime)Replacement; if (sFormat != null) { if (sFormat.Equals("YYYY-MM-DD")) { replacement = GetString(time.Year, 4) + "-" + GetString(time.Month, 2) + "-" + GetString(time.Day, 2); } } } }