FromXML() public method

public FromXML ( XmlNode node ) : void
node XmlNode
return void
Esempio n. 1
0
    /// <summary>
    /// Import XML data into this camera path overwriting the current data
    /// </summary>
    /// <param name="XMLPath">An XML file path</param>
    public void FromXML(string XMLPath)
    {
        Debug.Log("Import Track BuildR Track XML " + XMLPath);
        Clear();
        XmlDocument xml = new XmlDocument();

        using (StreamReader sr = new StreamReader(XMLPath))
        {
            xml.LoadXml(sr.ReadToEnd());
        }

        XmlNode trackNode = xml.SelectNodes("trackbuildr")[0];

        version = float.Parse(trackNode["version"].FirstChild.Value);

        if (trackNode["name"] != null)
        {
            name = trackNode["name"].FirstChild.Value;
        }

        if (trackNode["fileType"] != null)
        {
            fileType       = (fileTypes)System.Enum.Parse(typeof(fileTypes), trackNode["fileType"].FirstChild.Value);
            exportFilename = trackNode["exportFilename"].FirstChild.Value;
            copyTexturesIntoExportFolder = bool.Parse(trackNode["copyTexturesIntoExportFolder"].FirstChild.Value);
            exportCollider       = bool.Parse(trackNode["exportCollider"].FirstChild.Value);
            createPrefabOnExport = bool.Parse(trackNode["createPrefabOnExport"].FirstChild.Value);
        }
        //send data to track
        track.FromXML(trackNode.SelectSingleNode("track"));
    }