コード例 #1
0
 void loadInDirs(string filePath)
 {
     string[] subDirectories = System.IO.Directory.GetDirectories(filePath);
     if (subDirectories.Length > 0)
     {
         for (int i = 0; i < subDirectories.Length; i++)
         {
             loadInDirs(subDirectories[i]);
         }
     }
     else
     {
         string[] fileNames = System.IO.Directory.GetFiles(filePath);
         for (int i = 0; i < fileNames.Length; i++)
         {
             if (fileNames[i].Contains(".xml"))                 // we only want to load .xml files
             // NOTE this will load any file that contains .xml, not just ones that have it at the end
             {
                 if (!fileNames[i].Contains(".meta"))                     // only call if its NOT a meta file
                 {
                     xmlIndex index = getIndexData(fileNames[i]);         // TODO use the index data for something useful
                     loadXML(fileNames[i]);
                 }
             }
         }
     }
 }
コード例 #2
0
    xmlIndex getIndexData(string filePath)     // gets data from <index>
    {
        XmlTextReader reader = new XmlTextReader(filePath);

        if (!reader.ReadToDescendant("index"))
        {
            Debug.LogError("objectXMLManager::getIndexData: No <index> in " + filePath);
            return(null);
        }
        string author = null;

        author = xmlHelperManager.getStringRequired("author", reader);

        xmlIndex tmpIndex = new xmlIndex();

        tmpIndex.author = author;
        return(tmpIndex);
    }