public static List <IOperationProvider> ConfigureFromJObject(JObject rawConfiguration)
        {
            string startToken = rawConfiguration.ToString("startToken");
            string endToken   = rawConfiguration.ToString("endToken");

            if (string.IsNullOrWhiteSpace(startToken))
            {
                throw new TemplateAuthoringException($"Template authoring error. StartToken must be defined", "StartToken");
            }
            else if (string.IsNullOrWhiteSpace(endToken))
            {
                throw new TemplateAuthoringException($"Template authoring error. EndToken must be defined", "EndToken");
            }

            string pseudoEndToken = rawConfiguration.ToString("pseudoEndToken");

            ConditionalKeywords         keywords = ConditionalKeywords.FromJObject(rawConfiguration);
            ConditionalOperationOptions options  = ConditionalOperationOptions.FromJObject(rawConfiguration);

            if (string.IsNullOrWhiteSpace(pseudoEndToken))
            {
                return(GenerateConditionalSetup(startToken, endToken, keywords, options));
            }
            else
            {
                return(GenerateConditionalSetup(startToken, endToken, pseudoEndToken, keywords, options));
            }
        }
Esempio n. 2
0
        public static List <IOperationProvider> ConfigureFromJObject(JObject rawConfiguration)
        {
            string token = rawConfiguration.ToString("token");

            if (string.IsNullOrWhiteSpace(token))
            {   // this is the only required data, all the rest is optional
                throw new TemplateAuthoringException("Template authoring error. Token must be defined", "token");
            }

            ConditionalKeywords         keywords = ConditionalKeywords.FromJObject(rawConfiguration);
            ConditionalOperationOptions options  = ConditionalOperationOptions.FromJObject(rawConfiguration);

            return(GenerateConditionalSetup(token, keywords, options));
        }