コード例 #1
0
ファイル: Program.cs プロジェクト: paColor/Colorization
        static void Main(string[] args)
        {
            using (TextFieldParser csvParser = new TextFieldParser(fullName))
            {
                csvParser.SetDelimiters(new string[] { ";" });
                csvParser.HasFieldsEnclosedInQuotes = false;

                // Skip the row with the column names
                string headerLine = csvParser.ReadLine();

                if (File.Exists(fullOutFName))
                {
                    File.Delete(fullOutFName);
                }
                using (System.IO.StreamWriter outFile = new System.IO.StreamWriter(fullOutFName))
                {
                    if (File.Exists(fullFilteredOutFN))
                    {
                        File.Delete(fullFilteredOutFN);
                    }
                    using (System.IO.StreamWriter excludedFile
                               = new System.IO.StreamWriter(fullFilteredOutFN))
                    {
                        bool recompute = args.Length > 0 && args[0] == "recompute";
                        Mot.Init();
                        while (!csvParser.EndOfData)
                        {
                            // Read current line fields, pointer moves to the next line.
                            Mot m = new Mot(csvParser.ReadFields());
                        }

                        Config conf = new Config();
                        Mot.EnsureCompleteness(conf, recompute, true);
                        Mot.DumpMotsFiltered(excludedFile, outFile);

                        if (File.Exists(fullDoublonsFN))
                        {
                            File.Delete(fullDoublonsFN);
                        }
                        using (System.IO.StreamWriter doublonFile
                                   = new System.IO.StreamWriter(fullDoublonsFN))
                        {
                            Mot.DumpDoublons(doublonFile);
                        }
                    }
                }
            }
        }