public bool GetPuzzlePartsData(ImageData imageData, int diffLevel, out List<PuzzlePartData> puzzlePartsData, out string errorString) { PuzzlePartsGenerator generator = new PuzzlePartsGenerator() { DifficultyLevel = diffLevel, ImageData = imageData }; if (!generator.Generate(out errorString)) { puzzlePartsData = new List<PuzzlePartData>(); return false; } errorString = ""; puzzlePartsData = generator.PuzzlePartsData; return true; }
public bool GetUserData(int userId,out UserData userData,out String errorString) { IUsersDataManager usersDataMan = managersFactory.CreateUsersDataManagerr(); User user = usersDataMan.GetUser(userId); if(user == null) { errorString = "User not found"; userData = null; return false; } userData = new UserData(); userData.ID = user.UserId; userData.Name = user.Name; userData.Albums = new List<AlbumData>(); foreach (var album in user.Albums) { AlbumData albumData = new AlbumData(); albumData.ID = album.AlbumId; albumData.Name = album.Name; albumData.Images = new List<ImageData>(); foreach(var albumImageData in album.ImagesData) { ImageData imageData = new ImageData(); imageData.ID = albumImageData.AlbumImageDataId; imageData.URL = albumImageData.URL; Image image = Image.FromFile(albumImageData.URL); imageData.Height = image.Height; imageData.Width = image.Width; albumData.Images.Add(imageData); } userData.Albums.Add(albumData); } errorString = ""; return true; }
private bool GetImageData(int imageid, out ImageData imageData, out string errorString) { imageData = new ImageData(); // Get image URL IAlbumsDataManager albumsDataMan = managersFactory.CreateAlbumsManager(); if (albumsDataMan == null) { errorString = "Failed retrieving AlbumsDataManager"; return false; } string URL = string.Empty; if (!albumsDataMan.GetImageURL(imageid, out URL, out errorString)) return false; imageData.URL = URL; // Get image size Image image = Image.FromFile(URL); imageData.Height = image.Height; imageData.Width = image.Width; return true; }