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

readFlashFile() public static method

It reads the Flash-Card App-Template, from the .buildmlearn file.
public static readFlashFile ( string fileName ) : void
fileName string Name of the file
return void
        public static void readFlashFile(string fileName)
        {
            try
            {
                FlashModel model = FlashModel.getInstance();
                List<Card> cardList = new List<Card>();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
                model.setFlashName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
                model.setFlashDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
                string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
                model.setFlashAuthor(author[1].Trim());
                model.setFlashAuthorEmail(author[2].Trim());
                model.setFlashVersion(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');
                    Card card = new Card(ar[1].Trim(), ar[2].Trim(), ar[3].Trim(), ar[4].Trim());
                    cardList.Add(card);
                }
                model.setCardList(cardList);
            }
            catch (Exception) { }
        }
    }