Esempio n. 1
0
        private void ValideFichierRef(ColConfWin.IllRule illRuleToUse)
        {
            bool success = true;

            if (File.Exists(fullName))
            {
                using (TextFieldParser csvParser = new TextFieldParser(fullName))
                {
                    csvParser.SetDelimiters(new string[] { ";" });
                    csvParser.HasFieldsEnclosedInQuotes = false;

                    // Skip the row with the column names
                    string headerLine = csvParser.ReadLine();
                    while (!csvParser.EndOfData)
                    {
                        // Read current line fields, pointer moves to the next line.
                        Mot m = new Mot(csvParser.ReadFields());
                    }
                    Config conf = new Config();
                    conf.colors[PhonConfType.phonemes].IllRuleToUse = illRuleToUse;

                    Mot.EnsureCompleteness(conf, true);

                    foreach (Mot m in Mot.mots)
                    {
                        if (!(m.matchSet && m.match))
                        {
                            success = false;
                            Console.WriteLine(m.GetFileString());
                        }
                    }
                }
            }
            Assert.IsTrue(success);
        }
Esempio n. 2
0
        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);
                        }
                    }
                }
            }
        }