//By: Ryan Moe //Edited: Julian Nguyen(4/28/13) /// <summary> /// This method will return a complex photo data object filled /// out with the data of one photo referenced by the uid param. /// </summary> /// <param name="guiCallback">The callback to the GUI</param> /// <param name="photoUID">The Image's ID in the Album.</param> /// <param name="albumUID">The Album's ID.</param> public void getImage(getPhotoByUID_callback guiCallback, int photoUID, Guid albumUID) { ErrorReport errReport = null; ComplexPhotoData imageData = null; errReport = _photoBombDatabase.getImage_backend(photoUID, albumUID, out imageData); guiCallback(errReport, imageData); }
//---------------------------------------------------------------------- //By: Ryan Moe //Edited Last: private void getPhoto_backend(getPhotoByUID_callback guiCallback, int photoUID, int albumUID) { ErrorReport error = new ErrorReport(); // beware: this function assumes uid in album.xml == uid in photo.xml // change to lookup by hash? //get the picture from the picture database. XElement albumNode = util_getAlbum(error, albumUID); XElement albumPicElement = util_getAlbumDBPhotoNode(error, albumNode, photoUID); XElement picElement = util_getPhotoDBNode(error, (string)albumPicElement.Attribute("sha1").Value); //if the picture finding function reported success. if (error.reportID == ErrorReport.SUCCESS || error.reportID == ErrorReport.SUCCESS_WITH_WARNINGS) { ComplexPhotoData photo = new ComplexPhotoData(); //ComplexPhotoData MOE MARKER MOE MARKER MOE MARKER MOE MARKER!!!!!! try { photo.hash = StringToByteArray((string)picElement.Attribute("sha1")); photo.UID = (int)picElement.Attribute("uid"); photo.refCount = (int)picElement.Attribute("refCount"); photo.path = (string)picElement.Element("filePath").Value; } catch { error.reportID = ErrorReport.FAILURE; error.description = "PhotoBomb.getPictureByUID():Photo info could not be loaded."; guiCallback(error, null); return; } //Success! guiCallback(error, photo); return; } //picture failed to be found. else { guiCallback(error, null); return; } }
//--------------------------------------------- //By: Ryan Moe //Edited Last: // //This method will return a complex photo data object //filled out with the data of one photo referenced by the uid param. public void getPhoto(getPhotoByUID_callback guiCallback, int photoUID, int albumUID) { getPhoto_backend(guiCallback, photoUID, albumUID); }