public classes.WordOverview FillResult(classes.WordOverview wo, string res)
        {
            classes.Word word = new classes.Word(res);


            Task <string> task = Task.Run(async() => await GetXMLasync(res));

            task.Wait();
            string fetchedXml = task.Result;

            (List <string> xml, List <string> mp3, List <string> occ, Boolean valid) = ReturnBaseXmlData(fetchedXml);
            if (!valid)
            {
                return(wo);
            }

            word.wordBasePointer = xml[0];

            Console.WriteLine("");

            Task _t = Task.Run(async() => await insertBaseWords(xml, mp3, occ));

            _t.Wait();

            Console.WriteLine("");

            wo._wordPossibleMeanings.Add(word);
            wo.valid = true;
            return(wo);
        }
        public classes.WordOverview FillResults()
        {
            classes.WordOverview wo = new classes.WordOverview();

            foreach (string res in Results)
            {
                wo = FillResult(wo, res);
            }
            return(wo);
        }
 public classes.WordOverview FillResults(classes.WordOverview wo)
 {
     foreach (string res in Results)
     {
         if (wo._wordPossibleMeanings.FirstOrDefault(x => x.occurence == res) != null)
         {
             //word exists already
         }
         else
         {
             wo = FillResult(wo, res);
         }
     }
     return(wo);
 }
 public classes.WordOverview searchWord(string occ)
 {
     classes.WordOverview wo = new classes.WordOverview();
     wo.valid = true;
     return(wo);
 }
Ejemplo n.º 5
0
        public void DoExport(classes.WordOverview _wo)
        {
            ExporterClassObject exporterClassObject = new ExporterClassObject();

            classes.WordBase _wb   = new WordBase();
            int    wordPointer     = _wo.WordPointer - 1;
            int    meaningPointer  = _wo._wordPossibleMeanings[wordPointer].meaningPointer - 1;
            string wordBasePointer = _wo._wordPossibleMeanings[wordPointer].wordBasePointer;

            frmMainProgram.getInstance()._articleFile.article._WordBase.TryGetValue(wordBasePointer, out _wb);
            if (_wb != null)
            {
                //Lu

                if (_wb.meanings[meaningPointer].LU != null)
                {
                    exporterClassObject.LU = _wb.meanings[meaningPointer].LU;
                }
                else
                {
                    exporterClassObject.LU = _wb.baseWordLu;
                }

                exporterClassObject.Occurence = _wo._wordPossibleMeanings[wordPointer].occurence;
                exporterClassObject.DE        = _wb.meanings[meaningPointer].DE;
                exporterClassObject.FR        = _wb.meanings[meaningPointer].FR;
                exporterClassObject.EN        = _wb.meanings[meaningPointer].EN;
                exporterClassObject.PT        = _wb.meanings[meaningPointer].PT;
                exporterClassObject.WuertForm = _wb.wordForm.WordFormStringLu;

                switch (exporterClassObject.WuertForm)
                {
                case "Verb":
                case "Hëllefsverb":
                case "Modalverb": exporterClassObject.LUs = _wb.wordForm.pastParticiple;
                    exporterClassObject.LUpretend         = _wb.wordForm.WordFormHelperVerb;
                    break;

                case "Adjektiv":
                case "Adverb":
                case "Partikel": exporterClassObject.LUs = null;
                    break;

                default:     //Default with plural
                    if (_wb.wordForm.WordFormPlurals != null && _wb.meanings[meaningPointer].NoPlural == true)
                    {
                        exporterClassObject.LUs = "(kee Pluriel)";
                    }
                    else
                    {
                        if (_wb.meanings[meaningPointer].LUs != null)
                        {
                            exporterClassObject.LUs = _wb.meanings[meaningPointer].LUs;
                        }
                        else
                        {
                            string plural = "";
                            if (_wb.wordForm.WordFormPlurals == null)
                            {
                                exporterClassObject.LUs = "(kee Pluriel)";
                            }
                            else
                            {
                                foreach (string wfp in _wb.wordForm.WordFormPlurals)
                                {
                                    plural += wfp;
                                }
                                exporterClassObject.LUs = plural;
                            }
                        }
                    }
                    break;
                }

                exporterClassObject.MP3 = _wb.baseMp3;

                if (_wo._wordPossibleMeanings[wordPointer].customMeaning != null)
                {
                    if (_wo._wordPossibleMeanings[wordPointer].customMeaning.MP3 != null)
                    {
                        exporterClassObject.MP3 = _wo._wordPossibleMeanings[wordPointer].customMeaning.MP3;
                    }

                    /*
                     *  TODO
                     */
                }

                PrepareMp3(exporterClassObject.MP3);

                wordlist.Add(exporterClassObject);
            }
            else
            {
                throw new Exception("Wuert konnt net fonnt ginn: " + wordBasePointer + "\n" + _wo.ToString());
            }
        }