public LinkedList<ReactionsSet> loadReactionsFromFile(string filePath) { MemoryStream ms = Tools.getEncodedFileContent(filePath); bool b = true; ReactionsSet reactionSet; string setId; LinkedList<ReactionsSet> reactionSets = new LinkedList<ReactionsSet>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(ms); XmlNodeList reactionsLists = xmlDoc.GetElementsByTagName("reactions"); foreach (XmlNode reactionsNode in reactionsLists) { setId = reactionsNode.Attributes["id"].Value; if (setId != "" && setId != null) { LinkedList<IReaction> reactions = new LinkedList<IReaction>(); b &= loadReactions(reactionsNode, reactions); reactionSet = new ReactionsSet(); reactionSet.id = setId; reactionSet.reactions = reactions; reactionSets.AddLast(reactionSet); } else { Debug.Log("Error : missing attribute id in reactions node"); b = false; } } return reactionSets; }
/*! \brief Load reactions from a ReactionsSet \param reactionsSet The set to load */ public void initReactionsFromReactionsSet(ReactionsSet reactionsSet) { if (reactionsSet == null) return; foreach (IReaction reaction in reactionsSet.reactions) addReaction(IReaction.copyReaction(reaction)); // _reactions.AddLast(reaction); }
/*! \brief Load reactions from a ReactionsSet \param reactionsSet The set to load */ public void initReactionsFromReactionsSet(ReactionsSet reactionsSet) { if (reactionsSet == null) return; foreach (IReaction reactions in reactionsSet.reactions) _reactions.AddLast(reactions); }