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 cmdAddSeason_Click(object sender, RoutedEventArgs e) { if (_objEntity == null) { new MessageBoxYesNo("You must first save at least one season for this Series.", false, true).ShowDialog(); } else { if (SerieServices.AddNewSeason(_objEntity) == true) { new MessageBoxYesNo("A new season was added", false, false).ShowDialog(); NewSeasonAdded = true; } else { new MessageBoxYesNo("Error occured, please contact us", false, true).ShowDialog(); } } }
private SeriesSeason IsSeasonFolder(string folderName, string folderPath, out bool create) { create = true; var season = from items in _seriesSeasonValue where folderName.ToUpper() == items.ToUpper() select items; DirectoryInfo folder = new DirectoryInfo(Path.Combine(folderPath, folderName)); if (season.Any()) { if (folder.Exists == true) { int seasonNumber; if (int.TryParse(Regex.Match(folderName, @"\d+").Value, out seasonNumber) == true) { if (folder.Parent != null) { bool outCreate; if ( IsSeasonFolder(folder.Parent.Name, folder.Parent.FullName.Substring(0, folder.Parent.FullName.IndexOf(folder.Parent.Name, StringComparison.Ordinal)), out outCreate) == null) { if (outCreate == false) { create = false; return(null); } SeriesSeason objEntity = new SeriesSeason(); objEntity.SerieId = SerieServices.GetSerieId(folder.Parent.Name); objEntity.Title = folder.Parent.Name; objEntity.Season = seasonNumber; return(objEntity); } else { create = false; } } } } } else { if (folder.Exists == true) { if (folder.Parent != null) { int seasonNumber; season = from items in _seriesSeasonValue where folder.Parent.Name.ToUpper() == items.ToUpper() select items; if (season.Any() && int.TryParse(Regex.Match(folder.Parent.Name, @"\d+").Value, out seasonNumber) == true) { create = false; } } } } return(null); }
private void AddSeries(string strTitle, string strFileName, string strFilePath) { if (IsRootFolder(strFileName, strFilePath) == false) { bool create; SeriesSeason objEntity = IsSeasonFolder(strFileName, strFilePath, out create); if (create == true) { if (objEntity == null) { objEntity = new SeriesSeason(); objEntity.SerieId = SerieServices.GetSerieId(strTitle); objEntity.Title = strTitle; objEntity.Season = 1; } Media objMedia = MediaServices.Get(_strMediaName.Trim(), _mediaType, _path, _cleanTitle, _entityType, _patternType, _useSubFolder, _bGetImage, _bParseNfo, true); objEntity.Media = objMedia; objEntity.Watched = false; objEntity.IsComplete = false; objEntity.ToBeDeleted = false; objEntity.ToWatch = false; objEntity.AddedDate = DateTime.Now; objEntity.Ressources = new List <Ressource>(); objEntity.Genres = new List <Genre>(); objEntity.Audios = new List <Audio>(); objEntity.Subtitles = new List <Language>(); #region File objEntity.FilePath = Path.Combine(strFilePath, strFileName); #endregion #region Cover if (_bGetImage == true) { RessourcesServices.AddImage(Util.GetLocalImage(objEntity.FilePath, string.Empty, _bFile), objEntity, true); } #endregion if (string.IsNullOrEmpty(objEntity.Title) == false) { bool bExist = false; if (Dal.GetInstance.GetSeriesSeason(objEntity.Media.Name, objEntity.FilePath, objEntity.Season) != null) { bExist = true; } if (bExist == false) { #region MediaInfo FileInfo file = new FileInfo(Path.Combine(strFilePath, strFileName)); if (file.Attributes == FileAttributes.Directory) { if (Directory.Exists(file.FullName) == true) { string[] lstFile = Util.GetFiles(file.FullName, new[] { "*.mkv", "*.mp4", "*.avi", "*.divx" }); if (lstFile.Any()) { SerieServices.Fill(MediaInfoService.getInfo(lstFile[0], objEntity.Id), objEntity); } } } else if (file.Attributes == FileAttributes.Normal) { SerieServices.Fill(MediaInfoService.getInfo(file.FullName, objEntity.Id), objEntity); } #endregion #region ParseNfo if (_bParseNfo == true) { string errorMessage; SerieServices.ParseNfo(objEntity, out errorMessage); } #endregion Dal.GetInstance.AddSeriesSeason(objEntity); _intAddedItem++; } else { _intNotAddedItem++; } } } } }
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; } }
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; } }
private void UpdateItem(ThumbItem thumbItem) { try { if (thumbItem == null) { return; } bool?saved = false; switch (thumbItem.EType) { case EntityType.Apps: AppsUpdate objAppsDetails = new AppsUpdate(); objAppsDetails.ItemsId = thumbItem.Id; saved = objAppsDetails.ShowDialog(); if (saved == true) { Apps apps = new AppServices().Get(thumbItem.Id) as Apps; FileThumbItem(thumbItem, apps); } break; case EntityType.Artist: Task.Factory.StartNew(() => Util.NotifyEvent("ArtistDetail:" + thumbItem.Name)); ArtistDetail artistDetails = new ArtistDetail(thumbItem.Name, thumbItem.EType); saved = artistDetails.ShowDialog(); break; case EntityType.Books: BookUpdate objBookDetails = new BookUpdate(); objBookDetails.ItemsId = thumbItem.Id; saved = objBookDetails.ShowDialog(); if (saved == true) { Books books = new BookServices().Get(thumbItem.Id) as Books; FileThumbItem(thumbItem, books); } break; case EntityType.Games: GameUpdate objGameDetails = new GameUpdate(); objGameDetails.ItemsId = thumbItem.Id; saved = objGameDetails.ShowDialog(); if (saved == true) { Gamez games = new GameServices().Get(thumbItem.Id) as Gamez; FileThumbItem(thumbItem, games); } break; case EntityType.Movie: MovieUpdate objMovieDetails = new MovieUpdate(); objMovieDetails.ItemsId = thumbItem.Id; saved = objMovieDetails.ShowDialog(); if (saved == true) { Movie movie = new MovieServices().Get(thumbItem.Id) as Movie; FileThumbItem(thumbItem, movie); } break; case EntityType.Music: MusicUpdate objMusicDetails = new MusicUpdate(); objMusicDetails.ItemsId = thumbItem.Id; saved = objMusicDetails.ShowDialog(); if (saved == true) { Music music = new MusicServices().Get(thumbItem.Id) as Music; FileThumbItem(thumbItem, music); } break; case EntityType.Nds: NdsUpdate objNdsDetails = new NdsUpdate(); objNdsDetails.ItemsId = thumbItem.Id; saved = objNdsDetails.ShowDialog(); if (saved == true) { Nds nds = new NdsServices().Get(thumbItem.Id) as Nds; FileThumbItem(thumbItem, nds); } break; case EntityType.Series: Main main = Util.TryFindParent <Main>(this); main.NewSeasonAdded = false; SerieUpdate objSerieDetails = new SerieUpdate(); objSerieDetails.ItemsId = thumbItem.Id; saved = objSerieDetails.ShowDialog(); main.NewSeasonAdded = objSerieDetails.NewSeasonAdded; if (objSerieDetails.NewSeasonAdded == true) { saved = true; } if (saved == true) { SeriesSeason serie = new SerieServices().Get(thumbItem.Id) as SeriesSeason; FileThumbItem(thumbItem, serie); } break; case EntityType.XXX: XxxUpdate objXxxDetails = new XxxUpdate(); objXxxDetails.ItemsId = thumbItem.Id; saved = objXxxDetails.ShowDialog(); if (saved == true) { XXX xxx = new XxxServices().Get(thumbItem.Id) as XXX; FileThumbItem(thumbItem, xxx); } break; } _currentItem = thumbItem; if (saved == true) { RoutedEventArgs args = new RoutedEventArgs(UpdateEvent); RaiseEvent(args); Cursor = null; ShowVisibleItems(MainStack); } } catch (Exception ex) { CatchException(ex); } }