Пример #1
0
        public string[] SampleDirectories()
        {
            if (File.Exists(Path.Combine(InputDirectory, Path.GetFileName(InputDirectory) + ".siformat")))
            {
                return(new[] { this.InputDirectory });
            }

            var result = SampleUtils.GetDatasets(InputDirectory);

            foreach (var dir in result)
            {
                var sfile = Path.Combine(dir, Path.GetFileName(dir) + ".siformat");
                if (!File.Exists(sfile))
                {
                    throw new Exception("Cannot find file :" + sfile);
                }
            }

            return(result);
        }
Пример #2
0
        private void DoLoadColumns()
        {
            properties = SampleUtils.ReadPropertiesFromFile(columnFiles.FullName);

            defaultValues = new BindingList <DefaultValue>(
                (from pn in properties
                 select new DefaultValue()
            {
                PropertyName = pn,
                Value = string.Empty
            }).ToList());

            properties.Insert(0, string.Empty);

            colPropertyName.Items.Clear();
            colPropertyName.Items.AddRange(properties.ToArray());

            headers = (from name in properties
                       select new FileDefinitionItem()
            {
                PropertyName = name
            }).ToList();
        }
Пример #3
0
        public override IEnumerable <string> Process()
        {
            var properties = SampleUtils.ReadPropertiesFromFile(options.PropertyFile);
            var format     = new SampleItemTextWriter(properties);

            List <SampleItem> total = new List <SampleItem>();

            foreach (var subdir in options.SampleDirectories())
            {
                Progress.SetMessage("processing " + subdir + " ...");

                var dirname = Path.GetFileName(subdir);
                var sifile  = Path.Combine(subdir, dirname + ".siformat");
                var parser  = new SampleItemParser(sifile);

                var flist      = parser.ParseDataset(subdir);
                var sampleFile = Path.ChangeExtension(sifile, ".sample");
                format.WriteToFile(sampleFile, flist.Values.ToList());

                total.AddRange(from l in flist
                               where AcceptGsmName(l.Key)
                               select l.Value);
            }

            format.WriteToFile(options.OutputFile, total);

            var htmlFile = Path.ChangeExtension(options.OutputFile, ".html");

            new SampleItemHtmlWriter(properties).WriteToFile(htmlFile, total);

            var excelFile = Path.ChangeExtension(htmlFile, ".xls");

            new SampleItemExcelWriter(properties).WriteToFile(excelFile, total);

            return(new string[] { options.OutputFile, htmlFile, excelFile });
        }
        public SampleItemTextWriter(IEnumerable <string> properties)
        {
            var headers = SampleUtils.GetColumns(properties).Merge("\t");

            _format = new LineFormat <SampleItem>(new SampleItemPropertyFactory <SampleItem>(), headers);
        }
 public SampleItemHtmlWriter(IEnumerable <string> columns)
 {
     this.converters = SampleUtils.GetConverters(columns);
 }