コード例 #1
0
        private static void FileThumbItem(ThumbItem thumbItem, XXX item)
        {
            if (item == null)
            {
                return;
            }

            thumbItem.Added       = item.AddedDate;
            thumbItem.Cover       = item.Cover;
            thumbItem.Deleted     = item.IsDeleted;
            thumbItem.Description = item.Description;
            if (item.Cover != null)
            {
                thumbItem.HasCover = true;
            }
            else
            {
                thumbItem.Cover    = Util.CreateCover(item.Title);
                thumbItem.HasCover = false;
            }
            thumbItem.IsComplete  = item.IsComplete;
            thumbItem.Media       = item.Media.Name;
            thumbItem.Name        = item.Title;
            thumbItem.MyRating    = item.MyRating / 4;
            thumbItem.ReleaseDate = item.ReleaseDate;
            thumbItem.Runtime     = item.Runtime;
            thumbItem.Seen        = item.Watched;
            thumbItem.ToBeDeleted = item.ToBeDeleted;
            thumbItem.ToBuy       = item.IsWhish;
            thumbItem.ToWatch     = item.ToWatch;
        }
コード例 #2
0
 void OnPlay(object sender, ExecutedRoutedEventArgs args)
 {
     try
     {
         if (args != null)
         {
             if (args.Parameter != null)
             {
                 if (args.Parameter.GetType() == typeof(ThumbItem))
                 {
                     ThumbItem item    = args.Parameter as ThumbItem;
                     string    results = CommonServices.OpenFile(item);
                     if (string.IsNullOrWhiteSpace(results) == false)
                     {
                         new MessageBoxYesNo(results, false, true).ShowDialog();
                     }
                 }
             }
             else
             {
                 string results = CommonServices.OpenFile(MainStack.SelectedItem as ThumbItem);
                 if (string.IsNullOrWhiteSpace(results) == false)
                 {
                     new MessageBoxYesNo(results, false, true).ShowDialog();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         CatchException(ex);
     }
 }
コード例 #3
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                Total = _objEntity.Count();
                IServices service = null;

                //Fix Since 2.5.5.0
                for (int i = 0; i < _objEntity.Count(); i++)
                {
                    ThumbItem item = _objEntity.ElementAt(i);

                    if (_isCancelationPending == true)
                    {
                        break;
                    }

                    if (service == null)
                    {
                        service = Util.GetService(item.EType);
                    }

                    IMyCollectionsData currentItem = service.Get(item.Id);
                    service.GetInfoFromWeb(currentItem);
                    service.Add(currentItem);

                    Current++;
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
            }
        }
コード例 #4
0
        private void mniGenerateTvix_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            string strTvixOutput;

            if (Convert.ToBoolean(MySettings.TvixInFolder) == true)
            {
                strTvixOutput = string.Empty;
            }
            else
            {
                strTvixOutput = MySettings.TvixOutput;
            }

            ThumbItem item = CoverFlow.SelectedItem as ThumbItem;

            if (item != null)
            {
                ThemeServices.CreateFiles(item.Id, strTvixOutput, item.EType);
            }

            if (string.IsNullOrEmpty(strTvixOutput))
            {
                new MessageBoxYesNo("1 layout generated", false, false).ShowDialog();
            }
            else
            {
                new MessageBoxYesNo("1 layout generated in " + strTvixOutput, false, false).ShowDialog();
            }

            Cursor = null;
        }
コード例 #5
0
        private void mniLoanInfo_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            ThumbItem thumbitem = MainStack.SelectedItem as ThumbItem;

            new LoanTo(thumbitem).Show();
            Cursor = null;
        }
コード例 #6
0
        private void mniOpenSelected_Click(object sender, RoutedEventArgs e)
        {
            ThumbItem item    = MainStack.SelectedItem as ThumbItem;
            string    results = CommonServices.OpenFile(item);

            if (string.IsNullOrWhiteSpace(results) == false)
            {
                new MessageBoxYesNo(results, false, true).ShowDialog();
            }
        }
