예제 #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
                );
        }
예제 #2
0
파일: FileTemplate.cs 프로젝트: moscrif/ide
        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
            );
        }