Transformer.NET.TextTransformer.ApplyConfig C# (CSharp) Method

ApplyConfig() protected method

protected ApplyConfig ( TextTransformerConfig config ) : void
config TextTransformerConfig
return void
        protected virtual void ApplyConfig(TextTransformerConfig config)
        {
            if (config == null)
            {
                return;
            }

            if (config.TokensRegex != null)
            {
                this.TokensRegex = config.TokensRegex;
            }

            if (config.VariablesRegex != null)
            {
                this.VarsRegex = config.VariablesRegex;
            }

            if (config.AnchorsRegex != null)
            {
                this.AnchorsRegex = config.AnchorsRegex;
            }

            if (config.Selectors != null)
            {
                foreach (string key in config.Selectors.Keys)
                {
                    this.Selectors.Add(key, config.Selectors[key]);
                }
            }

            if (config.Variables != null)
            {
                foreach (string key in config.Variables.Keys)
                {
                    this.Variables.Add(key, config.Variables[key]);
                }
            }

            if (config.DefaultTemplates != null)
            {
                foreach (string key in config.DefaultTemplates.Keys)
                {
                    this.DefaultTemplates.Add(key, config.DefaultTemplates[key]);
                }
            }

            if (config.TokensType != null)
            {
                this.TokensType.AddRange(config.TokensType);
            }

            if (config.SkipValidation.HasValue)
            {
                this.SkipValidation = config.SkipValidation.Value;
            }
        }