public virtual PkpassData DownloadData(Uri uri) { string destinationFileName = cloudStorageHelper.GetHomePath() + Config.CloudService.LocalDirectory + uri.Query.Split(new char[] { '/' }).Last(); FileDownloader.DownloadFile(uri.AbsoluteUri, destinationFileName); return(PkpassManager.OpenPkpass(destinationFileName)); }
public PkpassData GetData(string filePath) { Path.GetFileName(filePath); string fileName = cloudStorageHelper.GetHomePath() + Config.CloudService.LocalDirectory + Path.GetFileName(filePath); //Only if they are in different paths we do the copy if (fileName != filePath) { File.Copy(filePath, fileName); } return(PkpassManager.OpenPkpass(fileName)); }
public virtual PkpassData DownloadData(Uri uri) { string destinationFileName = cloudStorageHelper.GetHomePath() + Config.CloudService.LocalDirectory + uri.Query.Split(new char[] { '/' }).Last(); // The original Uri points to a blank page with a tiny javascript snippet that triggers the download. // https://venta.renfe.com/vol/passbookEmail.do?pkpass=2017-12-26/MKH2KS0CNH34N9B5XE56OM.pkpass // We will build the final link and save to call to the blank page instead. string finalUrl = "https://w4.renfe.es/passbook/" + uri.Query.Split(new char[] { '=' }).Last(); FileDownloader.DownloadFile(finalUrl, destinationFileName); return(PkpassManager.OpenPkpass(destinationFileName)); }
public PkpassData DownloadData(Uri uri) { string destinationFileName = cloudStorageHelper.GetHomePath() + Config.CloudService.LocalDirectory + Guid.NewGuid() + ".pkpass"; FileDownloader.DownloadFile(uri.AbsoluteUri, destinationFileName); try { return(PkpassManager.OpenPkpass(destinationFileName)); } catch (Exception ex) { throw new ApplicationException("Problems opening the pkpass file", ex); } }