Esempio n. 1
0
        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;
                }
            }
        }
Esempio n. 2
0
 public static void RefreshSmallCovers()
 {
     AppServices.RefreshSmallCover();
     BookServices.RefreshSmallCover();
     GameServices.RefreshSmallCover();
     MovieServices.RefreshSmallCover();
     MusicServices.RefreshSmallCover();
     NdsServices.RefreshSmallCover();
     SerieServices.RefreshSmallCover();
     XxxServices.RefreshSmallCover();
 }
Esempio n. 3
0
        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;
                    }
                }
            }
        }
Esempio n. 4
0
        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;
                }
            }
        }
Esempio n. 5
0
        public static Hashtable getInfo(string file, string entityId)
        {
            Hashtable results = new Hashtable();
            MediaInfo MI      = new MediaInfo();

            MI.Open(file);
            #region Released
            string value = MI.Get(StreamKind.General, 0, Infos.Encoded_Date.ToString());
            if (string.IsNullOrWhiteSpace(value) == false)
            {
                value = value.Replace("UTC", "");
                DateTime released;
                if (DateTime.TryParse(value, out released) == true)
                {
                    results.Add("Released", released);
                }
            }
            #endregion
            #region Runtime
            value = MI.Get(StreamKind.General, 0, Infos.Duration.ToString());
            if (string.IsNullOrWhiteSpace(value) == false)
            {
                double ms;
                if (double.TryParse(value, out ms) == true)
                {
                    results.Add("Runtime", (int?)TimeSpan.FromMilliseconds(ms).TotalMinutes);
                }
            }
            #endregion
            #region Format
            string format = MI.Get(StreamKind.General, 0, Infos.Format.ToString());
            string height = MI.Get(StreamKind.Video, 0, Infos.Height.ToString());
            string width  = MI.Get(StreamKind.Video, 0, Infos.Width.ToString());

            results.Add("Format", MovieServices.GetFormat(format, height, width));
            #endregion
            #region AspectRatio
            value = MI.Get(StreamKind.Video, 0, "DisplayAspectRatio/String");
            if (string.IsNullOrWhiteSpace(value) == false)
            {
                results.Add(Infos.DisplayAspectRatio.ToString(), MovieServices.GetAspectRatio(value));
            }
            #endregion
            #region Audios

            List <Audio> audios = new List <Audio>();
            for (int i = 0; i < MI.Count_Get(StreamKind.Audio); i++)
            {
                string langue = MI.Get(StreamKind.Audio, i, @"Language/String");
                value = MI.Get(StreamKind.Audio, i, Infos.Format.ToString());
                audios.Add(MovieServices.GetMovieAudio(value, langue));
            }

            if (audios.Count > 0)
            {
                results.Add("Audios", audios);
            }

            #endregion
            #region Subs

            List <string> subs = new List <string>();
            for (int i = 0; i < MI.Count_Get(StreamKind.Text); i++)
            {
                subs.Add(MI.Get(StreamKind.Text, i, @"Language/String"));
            }

            if (subs.Count > 0)
            {
                results.Add("Subs", subs);
            }

            #endregion

            MI.Close();
            return(results);
        }
Esempio n. 6
0
        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;
            }
        }