/* * load a configuration, decrypting it if credentials found */ XML *cfg_load (char *path) { XML *xml; cfg_clean (path); if ((xml = xml_load (path)) == NULL) return (NULL); if (strcmp (xml_root (xml), "Phineas")) { unsigned char *p; xcrypt_decrypt (xml, &p, ConfigCert, NULL, ConfigPass); xml_free (xml); xml = xml_parse (p); free (p); } return (xml); }
OrderedTask * LoadTask(Path path, const TaskBehaviour &task_behaviour, const Waypoints *waypoints) { // Load root node std::unique_ptr<XMLNode> xml_root(XML::ParseFile(path)); if (!xml_root) return nullptr; const ConstDataNodeXML root(*xml_root); // Check if root node is a <Task> node if (!StringIsEqual(root.GetName(), _T("Task"))) return nullptr; // Create a blank task OrderedTask *task = new OrderedTask(task_behaviour); // Read the task from the XML file LoadTask(*task, root, waypoints); // Return the parsed task return task; }