Esempio n. 1
0
        public ITask Parse(System.Xml.Linq.XElement declaration)
        {
            if (declaration == null)
            {
                throw new ArgumentNullException("Отсутствует определение задачи");
            }

            if (declaration.Attribute("template") != null)
            {
                _template = declaration.Attribute("template").Value;
            }

            if (declaration.Attribute("templateFile") != null)
            {
                _templateFile = declaration.Attribute("templateFile").Value;
            }

            _outputParam = declaration.Attribute("outputParam").Value;

            var tmpParams = declaration.XPathSelectElements("//Param");

            if (tmpParams.Any())
            {
                _paramsDescription = new List <ParameterDescription>();
                foreach (var param in tmpParams)
                {
                    _paramsDescription.Add(new ParameterDescription()
                    {
                        Name       = param.Attribute("name").Value,
                        FilePath   = param.Attribute("file").Value,
                        HasHeaders = bool.Parse(param.Attribute("headerRow").Value),
                        Mode       = param.Attribute("mode") == null ? "text" : param.Attribute("mode").Value.ToLower(CultureInfo.InvariantCulture),
                        Encoding   = param.Attribute("encoding") == null ? null : param.Attribute("encoding").Value.ToLower(CultureInfo.InvariantCulture),
                    });
                }
            }


            return(this);
        }