public void valuesInit(LibrelioLocalUrl url) { relativePath = url.RelativePath; isPaid = fileName.Contains("_."); pdfUrl = url.Url; isDowloaded = false; pdfPath = url.FolderPath + url.FullName; if (isPaid) { pngUrl = pdfUrl.Replace("_.pdf", ".png"); pngPath = url.FullName.Replace("_.pdf", ".png"); sampleUrl = pdfUrl.Replace("_.", "."); samplePath = pdfPath.Replace("_.", "."); isSampleDowloaded = url.IsSampleDownloaded; } else { pngUrl = pdfUrl.Replace(".pdf", ".png"); pngPath = url.FullName.Replace(".pdf", ".png"); } assetsDir = url.FolderPath; isDowloaded = url.IsDownloaded; }
//public String downloadDate { get; set; } //public MagazineModel(Dictionary<string, dynamic> dict) //{ // fileName = (string)dict[FILE_NAME_KEY]; // Title = (string)dict[TITLE_KEY]; // Subtitle = (string)dict[SUBTITLE_KEY]; // valuesInit(fileName); //} //public MagazineModel(String title, String subtitle, String fileName) //{ // this.fileName = fileName; // this.Title = title; // this.Subtitle = subtitle; // valuesInit(fileName); //} //async public void valuesInit(String fileName) //{ // if ((fileName == "") || (fileName == null)) { // return ; // } // isPaid = fileName.Contains("_."); // int startNameIndex = fileName.IndexOf("/") + 1; // string appDataPath = ""; // StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder; // appDataPath = folder.Path + "/"; // //String png = appDataPath + fileName.Substring(startNameIndex, fileName.Length - startNameIndex); // String png = fileName.Substring(startNameIndex, fileName.Length - startNameIndex); // string baseURL = appDataPath + "pdf/"; // pdfUrl = baseURL + fileName; // pdfPath = getMagazineDir() + fileName.Substring(startNameIndex, fileName.Length - startNameIndex); // if (isPaid) // { // pngUrl = pdfUrl.Replace("_.pdf", ".png"); // pngPath = png.Replace("_.pdf", ".png"); // sampleUrl = pdfUrl.Replace("_.", "."); // samplePath = pdfPath.Replace("_.", "."); // isSampleDowloaded = await Utils.Utils.fileExistAsync(folder, getMagazineDir() + COMPLETE_SAMPLE_FILE); // } // else // { // pngUrl = pdfUrl.Replace(".pdf", ".png"); // pngPath = png.Replace(".pdf", ".png"); // } // isDowloaded = await Utils.Utils.fileExistAsync(folder, getMagazineDir() + COMPLETE_FILE); // assetsDir = getMagazineDir(); //} public MagazineModel(LibrelioLocalUrl url, int index) { this.fileName = url.FullName; this.Title = url.Title; this.Subtitle = url.Subtitle; this.Index = index; valuesInit(url); }
public void valuesInit(LibrelioLocalUrl url) { //if ((url.FolderPath == "") || (url.FolderPath == "ND")) { // return; //} relativePath = url.RelativePath; isPaid = fileName.Contains("_."); pdfUrl = url.Url; isDowloaded = false; pdfPath = url.FolderPath + url.FullName; if (isPaid) { pngUrl = pdfUrl.Replace("_.pdf", ".png"); pngPath = pdfPath.Replace("_.pdf", ".png"); samplePath = pdfPath.Replace("_.", "."); isSampleDowloaded = url.IsDownloaded; } else { pngUrl = pdfUrl.Replace(".pdf", ".png"); pngPath = pdfPath.Replace(".pdf", ".png"); } isDowloaded = url.IsDownloaded; }