Пример #1
0
        /// <inheritdoc/>
        public override sealed bool ExecuteCommand(String args)
        {
            // get filenames
            String sourceID = Prop.GetPropertyString(
                ScriptProperties.SegregateConfigSourceFile);

            FileInfo sourceFile = Script.ResolveFilename(sourceID);

            EncogLogging.Log(EncogLogging.LevelDebug, "Beginning segregate");
            EncogLogging.Log(EncogLogging.LevelDebug, "source file:" + sourceID);

            // get formats
            CSVFormat format = Script.DetermineFormat();

            // prepare to segregate
            bool headers = Script.ExpectInputHeaders(sourceID);
            var seg = new SegregateCSV {Script = Script};
            Analyst.CurrentQuantTask = seg;

            foreach (AnalystSegregateTarget target  in  Script.Segregate.SegregateTargets)
            {
                FileInfo filename = Script.ResolveFilename(target.File);
                seg.Targets.Add(new SegregateTargetPercent(filename, target.Percent));
                // mark generated
                Script.MarkGenerated(target.File);
                EncogLogging.Log(
                    EncogLogging.LevelDebug,
                    "target file:" + target.File + ", Percent: "
                    + Format.FormatPercent(target.Percent));
            }

            seg.Report = new AnalystReportBridge(Analyst);
            seg.Analyze(sourceFile, headers, format);

            seg.Process();
            Analyst.CurrentQuantTask = null;
            return seg.ShouldStop();
        }
Пример #2
0
 public override sealed bool ExecuteCommand(string args)
 {
     FileInfo info;
     CSVFormat format;
     CSVFormat format2;
     bool flag;
     SegregateCSV ecsv;
     AnalystSegregateTarget target;
     FileInfo info2;
     AnalystSegregateTarget[] segregateTargets;
     int num;
     string propertyString = base.Prop.GetPropertyString("SEGREGATE:CONFIG_sourceFile");
     if (((uint) num) >= 0)
     {
         info = base.Script.ResolveFilename(propertyString);
         goto Label_01C5;
     }
     Label_0026:
     if (((uint) num) >= 0)
     {
         ecsv.Analyze(info, flag, format);
     }
     ecsv.OutputFormat = format2;
     if (0 != 0)
     {
         goto Label_00ED;
     }
     ecsv.Process();
     base.Analyst.CurrentQuantTask = null;
     goto Label_021F;
     Label_008C:
     if (num < segregateTargets.Length)
     {
         goto Label_00E6;
     }
     if ((((uint) num) + ((uint) num)) <= uint.MaxValue)
     {
         goto Label_01AD;
     }
     if (15 != 0)
     {
         goto Label_00E1;
     }
     Label_00B6:
     EncogLogging.Log(0, "target file:" + target.File + ", Percent: " + Format.FormatPercent((double) target.Percent));
     num++;
     goto Label_008C;
     Label_00E1:
     num = 0;
     goto Label_008C;
     Label_00E6:
     target = segregateTargets[num];
     Label_00ED:
     info2 = base.Script.ResolveFilename(target.File);
     ecsv.Targets.Add(new SegregateTargetPercent(info2, target.Percent));
     base.Script.MarkGenerated(target.File);
     goto Label_00B6;
     Label_01AD:
     if ((((uint) flag) - ((uint) num)) <= uint.MaxValue)
     {
         if (0 != 0)
         {
             goto Label_00E6;
         }
         ecsv.Report = new AnalystReportBridge(base.Analyst);
         if (2 != 0)
         {
             goto Label_0026;
         }
         goto Label_021F;
     }
     Label_01C5:
     EncogLogging.Log(0, "Beginning segregate");
     EncogLogging.Log(0, "source file:" + propertyString);
     format = base.Script.DetermineInputFormat(propertyString);
     format2 = base.Script.DetermineOutputFormat();
     flag = base.Script.ExpectInputHeaders(propertyString);
     ecsv = new SegregateCSV {
         Script = base.Script
     };
     if (((uint) flag) <= uint.MaxValue)
     {
         base.Analyst.CurrentQuantTask = ecsv;
         if (((uint) flag) > uint.MaxValue)
         {
             goto Label_0026;
         }
         segregateTargets = base.Script.Segregate.SegregateTargets;
         if (0 == 0)
         {
             goto Label_00E1;
         }
     }
     goto Label_01AD;
     Label_021F:
     return ecsv.ShouldStop();
 }