private LibraryPuzzle Convert(SokobanLibraryPuzzle xmlLib, SokobanLibraryPuzzleMap xp) { return new LibraryPuzzle(new Puzzle(xp.Row)) { Name = xmlLib.PuzzleDescription != null ? xmlLib.PuzzleDescription.Name : null, Details = new AuthoredItem() { Name = xmlLib.PuzzleDescription != null ? xmlLib.PuzzleDescription.Name : null } }; }
public Puzzle ConvertPuzzle(SokobanLibraryPuzzle xmlPuzzle) { current = new Puzzle(this.model); current.PuzzleID = xmlPuzzle.PuzzleID; current.Details = xmlPuzzle.PuzzleDescription; current.Order = xmlPuzzle.Order; current.Rating = xmlPuzzle.Rating; Category myCat = model.GetCategoryByID(xmlPuzzle.CategoryREF); if (myCat != null) current.Category = myCat; current.Maps = new List<SokobanLibraryPuzzleMap>(xmlPuzzle.Maps).ConvertAll<PuzzleMap>(ConvertPuzzleMap); return current; }
private SokobanLibraryPuzzle Convert(Puzzle source) { SokobanLibraryPuzzle res = new SokobanLibraryPuzzle(); res.CategoryREF = source.Category == null ? null : source.Category.CategoryID; res.Maps = source.Maps.ConvertAll<SokobanLibraryPuzzleMap>(Convert).ToArray(); res.PuzzleDescription = source.Details; res.PuzzleID = source.PuzzleID; res.Rating = source.Rating; res.Order = source.Order; return res; }
public Puzzle ConvertPuzzle(SokobanLibraryPuzzle xmlPuzzle) { current = new Puzzle(this.model); current.PuzzleID = xmlPuzzle.PuzzleID; current.Details = xmlPuzzle.PuzzleDescription; current.Order = xmlPuzzle.Order; current.Rating = xmlPuzzle.Rating; TreeNode<Category> myCat = model.Categories.Root.Find( delegate(TreeNode<Category> item) { return item.Data.CategoryID == xmlPuzzle.CategoryREF; }, int.MaxValue); if (myCat != null) current.Category = myCat.Data; current.Maps = new List<SokobanLibraryPuzzleMap>(xmlPuzzle.Maps).ConvertAll<PuzzleMap>(ConvertPuzzleMap); return current; }