Пример #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
            });
        }
Пример #2
0
        private string GetRoot(SampleAttribute attribute)
        {
            var root = attribute.Root ?? this.Root ?? Path.GetTempPath();

            return(root);
        }
Пример #3
0
        private IAsyncCollector <SampleItem> BuildCollector(SampleAttribute attribute)
        {
            var root = GetRoot(attribute);

            return(new SampleAsyncCollector(root));
        }