public static CL_DuplicateFile ToClient(this DuplicateFile duplicatefile) { CL_DuplicateFile cl = new CL_DuplicateFile { DuplicateFileID = duplicatefile.DuplicateFileID, FilePathFile1 = duplicatefile.FilePathFile1, FilePathFile2 = duplicatefile.FilePathFile2, Hash = duplicatefile.Hash, ImportFolderIDFile1 = duplicatefile.ImportFolderIDFile1, ImportFolderIDFile2 = duplicatefile.ImportFolderIDFile2, ImportFolder1 = RepoFactory.ImportFolder.GetByID(duplicatefile.ImportFolderIDFile1), ImportFolder2 = RepoFactory.ImportFolder.GetByID(duplicatefile.ImportFolderIDFile2), DateTimeUpdated = duplicatefile.DateTimeUpdated }; if (duplicatefile.GetAniDBFile() != null) { List <AniDB_Episode> eps = duplicatefile.GetAniDBFile().Episodes; if (eps.Count > 0) { cl.EpisodeNumber = eps[0].EpisodeNumber; cl.EpisodeType = eps[0].EpisodeType; cl.EpisodeName = eps[0].RomajiName; cl.AnimeID = eps[0].AnimeID; SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(eps[0].AnimeID); if (anime != null) { cl.AnimeName = anime.MainTitle; } } } return(cl); }
private void CommandBinding_PlayVideo2(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(CL_DuplicateFile)) { CL_DuplicateFile df = obj as CL_DuplicateFile; Process.Start(new ProcessStartInfo(df.GetLocalFilePath2())); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
private void CommandBinding_OpenFolder2(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(CL_DuplicateFile)) { CL_DuplicateFile df = obj as CL_DuplicateFile; if (File.Exists(df.GetLocalFilePath2())) { Utils.OpenFolderAndSelectFile(df.GetLocalFilePath2()); } else { MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_ERR_FileNotFound, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_DeleteFileDB(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(CL_DuplicateFile)) { CL_DuplicateFile df = obj as CL_DuplicateFile; MessageBoxResult res = MessageBox.Show(string.Format(Shoko.Commons.Properties.Resources.DuplicateFiles_DeleteEntry), Shoko.Commons.Properties.Resources.Confirm, MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { Cursor = Cursors.Wait; string result = VM_ShokoServer.Instance.ShokoServices.DeleteDuplicateFile(df.DuplicateFileID, 0); if (result.Length > 0) { MessageBox.Show(result, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } else { DuplicateFilesCollection.Remove(df); FileCount = DuplicateFilesCollection.Count; //RefreshDuplicateFiles(); } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }