private void SynchronizeInputOptions(MaskedTextProvider mtp, bool includePrompt, bool includeLiterals)
{
// Input options are processed in the following order:
// 1. Literals
// 2. Prompts
// 3. Spaces.
// If literals not included in the output, it should not attempt to skip literals.
mtp.SkipLiterals = includeLiterals;
// MaskedTextProvider processes space as follows:
// If it is an input character, it would be processed as such (no scaping).
// If it is a literal, it would be processed first since literals are processed first.
// If it is the same as the prompt, the value of IncludePrompt does not matter because the output
// will be the same; this case should be treated as if IncludePrompt was true. Observe that
// AllowPromptAsInput would not be affected because ResetOnPrompt has higher precedence.
if (mtp.PromptChar == ' ')
{
includePrompt = true;
}
// If prompts are not present in the output, spaces will replace the prompts and will be process
// by ResetOnSpace. Literals characters same as the prompt will be processed as literals first.
// If prompts present positions will be rest.
// Exception: PromptChar == space.
mtp.ResetOnPrompt = includePrompt;
// If no prompts in the output, the input may contain spaces replacing the prompt, reset on space
// should be enabled. If prompts included in the output, spaces will be processed as literals.
// Exception: PromptChar == space.
mtp.ResetOnSpace = !includePrompt;
}
#endif