예제 #1
0
        static void Main(string[] args)
        {
            var filepath = @"C:\BGL_test\The Railway Children [E Nesbit].txt";

            //call some classes
            // do somestuff

            //create the parser concrete for regex

            //these are commented out as proved to be the slower code
            //
            //var ConcreteParserRegex = new ParseBookFileRegex();
            //var ConcreteOutputRegex = new OutputCSV();
            //var ParserRegex = new ParseBookFile(ConcreteParserRegex, ConcreteOutputRegex);
            //var ResultsParserRegex = ParserRegex.countWordsInFile(filepath);

            //create the parser concrete for split
            var ConcreteParserSplit = new ParseBookFileSplitForeach();
            var ConcreteOutputSplit = new OutputCSV();
            var ParserSplit         = new ParseBookFile(ConcreteParserSplit, ConcreteOutputSplit);
            var ResultsParserSplit  = ParserSplit.countWordsInFile(filepath);

            Console.WriteLine("File read");
            ParserSplit.output(ResultsParserSplit);
            Console.WriteLine("CSV file created");
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
예제 #2
0
        }   //  end CSV6_checked

        private void onCreateFiles(object sender, EventArgs e)
        {
            OutputCSV ocsv = new OutputCSV();

            ocsv.fileName = fileName;
            string currPath = System.IO.Path.GetDirectoryName(fileName);

            currPath += "\\";
            for (int j = 0; j < 11; j++)
            {
                if (filesToOutput[j] == 1)
                {
                    CSVoutFile  = currPath;
                    CSVoutFile += CSVfileNames[j];
                    switch (j)
                    {
                    case 0:         //  A05
                        ocsv.currentReport = "CSV1";
                        ocsv.OutputCSVfiles(CSVoutFile, "A05", textFileName);
                        break;

                    case 1:         //  A06
                        ocsv.currentReport = "CSV2";
                        ocsv.OutputCSVfiles(CSVoutFile, "A06", textFileName);
                        break;

                    case 2:         //  A07
                        ocsv.currentReport = "CSV3";
                        ocsv.OutputCSVfiles(CSVoutFile, "A07", textFileName);
                        break;

                    case 3:         //  A10
                        ocsv.currentReport = "CSV4";
                        ocsv.OutputCSVfiles(CSVoutFile, "A10", textFileName);
                        break;

                    case 4:         //  L1
                        ocsv.currentReport = "CSV5";
                        ocsv.OutputCSVfiles(CSVoutFile, "L1:", textFileName);
                        break;

                    case 5:         //  L3
                        //  this needs to be built from scratch -- noope, fixed it to work with L2 report
                        ocsv.currentReport = "CSV6";
                        ocsv.fileName      = fileName;
                        ocsv.OutputCSVfiles(CSVoutFile, "L2:", textFileName);
                        break;

                    case 6:         //  ST1
                        ocsv.currentReport = "CSV7";
                        ocsv.fileName      = fileName;
                        ocsv.OutputCSVfiles(CSVoutFile, "ST1", textFileName);
                        break;

                    case 7:         //  UC5
                        ocsv.currentReport = "CSV8";
                        ocsv.fileName      = fileName;
                        ocsv.OutputCSVfiles(CSVoutFile, "UC5", textFileName);
                        break;

                    case 8:         //  KPI estimates
                        ocsv.currentReport = "CSV9";
                        ocsv.OutputEstimateFile(CSVoutFile);
                        break;

                    case 9:     //  Timber Theft file
                        ocsv.currentReport = "CSV10";
                        ocsv.OutputTimberTheft(CSVoutFile);
                        break;

                    case 10:            //  VSM<4
                        ocsv.currentRegion = "CSV11";
                        ocsv.OutputCSVfiles(CSVoutFile, "VSM4", textFileName);
                        break;
                    } //  end switch
                }     //  endif
                CSVoutFile = "";
            }         //  end for j loop

            MessageBox.Show("All CSV files requested have been created.\nCheck directory for .CSV files", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);

            return;
        }   //  end onCreateFiles