Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        private void ExportSeries(string path, string separator, string newline)
        {
            try
            {
                IList items = SerieServices.Gets();

                for (int i = 0; i < items.Count; i++)
                {
                    SeriesSeason entity = items[i] as SeriesSeason;

                    CommonServices.GetChild(entity);
                    if (_isCancelationPending == true)
                    {
                        break;
                    }

                    StringBuilder row = new StringBuilder();
                    row.Append("Serie" + 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.Description.Replace(separator, " ");
                        }
                        row.Append(description + separator);

                        StringBuilder types = new StringBuilder();
                        foreach (Genre item in entity.Genres)
                        {
                            if (types.Length == 0)
                            {
                                if (item != null)
                                {
                                    types.Append(item.DisplayName);
                                }
                            }
                            else if (item != null)
                            {
                                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(separator);
                        row.Append(separator);
                        row.Append(separator);
                        row.Append(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);
                        row.Append(entity.Season.ToString(CultureInfo.InvariantCulture) + separator);
                    }

                    File.AppendAllText(path, row + newline, Encoding.UTF8);

                    _intAddedItem++;
                    Current++;
                    items[i] = null;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                throw;
            }
        }
Esempio n. 5
0
        private void ExportSeries(Document doc)
        {
            try
            {
                WriteChapter(doc, "Series");
                IList items = SerieServices.Gets();

                PdfPTable mainTable = new PdfPTable(1);

                for (int i = 0; i < items.Count; i++)
                {
                    SeriesSeason entity = items[i] as SeriesSeason;

                    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);

                        string editorName = string.Empty;
                        if (entity.Publisher != null)
                        {
                            editorName = entity.Publisher.Name;
                        }

                        PdfPTable text = WriteFirstRow(entity.Title, entity.Season.ToString(CultureInfo.InvariantCulture), 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.Description, text);

                        StringBuilder types = new StringBuilder();
                        foreach (Genre item in entity.Genres)
                        {
                            if (types.Length == 0)
                            {
                                if (item != null)
                                {
                                    types.Append(item.DisplayName);
                                }
                            }
                            else if (item != null)
                            {
                                types.Append("," + item.DisplayName);
                            }
                        }

                        WriteTypeRow(types.ToString(), entity.AddedDate.ToShortDateString(), text);

                        types = new StringBuilder();
                        foreach (Artist item in entity.Artists)
                        {
                            if (types.Length == 0)
                            {
                                types.Append(item.FulleName);
                            }
                            else
                            {
                                types.Append("," + item.FulleName);
                            }
                        }
                        WriteCast(types.ToString(), text);

                        string media = string.Empty;
                        if (entity.Media != null)
                        {
                            media = entity.Media.Name;
                        }
                        WriteMediaInfo(media, entity.FilePath, string.Empty, 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;
            }
        }