Exemplo n.º 1
0
        // All {} and %% in the Attribute have been resolved by now.
        private SampleItem BuildItemFromAttr(SampleAttribute attribute)
        {
            var root = GetRoot(attribute);
            var path = Path.Combine(root, attribute.FileName);

            if (!File.Exists(path))
            {
                return(null);
            }
            var contents = File.ReadAllText(path);

            return(new SampleItem
            {
                Name = attribute.FileName,
                Contents = contents
            });
        }
Exemplo n.º 2
0
        private string GetRoot(SampleAttribute attribute)
        {
            var root = attribute.Root ?? this.Root ?? Path.GetTempPath();

            return(root);
        }
Exemplo n.º 3
0
        private IAsyncCollector <SampleItem> BuildCollector(SampleAttribute attribute)
        {
            var root = GetRoot(attribute);

            return(new SampleAsyncCollector(root));
        }