Exemplo n.º 1
0
        private ArrayList Load_HSK(int i)
        {
            Reader_HSK hsk = new Reader_HSK();

            hsk.Level = i;
            return(hsk.AllWords());
        }
Exemplo n.º 2
0
        public List <Tuple <string, List <int> > > HSKIndex(int Level, bool acumulative)
        {
            List <Tuple <string, List <int> > > Index = new List <Tuple <string, List <int> > >();

            ArrayList includedWords = new ArrayList();

            if (acumulative)
            {
                for (int i = 1; i < Level + 1; i++)
                {
                    Reader_HSK reader = new Reader_HSK()
                    {
                        Level = i
                    };
                    ListService service = new ListService(reader);

                    var levelwords = service.GetAllWords(i);
                    includedWords.AddRange(levelwords);
                }
            }
            else
            {
                Reader_HSK reader = new Reader_HSK()
                {
                    Level = Level
                };
                ListService service = new ListService(reader);

                var levelwords = service.GetAllWords(Level);
                includedWords.AddRange(levelwords);
            }


            //Argh
            List <Word> arrayIncluded = ToList(includedWords);

            foreach (HSK.Word_HSK w in arrayIncluded.OrderBy(x => x.NumberPinyin))
            {
                List <int> pagesthatcontainsword = new List <int>();
                string     HSKWord = w.Character;

                foreach (var page in document)
                {
                    if (page.Item2.Contains(HSKWord))
                    {
                        if (!pagesthatcontainsword.Contains(page.Item1))
                        {
                            pagesthatcontainsword.Add(page.Item1);
                        }
                    }
                }


                Index.Add(new Tuple <string, List <int> >(w.Character, pagesthatcontainsword));
            }

            return(Index);
        }