Merge pull request #76 from weyto/master

Adding CR() Function
This commit is contained in:
Nilesh Ghodekar 2019-05-28 12:00:53 +01:00 коммит произвёл GitHub
Родитель 22304489ad bee41eb020
Коммит 4998e1170d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -1293,6 +1293,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
/// </summary>
public const int ExpressionFunctionIndexByValue = 11687;
/// <summary>
/// The event identifier for ExpressionFunction CR events
/// </summary>
public const int ExpressionFunctionCr = 11688;
/// <summary>
/// The event identifier for LookupEvaluator Constructor events
/// </summary>
@ -2753,6 +2758,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
/// </summary>
public const int ExpressionFunctionCrlfInvalidFunctionParameterCountError = 41658;
/// <summary>
/// The event identifier for ExpressionFunction CR events
/// </summary>
public const int ExpressionFunctionCrInvalidFunctionParameterCountError = 41658;
/// <summary>
/// The event identifier for ExpressionFunction EscapeDNComponent events
/// </summary>

Просмотреть файл

@ -168,6 +168,9 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
case "CREATESQLPARAMETER2":
return this.CreateSqlParameter2();
case "CR":
return this.CR();
case "CRLF":
return this.CRLF();
@ -4897,6 +4900,42 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
}
}
/// <summary>
/// This function is used to generate a Carriage Return.
/// Function Syntax: CR()
/// </summary>
/// <returns>A CR is the output.</returns>
private string CR()
{
Logger.Instance.WriteMethodEntry(EventIdentifier.ExpressionFunctionCr, "Evaluation Mode: '{0}'.", this.mode);
try
{
if (this.parameters.Count != 0)
{
throw Logger.Instance.ReportError(EventIdentifier.ExpressionFunctionCrInvalidFunctionParameterCountError, new InvalidFunctionFormatException(Messages.ExpressionFunction_InvalidFunctionParameterCountError, this.function, 0, this.parameters.Count));
}
string result;
if (this.mode != EvaluationMode.Parse)
{
result = "\n";
Logger.Instance.WriteVerbose(EventIdentifier.ExpressionFunctionCr, "CR() returned '{0}'.", result);
}
else
{
result = null;
}
return result;
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.ExpressionFunctionCr, "Evaluation Mode: '{0}'.", this.mode);
}
}
/// <summary>
/// This function is used to generate a Carriage Return/Line Feed.
/// Function Syntax: CRLF()