public void ImportImageThumbnail(string path) { if (!DoesLibraryContain(currentBookTitle)) { Debug.Log("Cannot add thumbnail to non-existent book " + currentBookTitle + ". Import book first."); return; } BookInfo bookInfo = BookInfoMapper.DeserializeInfo(currentBookTitle); bookInfo.thumbnailPath = path; string[] pathParts = path.Split('.'); if (pathParts.Length < 2) { throw new InvalidBookFormatException("Invalid image format. Must include extension"); } string ext = pathParts[pathParts.Length - 1]; CopyOriginal(path, Config.Instance.BookLibraryPath + "/" + Config.Instance.ApplicationName + "/" + currentBookTitle + "/" + currentBookTitle + "-thumb." + ext); string outputPath = Config.Instance.BookLibraryPath + "/" + Config.Instance.ApplicationName + "/" + bookInfo.title + "/info.yaml"; BookInfoMapper.SerializeInfo(outputPath, bookInfo); }
private void ImportDotText(string path) { string outputDir = GenerateDirs(path); string title = GetTitleFromPath(path); BookInfoMapper.SerializeInfo(outputDir + "/info.yaml", BookFormat.TXT, path, title); CopyOriginal(path, outputDir + "/" + title + ".txt"); }
private void ImportPdf(string path) { string outputDir = GenerateDirs(path); string title = GetTitleFromPath(path); PdfConversion.ToJpegs(path, outputDir + "/" + "pages/"); BookInfoMapper.SerializeInfo(outputDir + "/info.yaml", BookFormat.PDF, path, title); CopyOriginal(path, outputDir + "/" + title + ".pdf"); }