DataBase.addBinderFromXML C# (CSharp) Метод

addBinderFromXML() публичный Метод

public addBinderFromXML ( string filename ) : int
filename string
Результат int
    public int addBinderFromXML(string filename)
    {
        Binder newBinder = new Binder (filename); // Declare a new binder to be later added.

        TextAsset xmlFile = Resources.Load ("XML/" + filename) as TextAsset; // We'll see how this works for now :)
        XmlDocument questionDoc = new XmlDocument ();
        questionDoc.LoadXml (xmlFile.text);

        XmlNodeList questionNodes = questionDoc.DocumentElement.SelectNodes ("/Flipbook/Card");

        // For each question in the XML file...
        foreach (XmlNode card in questionNodes) {
            // Parse and assemble the question
            Card newCard = new Card(card.SelectSingleNode("Question").InnerText, card.SelectSingleNode ("Answer").InnerText);
            // Push the question into the binder
            newBinder.addCard (newCard);
        }

        // Now we here
        // Add the set to the collection and return its ID number
        loadedBinders.Add (newBinder); // Binders full of women
        return (loadedBinders.Count - 1);
    }