System.ComponentModel.MaskedTextProvider.SynchronizeInputOptions C# (CSharp) Method

SynchronizeInputOptions() private method

Upadate the input processing options according to the output formatting options to guarantee text round-tripping, this is: the Text property does not change when setting it to the value obtain from it; for a control: when copying the text to the clipboard and then pasting it back while selecting the entire text.
private SynchronizeInputOptions ( MaskedTextProvider mtp, bool includePrompt, bool includeLiterals ) : void
mtp MaskedTextProvider
includePrompt bool
includeLiterals bool
return void
        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