// TODO: Write full implementation public void Rename(CancellationToken cancellationToken, Job job) { Host.ReportProgress(this, 0.0, "Auto-renaming output file..."); var namer = new FileNamer(job, Preferences); job.OutputPath = namer.GetPath().FullName; Host.ReportProgress(this, 100.0, "Renamed output file", "Finished auto-renaming output file"); }
// TODO: Write full implementation public void Rename(CancellationToken cancellationToken, Job job) { Host.ReportProgress(this, 0.0, "Auto-renaming output file..."); var namer = new FileNamer(job, Preferences); job.OutputPath = namer.GetPath().FullName; Host.ReportProgress(this, 100.0, "Finished auto-renaming output file"); }
public FormFileNamerPreferences(Preferences prefs) { _userPrefs = prefs; _prefsCopy = _userPrefs.Clone(); _movieJob = MockJobFactory.CreateMovieJob(); _movieNamer = new FileNamer(_movieJob, _prefsCopy); _tvShowJob = MockJobFactory.CreateTVShowJob(); _tvShowNamer = new FileNamer(_tvShowJob, _prefsCopy); InitializeComponent(); Load += OnLoad; this.EnableSelectAll(); }
private void OnChanged(FileNamer movieNamer, FileNamer tvShowNamer) { if (_ignoreChange) { return; } _ignoreChange = true; // Movies _prefsCopy.Movies.Directory = textBoxMovieDirectory.Text; _prefsCopy.Movies.FileName = textBoxMovieFileName.Text; var moviePath = movieNamer.GetPath(); textBoxMovieDirectoryExample.Text = moviePath.Directory; textBoxMovieFileNameExample.Text = moviePath.FileName; // TV Shows _prefsCopy.TVShows.Directory = textBoxTVShowDirectory.Text; _prefsCopy.TVShows.FileName = textBoxTVShowFileName.Text; _prefsCopy.TVShows.SeasonNumberFormat = S2NF(comboBoxSeasonNumberFormat.SelectedItem as string); _prefsCopy.TVShows.EpisodeNumberFormat = S2NF(comboBoxEpisodeNumberFormat.SelectedItem as string); _prefsCopy.TVShows.ReleaseDateFormat = textBoxTVShowReleaseDateFormat.Text; var tvShowPath = tvShowNamer.GetPath(); textBoxTVShowDirectoryExample.Text = tvShowPath.Directory; textBoxTVShowFileNameExample.Text = tvShowPath.FileName; // Save/revert/default buttons var hasChanged = !_prefsCopy.Equals(_userPrefs); var isDefault = _prefsCopy.Equals(new Preferences()); buttonRevert.Enabled = hasChanged; buttonDefault.Enabled = !isDefault; buttonSave.Enabled = hasChanged; _ignoreChange = false; }
private void OnChanged(FileNamer movieNamer, FileNamer tvShowNamer) { if (_ignoreChange) return; _ignoreChange = true; // Movies _prefsCopy.Movies.Directory = textBoxMovieDirectory.Text; _prefsCopy.Movies.FileName = textBoxMovieFileName.Text; var moviePath = movieNamer.GetPath(); textBoxMovieDirectoryExample.Text = moviePath.Directory; textBoxMovieFileNameExample.Text = moviePath.FileName; // TV Shows _prefsCopy.TVShows.Directory = textBoxTVShowDirectory.Text; _prefsCopy.TVShows.FileName = textBoxTVShowFileName.Text; _prefsCopy.TVShows.SeasonNumberFormat = S2NF(comboBoxSeasonNumberFormat.SelectedItem as string); _prefsCopy.TVShows.EpisodeNumberFormat = S2NF(comboBoxEpisodeNumberFormat.SelectedItem as string); _prefsCopy.TVShows.ReleaseDateFormat = textBoxTVShowReleaseDateFormat.Text; var tvShowPath = tvShowNamer.GetPath(); textBoxTVShowDirectoryExample.Text = tvShowPath.Directory; textBoxTVShowFileNameExample.Text = tvShowPath.FileName; // Save/revert/default buttons var hasChanged = !_prefsCopy.Equals(_userPrefs); var isDefault = _prefsCopy.Equals(new Preferences()); buttonRevert.Enabled = hasChanged; buttonDefault.Enabled = !isDefault; buttonSave.Enabled = hasChanged; _ignoreChange = false; }