AppStore.Common.AppReader.readSpellingsFile C# (CSharp) Method

readSpellingsFile() public static method

It reads the Spellings-Puzzle App-Template, from the .buildmlearn file.
public static readSpellingsFile ( string fileName ) : void
fileName string Name of the file
return void
        public static void readSpellingsFile(string fileName)
        {
            try
            {
                SpellingsModel model = SpellingsModel.getInstance();
                List<WordModel> wordList = new List<WordModel>();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
                model.setPuzzleName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
                model.setPuzzleDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
                string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
                model.setPuzzleAuthor(author[1].Trim());
                model.setPuzzleAuthorEmail(author[2].Trim());
                model.setPuzzleVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
                XmlNodeList item = doc.GetElementsByTagName("item");
                // looping through all item nodes <app>
                for (int i = 0; i < item.Length; i++)
                {
                    string[] ar = item.ElementAt(i).InnerText.Split('\n');
                    WordModel word = new WordModel(ar[1].Trim(), ar[2].Trim());
                    wordList.Add(word);
                }
                model.setSpellingsList(wordList);
            }
            catch (Exception) { }
        }