public static void SetClean(IList lstSelectedItem)
        {
            foreach (ThumbItem item in lstSelectedItem)
            {
                switch (item.EType)
                {
                case EntityType.Apps:
                    Apps objApps = Dal.GetInstance.GetApps(item.Id);
                    AppServices.Clean(objApps);
                    Update(objApps);
                    break;

                case EntityType.Books:
                    Books objBooks = Dal.GetInstance.GetBooks(item.Id);
                    BookServices.Clean(objBooks);
                    Update(objBooks);
                    break;

                case EntityType.Games:
                    Gamez objGamez = Dal.GetInstance.GetGames(item.Id);
                    GameServices.Clean(objGamez);
                    Update(objGamez);
                    break;

                case EntityType.Movie:
                    Movie objMovie = Dal.GetInstance.GetMovies(item.Id);
                    MovieServices.Clean(objMovie);
                    Update(objMovie);
                    break;

                case EntityType.Music:
                    Music objMusic = Dal.GetInstance.GetMusics(item.Id);
                    MusicServices.Clean(objMusic);
                    Update(objMusic);
                    break;

                case EntityType.Nds:
                    Nds objNds = Dal.GetInstance.GetNdss(item.Id);
                    NdsServices.Clean(objNds);
                    Update(objNds);
                    break;

                case EntityType.Series:
                    SeriesSeason objSeriesSeason = Dal.GetInstance.GetSeries_Seasons(item.Id);
                    SerieServices.Clean(objSeriesSeason);
                    Update(objSeriesSeason);
                    break;

                case EntityType.XXX:
                    XXX objXxx = Dal.GetInstance.GetXxXs(item.Id);
                    XxxServices.Clean(objXxx);
                    Update(objXxx);
                    break;
                }
            }
        }
 public static void RefreshSmallCovers()
 {
     AppServices.RefreshSmallCover();
     BookServices.RefreshSmallCover();
     GameServices.RefreshSmallCover();
     MovieServices.RefreshSmallCover();
     MusicServices.RefreshSmallCover();
     NdsServices.RefreshSmallCover();
     SerieServices.RefreshSmallCover();
     XxxServices.RefreshSmallCover();
 }
        public static void DeleteSelectedListBoxItem(IList lstSelectedItems)
        {
            foreach (ListBoxItem item in lstSelectedItems)
            {
                IMyCollectionsData data = item.DataContext as IMyCollectionsData;

                if (data != null)
                {
                    switch (data.ObjectType)
                    {
                    case EntityType.Apps:
                        AppServices.Delete(data.Id);
                        break;

                    case EntityType.Artist:
                        ArtistServices.Delete(data.Id);
                        break;

                    case EntityType.Books:
                        BookServices.Delete(data.Id);
                        break;

                    case EntityType.Games:
                        GameServices.Delete(data.Id);
                        break;

                    case EntityType.Movie:
                        MovieServices.Delete(data.Id);
                        break;

                    case EntityType.Music:
                        MusicServices.Delete(data.Id);
                        break;

                    case EntityType.Nds:
                        NdsServices.Delete(data.Id);
                        break;

                    case EntityType.Series:
                        SerieServices.Delete(data.Id);
                        break;

                    case EntityType.XXX:
                        XxxServices.Delete(data.Id);
                        break;
                    }
                }
            }
        }
        public static void DeleteSelected(IList lstSelectedItems)
        {
            foreach (ThumbItem item in lstSelectedItems)
            {
                switch (item.EType)
                {
                case EntityType.Apps:
                    AppServices.Delete(item.Id);
                    break;

                case EntityType.Artist:
                    ArtistServices.Delete(item.Id);
                    break;

                case EntityType.Books:
                    BookServices.Delete(item.Id);
                    break;

                case EntityType.Games:
                    GameServices.Delete(item.Id);
                    break;

                case EntityType.Movie:
                    MovieServices.Delete(item.Id);
                    break;

                case EntityType.Music:
                    MusicServices.Delete(item.Id);
                    break;

                case EntityType.Nds:
                    NdsServices.Delete(item.Id);
                    break;

                case EntityType.Series:
                    SerieServices.Delete(item.Id);
                    break;

                case EntityType.XXX:
                    XxxServices.Delete(item.Id);
                    break;
                }
            }
        }
