public bool Open(string filePath) { m_State = GetComponent<State>(); m_RuleBase = GetComponent<RuleBase>(); if (File.Exists(filePath)) { XMLRulesType root; try { XMLRulesDoc doc = new XMLRulesDoc(); root = new XMLRulesType(doc.Load(filePath)); } catch (Exception e) { Debug.Log("Error on Open " + e.ToString()); return false; } m_State.Clear(); m_RuleBase.Clear(); m_RuleBaseFilePath = filePath; m_RuleBase.SetContext(this); m_RuleBase.Load(root.GetRuleBase()); m_State.Load(root.GetRuleBase()); return true; } return false; }
public RuleBaseEnumerator(XMLRulesType par) { parent = par; nIndex = -1; }
public bool Save(string fileName) { try { XMLRulesDoc document = new XMLRulesDoc(); XMLRulesType root = new XMLRulesType(); RuleBaseType ruleBase = new RuleBaseType(); m_State.Save(ref ruleBase); m_RuleBase.Save(ref ruleBase); root.AddRuleBase(ruleBase); document.SetRootElementName("", "XMLRules"); document.SetSchemaLocation("XMLRules.xsd"); // optional document.Save(fileName, root); } catch (Exception e) { Debug.Log("Error in Save " + e.ToString()); return false; } return true; }
public RuleBaseEnumerator(XMLRulesType par) { parent = par; nIndex = -1; }