private ThemeVariableInfo MaterializeVariable(XmlElement xel) { string name = xel.GetAttribute("name"); string value = xel.InnerText; if (name.IsEmpty()) { throw new SmartException("The name attribute is required for the 'Var' element. Affected: '{0}' - element: {1}", _manifest.RootPath, xel.OuterXml); } string type = xel.GetAttribute("type").ToSafe("String"); var varType = ConvertVarType(type, xel, out var selectRef); if (varType != ThemeVariableType.String && value.IsEmpty()) { throw new SmartException("A value is required for non-string 'Var' elements. Affected: '{0}' - element: {1}", _manifest.RootPath, xel.OuterXml); } var info = new ThemeVariableInfo { Name = name, DefaultValue = value, Type = varType, SelectRef = selectRef, Manifest = _manifest }; return(info); }
private ThemeVariableInfo MaterializeVariable(string name, ThemeConfiguration.VariableConfiguration cfg) { string type = cfg.Type.NullEmpty() ?? "String"; var varType = ConvertVarType(type, name, out var selectRef); if (varType != ThemeVariableType.String && cfg.Value.IsEmpty()) { throw new SmartException("A value is required for non-string 'Var' elements. Affected: '{0}' - element: {1}", _manifest.FileProvider.Root, name); } var info = new ThemeVariableInfo { Name = name, DefaultValue = cfg.Value, Type = varType, SelectRef = selectRef, Manifest = _manifest }; return(info); }