public void LoadFromXml(XElement xElement, List <IdentifiedTwistData> allTwistData) { this.DisplayName = xElement.Element("DisplayName").Value; XElement xIsometry = xElement.Element("Mobius"); this.Mobius = (Mobius)DataContractHelper.LoadFromString(typeof(Mobius), xIsometry.ToString()); XElement xViewReflected = xElement.Element("ViewReflected"); if (xViewReflected != null) { this.ViewReflected = bool.Parse(xViewReflected.Value); } m_twists.LoadFromXml(xElement, allTwistData); }
public void LoadFromFile(System.Action <PuzzleConfig, System.Action <Puzzle> > buildPuzzle) { string fileName = GetLoadFileNameInternal(); if (!File.Exists(fileName)) { return; } XDocument xDocument = XDocument.Load(fileName); XElement xConfig = xDocument.Root.Element("PuzzleConfig"); PuzzleConfig config = (PuzzleConfig)DataContractHelper.LoadFromString(typeof(PuzzleConfig), xConfig.ToString()); SetVersionOnConfig(config, xDocument.Root); System.Action <Puzzle> finishLoad = p => LoadStateAndHistoryAndMacros(xDocument, p); buildPuzzle(config, finishLoad); }