Beispiel #5
0
        public static bool CopyToReader(EBookReaderDevices reader, string id)
        {
            Books book = new BookServices().Get(id) as Books;

            if (book != null)
            {
                string filePath = Path.Combine(book.FilePath, book.FileName);
                if (reader != null && string.IsNullOrWhiteSpace(filePath) == false)
                {
                    if (File.Exists(KindleGenApp))
                    {
                        ProcessStartInfo processStartInfo = new ProcessStartInfo();
                        processStartInfo.FileName  = KindleGenApp;
                        processStartInfo.Arguments = string.Format("\"{0}\"", filePath);
                        processStartInfo.RedirectStandardOutput = true;
                        processStartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
                        processStartInfo.CreateNoWindow         = true;
                        processStartInfo.UseShellExecute        = false;
                        Process convertProcess = Process.Start(processStartInfo);
                        convertProcess.WaitForExit(10000);

                        string output = Path.ChangeExtension(filePath, ".mobi");

                        if (File.Exists(output))
                        {
                            FileInfo file = new FileInfo(output);
                            if (Directory.Exists(Path.Combine(reader.LogicalDisk + @"\", KindleFolder)) == false)
                            {
                                Directory.CreateDirectory(Path.Combine(reader.LogicalDisk + @"\", KindleFolder));
                            }

                            File.Copy(output, Path.Combine(reader.LogicalDisk + @"\", KindleFolder, file.Name));

                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
        public static void Update(IMyCollectionsData entity, string strLanguage, string strMedia, string studio, IEnumerable <string> lstGenres, IEnumerable objLinks,
                                  IEnumerable <string> artistName, string fileFormat, string aspectRatio, string platform, IEnumerable <string> metaData)
        {
            try
            {
                LinksServices.DeleteLinks(entity);
                entity.Media    = MediaServices.Get(strMedia, true);
                entity.Language = LanguageServices.GetLanguage(strLanguage, true);

                #region Publisher

                if (String.IsNullOrWhiteSpace(studio) == false)
                {
                    bool isNew;
                    switch (entity.ObjectType)
                    {
                    case EntityType.Nds:
                    case EntityType.Games:
                    case EntityType.Books:
                    case EntityType.Apps:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "App_Editor");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("App_Editor", entity.Publisher);
                        }
                        break;

                    case EntityType.Series:
                    case EntityType.Movie:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "Movie_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Movie_Studio", entity.Publisher);
                        }
                        break;

                    case EntityType.Music:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "Music_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("Music_Studio", entity.Publisher);
                        }
                        break;

                    case EntityType.XXX:
                        entity.Publisher = PublisherServices.GetPublisher(studio, out isNew, "XXX_Studio");
                        if (isNew == true)
                        {
                            Dal.GetInstance.AddPublisher("XXX_Studio", entity.Publisher);
                        }
                        break;
                    }
                }

                #endregion


                if (String.IsNullOrWhiteSpace(entity.FilePath))
                {
                    entity.FilePath = String.Empty;
                }

                switch (entity.ObjectType)
                {
                case EntityType.Apps:
                    Dal.GetInstance.AddApps(entity as Apps);
                    break;

                case EntityType.Books:
                    #region FileFormat
                    if (entity.FileFormat == null)
                    {
                        entity.FileFormat = BookServices.GetFormat(fileFormat, true);
                    }
                    else if (entity.FileFormat.Name != fileFormat)
                    {
                        entity.FileFormat = BookServices.GetFormat(fileFormat, true);
                    }
                    #endregion
                    Dal.GetInstance.AddBook(entity as Books);
                    break;

                case EntityType.Games:
                    entity.Platform = GameServices.GetPlatform(platform, true);
                    Dal.GetInstance.AddGame(entity as Gamez);
                    break;

                case EntityType.Movie:
                    #region FileFormat
                    if (entity.FileFormat == null)
                    {
                        entity.FileFormat = MovieServices.GetFormat(fileFormat);
                    }
                    else if (entity.FileFormat.Name != fileFormat)
                    {
                        entity.FileFormat = MovieServices.GetFormat(fileFormat);
                    }
                    #endregion
                    #region AspectRatio
                    if (entity.AspectRatio == null)
                    {
                        entity.AspectRatio = MovieServices.GetAspectRatio(aspectRatio);
                    }
                    else if (entity.AspectRatio.Name != aspectRatio)
                    {
                        entity.AspectRatio = MovieServices.GetAspectRatio(aspectRatio);
                    }
                    #endregion
                    Dal.GetInstance.AddMovie(entity as Movie);
                    break;

                case EntityType.Music:
                    if (MySettings.AutoUpdateID3 == true)
                    {
                        Task.Factory.StartNew(() => MusicServices.UpdateId3(entity as Music));
                    }
                    Dal.GetInstance.AddMusic(entity as Music);
                    Dal.GetInstance.AddTracks(entity as Music);
                    break;

                case EntityType.Nds:
                    Dal.GetInstance.AddNds(entity as Nds);
                    break;

                case EntityType.Series:
                    Dal.GetInstance.AddSeriesSeason(entity as SeriesSeason);
                    break;

                case EntityType.XXX:
                    Dal.GetInstance.AddXxx(entity as XXX);
                    break;
                }

                #region Genres
                Dal.GetInstance.UnlinkGenre(entity);

                GenreServices.AddGenres(lstGenres, entity, true);
                #endregion
                #region MetaData
                Dal.GetInstance.UnlinkMetaData(entity);
                MetaDataServices.Link(entity, metaData);
                #endregion

                LinksServices.AddLinks(objLinks.Cast <string>(), entity, true);
                RessourcesServices.UpdateRessources(entity);

                #region Artist

                if (entity.ObjectType != EntityType.Books && entity.ObjectType != EntityType.Music)
                {
                    Task.Factory.StartNew(() => UpdateArtist(entity, artistName));
                }
                else
                {
                    UpdateArtist(entity, artistName);
                }

                #endregion
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                throw;
            }
        }