コード例 #7
0
        public static bool ViewNotComplete(object item)
        {
            ThumbItem thumitem = item as ThumbItem;

            if (thumitem != null && (thumitem.IsComplete == false && thumitem.Deleted == false))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
        public static bool WithoutCover(object item)
        {
            ThumbItem thumitem = item as ThumbItem;

            if (thumitem != null && (thumitem.HasCover == false && thumitem.Deleted == false))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #9
0
        public static bool ViewToBuy(object item)
        {
            ThumbItem thumitem = item as ThumbItem;

            if (thumitem != null && (thumitem.ToBuy == true && thumitem.Deleted == false))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #10
0
        public static void LaunchDocument(ThumbItem item)
        {
            string manualPath;
            using (ThumbGroup thumbGroup = new ThumbGroup(item))
                manualPath = thumbGroup.ManualPath;

            if (string.IsNullOrEmpty(manualPath))
                return;

            using (Process proc = new Process())
            {
                proc.StartInfo = new ProcessStartInfo();
                proc.StartInfo.FileName = manualPath;
                proc.Start();
            }
        }
コード例 #11
0
        private void mniSetBack_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;

            ThumbItem thumbitem = MainStack.SelectedItem as ThumbItem;

            if (thumbitem != null)
            {
                int intResults = LoanServices.SetBackLoan(new Collection <string> {
                    thumbitem.Id
                });
                RoutedEventArgs args = new RoutedEventArgs(SaveEvent);
                RaiseEvent(args);
                new MessageBoxYesNo(intResults.ToString(CultureInfo.InvariantCulture) + " item are back from loan", false, false).ShowDialog();
            }
            Cursor = null;
        }
コード例 #12
0
 void OnEdit(object sender, ExecutedRoutedEventArgs args)
 {
     if (args != null)
     {
         if (args.Parameter != null)
         {
             if (args.Parameter.GetType() == typeof(ThumbItem))
             {
                 ThumbItem item = args.Parameter as ThumbItem;
                 UpdateItem(item);
             }
         }
         else
         {
             UpdateItem(MainStack.SelectedItem as ThumbItem);
         }
     }
 }
コード例 #13
0
 void OnDelete(object sender, ExecutedRoutedEventArgs args)
 {
     if (args != null)
     {
         if (args.Parameter != null)
         {
             if (args.Parameter.GetType() == typeof(ThumbItem))
             {
                 ThumbItem toDelete = args.Parameter as ThumbItem;
                 DeleteItem(new List <ThumbItem> {
                     toDelete
                 });
             }
         }
         else
         {
             DeleteItem(new List <ThumbItem> {
                 MainStack.SelectedItem as ThumbItem
             });
         }
     }
 }
コード例 #14
0
        private static void FileThumbItem(ThumbItem thumbItem, Music item)
        {
            thumbItem.Added       = item.AddedDate;
            thumbItem.Cover       = item.Cover;
            thumbItem.Deleted     = item.IsDeleted;
            thumbItem.Description = item.Comments;
            if (item.Cover != null)
            {
                thumbItem.HasCover = true;
            }
            else
            {
                thumbItem.Cover    = Util.CreateCover(item.Title);
                thumbItem.HasCover = false;
            }
            thumbItem.IsComplete  = item.IsComplete;
            thumbItem.Media       = item.Media.Name;
            thumbItem.Name        = item.Title;
            thumbItem.MyRating    = item.MyRating / 4;
            thumbItem.ReleaseDate = item.ReleaseDate;
            thumbItem.Runtime     = item.Runtime;
            thumbItem.Seen        = item.Watched;
            thumbItem.ToBeDeleted = item.ToBeDeleted;
            thumbItem.ToBuy       = item.IsWhish;
            thumbItem.ToWatch     = item.ToWatch;

            Artist artist = (from items in item.Artists
                             select items).FirstOrDefault <Artist>();

            string name = string.Empty;

            if (artist != null)
            {
                name = artist.FirstName + " " + artist.LastName;
            }

            thumbItem.Artist = name;
        }
コード例 #15
0
        private static void FileThumbItem(ThumbItem thumbItem, SeriesSeason item)
        {
            //Fix Since 2.6.7.0
            if (item == null)
            {
                return;
            }

            thumbItem.Added       = item.AddedDate;
            thumbItem.Cover       = item.Cover;
            thumbItem.Deleted     = item.IsDeleted;
            thumbItem.Description = item.Description;
            thumbItem.Name        = item.Title + " - s" + item.Season.ToString(CultureInfo.InvariantCulture);

            if (item.Cover != null)
            {
                thumbItem.HasCover = true;
            }
            else
            {
                thumbItem.Cover    = Util.CreateCover(item.Title);
                thumbItem.HasCover = false;
            }
            thumbItem.IsComplete = item.IsComplete;
            if (item.Media != null)
            {
                thumbItem.Media = item.Media.Name;
            }
            thumbItem.Name     = item.Title;
            thumbItem.MyRating = item.MyRating / 4;
            //thumbItem.PublicRating = item.MyRating/4;
            thumbItem.ReleaseDate = item.ReleaseDate;
            thumbItem.Runtime     = item.Runtime;
            thumbItem.Seen        = item.Watched;
            thumbItem.ToBeDeleted = item.ToBeDeleted;
            thumbItem.ToBuy       = item.IsWhish;
            thumbItem.ToWatch     = item.ToWatch;
        }
コード例 #16
0
        private void UpdateItem(ThumbItem thumbItem)
        {
            try
            {
                bool?saved = false;
                if (thumbItem != null && thumbItem.EType == EntityType.Artist)
                {
                    Task.Factory.StartNew(() => Util.NotifyEvent("ArtistDetail:" + thumbItem.Name));
                    ArtistDetail artistdetail = new ArtistDetail(thumbItem.Name, thumbItem.EType);
                    saved = artistdetail.ShowDialog();
                }

                if (saved == true)
                {
                    RoutedEventArgs args = new RoutedEventArgs(SaveEventVp);
                    RaiseEvent(args);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }
コード例 #17
0
        public LoanTo(ThumbItem thumbitem)
        {
            InitializeComponent();

            if (thumbitem == null)
            {
                return;
            }

            _strId         = thumbitem.Id;
            _selectedItems = thumbitem.EType;

            cboAlias.ItemsSource       = FriendServices.Gets();
            cboAlias.DisplayMemberPath = "Alias";
            imgTitle.Source            = Util.CreateSmallImage(thumbitem.Cover);
            lblTitle.Text = thumbitem.Name;

            Loan objLoan = LoanServices.Get(_strId);

            if (objLoan != null)
            {
                txtEndDate.Text = objLoan.EndDate.ToShortDateString();

                //Fix since 2.7.12.0
                if (objLoan.Friend != null)
                {
                    cboAlias.Text = objLoan.Friend.Alias;
                }

                txtStartDate.Text = objLoan.StartDate.ToShortDateString();
            }
            else
            {
                txtStartDate.Text = DateTime.Now.ToShortDateString();
                txtEndDate.Text   = DateTime.Now.AddDays(10).ToShortDateString();
            }
        }
コード例 #18
0
        private void mniSendKindle_OnClick(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;

            Task.Factory.StartNew(() => Util.NotifyEvent("SendKindle"));

            try
            {
                EBookReaderDevices reader = EBookReaderServices.GetReader();
                if (reader != null)
                {
                    ThumbItem item = MainStack.SelectedItems[0] as ThumbItem;
                    if (item != null)
                    {
                        bool results = EBookReaderServices.CopyToReader(reader, item.Id);
                        if (results == true)
                        {
                            new MessageBoxYesNo(item.Name + " " +
                                                ((App)Application.Current).LoadedLanguageResourceDictionary["CopyKindleOK"], false, false).ShowDialog();
                        }
                        else
                        {
                            new MessageBoxYesNo(((App)Application.Current).LoadedLanguageResourceDictionary["CopyKindleKO"].ToString(), false, false).ShowDialog();
                        }
                    }
                }
                else
                {
                    new MessageBoxYesNo(((App)Application.Current).LoadedLanguageResourceDictionary["NoKindle"].ToString(), false, false).ShowDialog();
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
            Cursor = null;
        }
コード例 #19
0
        public static bool ViewAll(object item)
        {
            ThumbItem thumitem = item as ThumbItem;

            return(thumitem != null && !thumitem.Deleted);
        }
コード例 #20
0
        /// <summary>
        /// Initialises a new ThumbGroup with the thumbs of the specified parent
        /// </summary>
        /// <param name="parent">An Emulator or Game</param>
        public ThumbGroup(ThumbItem parent)
        {
            if (parent == null)
                throw new ArgumentException("The parent item cannot be null", "parent");

            Options options = EmulatorsCore.Options;
            options.EnterReadLock();
            bool doResize = options.ResizeGameart;
            maxThumbDimension = EmulatorsCore.Options.MaxImageDimensions;
            string imageDirectory = options.ImageDirectory;
            options.ExitReadLock();

            string thumbFolder = parent.ThumbFolder;
            if (doResize)
                thumbAspect = parent.AspectRatio;
            
            parentItem = parent;
            lock (parent.SyncRoot)
            {
                if (parent.Id != null)
                    thumbPath = string.Format(@"{0}\{1}\{2}\{3}\", imageDirectory, THUMB_DIR_NAME, thumbFolder, parent.Id);
            }

            //init Thumbs
            logo = new Thumb(ThumbType.Logo);
            frontCover = new Thumb(ThumbType.FrontCover);
            backCover = new Thumb(ThumbType.BackCover);
            titleScreen = new Thumb(ThumbType.TitleScreen);
            inGame = new Thumb(ThumbType.InGameScreen);
            fanart = new Thumb(ThumbType.Fanart);
            //load the paths/images
            loadThumbs();
        }
コード例 #21
0
        private void UpdateItem(ThumbItem thumbItem)
        {
            try
            {
                bool?saved = false;

                switch (thumbItem.EType)
                {
                case EntityType.Apps:
                    AppsUpdate objAppsDetails = new AppsUpdate();
                    objAppsDetails.ItemsId = thumbItem.Id;
                    saved = objAppsDetails.ShowDialog();
                    break;

                case EntityType.Books:
                    BookUpdate objBookDetails = new BookUpdate();
                    objBookDetails.ItemsId = thumbItem.Id;
                    saved = objBookDetails.ShowDialog();
                    break;

                case EntityType.Games:
                    GameUpdate objGameDetails = new GameUpdate();
                    objGameDetails.ItemsId = thumbItem.Id;
                    saved = objGameDetails.ShowDialog();
                    break;

                case EntityType.Movie:
                    MovieUpdate objMovieDetails = new MovieUpdate();
                    objMovieDetails.ItemsId = thumbItem.Id;
                    saved = objMovieDetails.ShowDialog();
                    break;

                case EntityType.Music:
                    MusicUpdate objMusicDetails = new MusicUpdate();
                    objMusicDetails.ItemsId = thumbItem.Id;
                    saved = objMusicDetails.ShowDialog();
                    break;

                case EntityType.Nds:
                    NdsUpdate objNdsDetails = new NdsUpdate();
                    objNdsDetails.ItemsId = thumbItem.Id;
                    saved = objNdsDetails.ShowDialog();
                    break;

                case EntityType.Series:
                    SerieUpdate objSerieDetails = new SerieUpdate();
                    objSerieDetails.ItemsId = thumbItem.Id;
                    saved = objSerieDetails.ShowDialog();
                    break;

                case EntityType.XXX:
                    XxxUpdate objXxxDetails = new XxxUpdate();
                    objXxxDetails.ItemsId = thumbItem.Id;
                    saved = objXxxDetails.ShowDialog();
                    break;
                }

                if (saved == true)
                {
                    RoutedEventArgs args = new RoutedEventArgs(SaveEventCf);
                    RaiseEvent(args);
                }
            }
            catch (Exception ex)
            {
                CatchException(ex);
            }
        }
コード例 #22
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string    tooltip = string.Empty;
            ThumbItem item    = value as ThumbItem;

            if (item != null)
            {
                Order currentOrder = ((App)Application.Current).CurrentOrder;
                switch (currentOrder)
                {
                case Order.Name:
                    tooltip = item.Name;
                    break;

                case Order.Added:
                    tooltip = string.Format(@"{0} - {1}", item.Name, item.Added.ToShortDateString());
                    break;

                case Order.Runtime:
                    int?time = item.Runtime;
                    if (time == null)
                    {
                        return(item.Name);
                    }

                    string runtime;

                    TimeSpan ts = TimeSpan.FromSeconds((int)time);
                    if (ts.Hours <= 0)
                    {
                        runtime = String.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds);
                    }
                    else
                    {
                        runtime = String.Format("{0}:{1}:{2:D2}", ts.Hours, ts.Minutes, ts.Seconds);
                    }

                    tooltip = string.Format(@"{0} - {1}", item.Name, runtime);
                    break;

                case Order.Media:
                    tooltip = string.Format(@"{0} - {1}", item.Name, item.Media);
                    break;

                case Order.MyRating:
                    tooltip = string.Format(@"{0} - {1}", item.Name, item.MyRating * 4);
                    break;

                case Order.Artist:
                    tooltip = string.Format(@"{0} - {1}", item.Name, item.Artist);
                    break;

                case Order.Type:
                    tooltip = string.Format(@"{0} - {1}", item.Name, item.Type);
                    break;

                case Order.PublicRating:
                    if (item.PublicRating != null)
                    {
                        tooltip = string.Format(@"{0} - {1}", item.Name, item.PublicRating * 4);
                    }
                    else
                    {
                        return(item.Name);
                    }
                    break;

                case Order.NumId:
                    if (item.NumId != null)
                    {
                        tooltip = string.Format(@"{0} - {1}", item.Name, item.NumId);
                    }
                    else
                    {
                        return(item.Name);
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            return(tooltip);
        }
コード例 #23
0
        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);
            }
        }
コード例 #24
0
        public static string OpenFile(ThumbItem item)
        {
            string results = String.Empty;

            if (item != null)
            {
                string strPath   = String.Empty;
                bool   bLaunched = false;

                IServices service = Util.GetService(item.EType);

                IMyCollectionsData currentItem = service.Get(item.Id);
                if (currentItem != null)
                {
                    switch (item.EType)
                    {
                    case EntityType.Music:
                        string fullpath = Path.Combine(currentItem.FilePath, currentItem.FileName);
                        strPath = fullpath;
                        if (Directory.Exists(fullpath))
                        {
                            string[] strFiles = Util.GetFiles(fullpath, new List <string> {
                                "*.mp3", "*.flc"
                            });
                            if (strFiles.Any())
                            {
                                string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "play.m3u");
                                //FIX 2.8.9.0
                                using (StreamWriter file = new StreamWriter(filePath, false, Encoding.Default))
                                {
                                    foreach (string music in strFiles)
                                    {
                                        file.WriteLine(music);
                                    }

                                    file.Close();
                                }

                                Process.Start(filePath);

                                bLaunched = true;
                            }
                            else
                            {
                                results = "Can't find any mp3 or flc";
                            }
                        }
                        else if (File.Exists(fullpath))
                        {
                            Process.Start(fullpath);
                            bLaunched = true;
                        }
                        else
                        {
                            results = "Can't find any mp3 or flc";
                        }
                        break;

                    case EntityType.Apps:
                    case EntityType.Books:
                    case EntityType.Games:
                    case EntityType.Nds:
                        if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                        {
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                            {
                                strPath = Path.Combine(currentItem.FilePath, currentItem.FileName);
                            }
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                            {
                                strPath = currentItem.FileName;
                            }
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true)
                            {
                                strPath = currentItem.FilePath;
                            }

                            if (Directory.Exists(strPath) == true || File.Exists(strPath) == true)
                            {
                                Process.Start(strPath);
                                bLaunched = true;
                            }
                        }
                        break;

                    case EntityType.Movie:
                    case EntityType.XXX:
                        if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                        {
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                            {
                                strPath = Path.Combine(currentItem.FilePath, currentItem.FileName);
                            }
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false)
                            {
                                strPath = currentItem.FileName;
                            }
                            if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true)
                            {
                                strPath = currentItem.FilePath;
                            }

                            if (Directory.Exists(strPath) == true && File.Exists(strPath) == false)
                            {
                                string[] strFiles = Util.GetFiles(strPath, new List <string> {
                                    "*.avi", "*.mkv", "*.mov", "*.divx"
                                });
                                if (strFiles.Any())
                                {
                                    strPath = Path.Combine(strPath, strFiles[0]);
                                }
                            }
                            if (Directory.Exists(strPath) == true || File.Exists(strPath) == true)
                            {
                                Process.Start(strPath);
                                bLaunched = true;
                            }
                        }
                        break;

                    case EntityType.Series:
                        if (Directory.Exists(currentItem.FilePath))
                        {
                            string[] strFiles = Util.GetFiles(currentItem.FilePath, new List <string> {
                                "*.avi", "*.mkv", "*.mov", "*.divx"
                            });

                            if (strFiles.Any())
                            {
                                SelectFile objWindow = new SelectFile(strFiles);
                                objWindow.ShowDialog();
                                if (String.IsNullOrEmpty(objWindow.SelectedValue) == false)
                                {
                                    Process.Start(objWindow.SelectedValue);
                                }
                                bLaunched = true;
                            }
                            else
                            {
                                results = "Can't find any avi or mkv";
                            }
                        }
                        else
                        {
                            results = "Can't file path : " + currentItem.FilePath;
                        }
                        break;
                    }
                }

                if (bLaunched == false && String.IsNullOrWhiteSpace(results))
                {
                    results = "Can't find path : " + strPath;
                }
            }

            return(results);
        }
コード例 #25
0
        private static void FileThumbItem(ThumbItem thumbItem, Movie item)
        {
            //Fix v2.5
            if (item == null)
            {
                return;
            }

            thumbItem.Added       = item.AddedDate;
            thumbItem.Cover       = item.Cover;
            thumbItem.Deleted     = item.IsDeleted;
            thumbItem.Description = item.Description;
            if (item.Cover != null)
            {
                thumbItem.HasCover = true;
            }
            else
            {
                thumbItem.Cover    = Util.CreateCover(item.Title);
                thumbItem.HasCover = false;
            }
            thumbItem.IsComplete = item.IsComplete;

            if (item.Media != null)
            {
                thumbItem.Media = item.Media.Name;
            }

            thumbItem.Name          = item.Title;
            thumbItem.OriginalTitle = item.OriginalTitle;

            double?publicRating = null;
            double alloCine     = -1;
            double imdb         = -1;

            if (string.IsNullOrWhiteSpace(item.AlloCine) == false)
            {
                double.TryParse(item.AlloCine, NumberStyles.Float, new CultureInfo("fr-FR"), out alloCine);
            }

            if (string.IsNullOrWhiteSpace(item.Imdb) == false)
            {
                double.TryParse(item.Imdb, out imdb);
            }

            if (imdb >= 0 && alloCine >= 0)
            {
                publicRating = (imdb + alloCine) / 2;
            }
            else if (imdb >= 0)
            {
                publicRating = imdb;
            }
            else if (alloCine >= 0)
            {
                publicRating = alloCine;
            }

            thumbItem.PublicRating = publicRating / 4;

            double?myRating = item.MyRating;

            thumbItem.MyRating    = myRating / 4;
            thumbItem.ReleaseDate = item.ReleaseDate;
            thumbItem.Runtime     = item.Runtime;
            thumbItem.Seen        = item.Watched;
            thumbItem.ToBeDeleted = item.ToBeDeleted;
            thumbItem.ToBuy       = item.IsWhish;
            thumbItem.ToWatch     = item.ToWatch;
        }