public void TakeUserInput(List <Template.TemplateInfo.UserVariable> userInputs)
 {
     if (userInputs != null)
     {
         List <Template.TemplateInfo.UserVariable> duplicates = new List <Template.TemplateInfo.UserVariable>();
         foreach (Template.TemplateInfo.UserVariable userVar in userVariables)
         {
             var uvs = userInputs.Where(x => x.name == userVar.name); // usually there should be one userInput for each UserVariable in the template
             if (uvs.Any())                                           // but for PET we require user-input per package and reform
             {
                 userVar.value                   = uvs.First().value;
                 userVar.description             = uvs.First().description;
                 userVar.forEachValueDescription = uvs.First().forEachValueDescription;
                 userVar.reformNumber            = uvs.First().reformNumber;
                 userVar.packageKey              = uvs.First().packageKey;
                 foreach (var uv in uvs.Skip(1)) // no need for this if there isn't user-input per package and/or reform
                 {
                     Template.TemplateInfo.UserVariable duv = new Template.TemplateInfo.UserVariable(userVar)
                     {
                         value        = uv.value,
                         description  = uv.description,
                         reformNumber = uv.reformNumber,
                         packageKey   = uv.packageKey
                     };
                     userVar.forEachValueDescription = uvs.First().forEachValueDescription;
                     duplicates.Add(duv);
                 }
             }
         }
         userVariables.AddRange(duplicates);
     }
 }
        private static Template.TemplateInfo.UserVariable ReadUserVariable(XElement xeUV, ErrorCollector errorCollector)
        {
            Template.TemplateInfo.UserVariable uv = new Template.TemplateInfo.UserVariable();
            foreach (XElement xe in xeUV.Elements())
            {
                if (xe.Value == null)
                {
                    continue;
                }
                switch (GetXEleName(xe))
                {
                case "UserInputType": uv.inputType = errorCollector.XEleGetEnum <HardDefinitions.UserInputType>(xe, xeUV, uv.name); break;

                case "Name": uv.name = xe.Value; break;

                case "Description": uv.description = xe.Value; break;

                case "Title": uv.title = xe.Value; break;

                case "DefaultValue": uv.defaultValue = xe.Value; break;

                case "DisplayDescription": uv.displayDescription = errorCollector.XEleGetBool(xe, xeUV, uv.name); break;

                case "ComboItems": uv.comboItems = ReadElementGroup(xe, ReadComboItem, errorCollector); break;

                default: errorCollector.AddXmlUnkownEleError(xe, xeUV, uv.name); break;
                }
            }
            return(uv);
        }