public CsvExportercs(string folderPath, string what) { _folder = folderPath; _what = what; if (what == "Apps" || what == "All") { _total += AppServices.Gets().Count; } if (what == "Books" || what == "All") { _total += BookServices.Gets().Count; } if (what == "Games" || what == "All") { _total += GameServices.Gets().Count; } if (what == "Movies" || what == "All") { _total += MovieServices.Gets().Count; } if (what == "Music" || what == "All") { _total += MusicServices.Gets().Count; } if (what == "Nds" || what == "All") { _total += NdsServices.Gets().Count; } if (what == "Series" || what == "All") { _total += SerieServices.Gets().Count; } if (what == "XXX" || what == "All") { _total += XxxServices.Gets().Count; } }
public PdfExporter(string folderPath, string what) { _what = what; _folder = Path.Combine(folderPath, "myCollections_" + _what + ".pdf"); if (what == "Apps" || what == "All") { _total += AppServices.Gets().Count; } if (what == "Books" || what == "All") { _total += BookServices.Gets().Count; } if (what == "Games" || what == "All") { _total += GameServices.Gets().Count; } if (what == "Movies" || what == "All") { _total += MovieServices.Gets().Count; } if (what == "Music" || what == "All") { _total += MusicServices.Gets().Count; } if (what == "Nds" || what == "All") { _total += NdsServices.Gets().Count; } if (what == "Series" || what == "All") { _total += SerieServices.Gets().Count; } if (what == "XXX" || what == "All") { _total += XxxServices.Gets().Count; } }
public int GetCountExportItems(string item) { if (item == AppTitle || item == AllTitle) { _totalCount += AppServices.Gets().Count; } if (item == BookTitle || item == AllTitle) { _totalCount += BookServices.Gets().Count; } if (item == GameTitle || item == AllTitle) { _totalCount += GameServices.Gets().Count; } if (item == MovieTitle || item == AllTitle) { _totalCount += MovieServices.Gets().Count; } if (item == MusicTitle || item == AllTitle) { _totalCount += MusicServices.Gets().Count; } if (item == NdsTitle || item == AllTitle) { _totalCount += NdsServices.Gets().Count; } if (item == SeriesTitle || item == AllTitle) { _totalCount += SerieServices.Gets().Count; } if (item == XxxTitle || item == AllTitle) { _totalCount += XxxServices.Gets().Count; } return(_totalCount); }
private void ExportMusics(string path, string separator, string newline) { try { IList items = MusicServices.Gets(); for (int i = 0; i < items.Count; i++) { Music entity = items[i] as Music; CommonServices.GetChild(entity); if (_isCancelationPending == true) { break; } StringBuilder row = new StringBuilder(); row.Append("Music" + separator); if (entity != null) { row.Append(entity.Title + separator); if (entity.Publisher != null) { row.Append(entity.Publisher.Name + separator); } else { row.Append(string.Empty + separator); } if (entity.ReleaseDate != null) { row.Append(entity.ReleaseDate.Value.ToShortDateString() + separator); } else { row.Append(string.Empty + separator); } if (entity.MyRating != null) { row.Append(entity.MyRating + separator); } else { row.Append(string.Empty + separator); } //FIX 2.8.9.0 string description = string.Empty; if (entity.Comments != null) { description = entity.Comments.Replace(separator, " "); } row.Append(description + separator); StringBuilder types = new StringBuilder(); foreach (Genre item in entity.Genres) { if (types.Length == 0) { types.Append(item.DisplayName); } else { types.Append("," + item.DisplayName); } } row.Append(types + separator); row.Append(entity.AddedDate.ToShortDateString() + separator); if (entity.Media != null) { row.Append(entity.Media.Name + separator); } else { row.Append(string.Empty + separator); } row.Append(entity.FilePath + separator); row.Append(entity.FileName + separator); types = new StringBuilder(); foreach (Artist item in entity.Artists) { if (types.Length == 0) { types.Append(item.FulleName); } else { types.Append("," + item.FulleName); } } row.Append(types + separator); } File.AppendAllText(path, row + newline, Encoding.UTF8); _intAddedItem++; Current++; items[i] = null; } } catch (Exception ex) { Util.LogException(ex); throw; } }
private void ExportMusics(Document doc) { try { WriteChapter(doc, "Musics"); IList items = MusicServices.Gets(); PdfPTable mainTable = new PdfPTable(1); for (int i = 0; i < items.Count; i++) { Music entity = items[i] as Music; CommonServices.GetChild(entity); if (_isCancelationPending == true) { break; } if (entity != null) { Ressource cover = entity.Ressources.FirstOrDefault(x => x.IsDefault == true); byte[] image = null; if (cover != null) { image = cover.Value; } PdfPTable table = WriteCover(image, entity.Title); StringBuilder types = new StringBuilder(); foreach (Artist item in entity.Artists) { if (types.Length == 0) { types.Append(item.FulleName); } else { types.Append("," + item.FulleName); } } string editorName = string.Empty; if (entity.Publisher != null) { editorName = entity.Publisher.Name; } PdfPTable text = WriteFirstRow(entity.Title, types.ToString(), editorName); DateTime releasedate = DateTime.MinValue; if (entity.ReleaseDate != null) { releasedate = (DateTime)entity.ReleaseDate; } int rating = 0; if (entity.MyRating != null) { rating = (int)entity.MyRating; } WriteSecondRow(releasedate, rating, text); WriteDescription(entity.Comments, text); types = new StringBuilder(); foreach (Genre item in entity.Genres) { if (types.Length == 0) { types.Append(item.DisplayName); } else { types.Append("," + item.DisplayName); } } WriteTypeRow(types.ToString(), entity.AddedDate.ToShortDateString(), text); string media = string.Empty; if (entity.Media != null) { media = entity.Media.Name; } WriteMediaInfo(media, entity.FilePath, entity.FileName, text); table.AddCell(text); //table.SplitRows = false; PdfPCell cell = new PdfPCell(table); cell.Border = 0; cell.BorderColor = iTextSharp.text.BaseColor.WHITE; mainTable.AddCell(cell); } _intAddedItem++; Current++; items[i] = null; } doc.Add(mainTable); doc.NewPage(); } catch (Exception ex) { Util.LogException(ex); throw; } }