Example #1
0
        /// <inheritdoc/>
        public override sealed bool ExecuteCommand(String args)
        {
            // get filenames
            String sourceID = Prop.GetPropertyString(
                ScriptProperties.NormalizeConfigSourceFile);
            String targetID = Prop.GetPropertyString(
                ScriptProperties.NormalizeConfigTargetFile);

            FileInfo sourceFile = Script.ResolveFilename(sourceID);
            FileInfo targetFile = Script.ResolveFilename(targetID);

            EncogLogging.Log(EncogLogging.LevelDebug, "Beginning normalize");
            EncogLogging.Log(EncogLogging.LevelDebug, "source file:" + sourceID);
            EncogLogging.Log(EncogLogging.LevelDebug, "target file:" + targetID);

            // mark generated
            Script.MarkGenerated(targetID);

            // get formats
            CSVFormat inputFormat = Script
                                    .DetermineInputFormat(sourceID);
            CSVFormat outputFormat = Script.DetermineOutputFormat();

            // prepare to normalize
            var norm = new AnalystNormalizeCSV {
                Script = Script
            };

            Analyst.CurrentQuantTask = norm;
            norm.Report = new AnalystReportBridge(Analyst);

            bool headers = Script.ExpectInputHeaders(sourceID);

            norm.Analyze(sourceFile, headers, inputFormat, Analyst);
            norm.OutputFormat         = outputFormat;
            norm.ProduceOutputHeaders = true;
            norm.Normalize(targetFile);
            Analyst.CurrentQuantTask = null;
            return(norm.ShouldStop());
        }