Exemplo n.º 1
0
        public FileTemplate(FileInfo fileInfo, bool isHeader)
        {
            IsHeader   = isHeader;
            FileInfo   = fileInfo;
            Attributes = new List <Attribute>();

            Content = new FileTemplateReader(fileInfo).Read(
                (type, val) =>
            {
                switch (type)
                {
                case FileTemplateReader.AttributeType.Type: TemplateType = val; break;

                case FileTemplateReader.AttributeType.Name: Name = val; break;

                case FileTemplateReader.AttributeType.Author: Author = val; break;

                case FileTemplateReader.AttributeType.Description: Description = val; break;
                }
            },
                (name, type, defVal, validate) =>
            {
                Attributes.Add(new Attribute
                {
                    Name         = name,
                    Type         = type,
                    Value        = defVal,
                    DefaultValue = defVal,
                    ValidateExpr = validate
                });
            }, IsHeader
                );
        }
Exemplo n.º 2
0
        public FileTemplate(FileInfo fileInfo, bool isHeader)
        {
            IsHeader = isHeader;
            FileInfo = fileInfo;
            Attributes = new List<Attribute>();

            Content = new FileTemplateReader(fileInfo).Read(
                (type, val) =>
                {
                    switch (type)
                    {
                        case FileTemplateReader.AttributeType.Type: TemplateType = val; break;
                        case FileTemplateReader.AttributeType.Name: Name = val; break;
                        case FileTemplateReader.AttributeType.Author: Author = val; break;
                        case FileTemplateReader.AttributeType.Description: Description = val; break;
                    }
                },
                (name, type, defVal, validate) =>
                {
                    Attributes.Add(new Attribute
                    {
                        Name = name,
                        Type = type,
                        Value = defVal,
                        DefaultValue = defVal,
                        ValidateExpr = validate
                    });
            },IsHeader
            );
        }