public Movie(string path) { FilePath = path; var NY = NameExtractor.GetMovieNameYear(Path.GetFileNameWithoutExtension(path)); Name = NY.Key; Year = NY.Value; }
private void TB_FolderPath_TextChanged(object sender, EventArgs e) { if (TB_FolderPath.Text.EndsWith("\\") && !Directory.Exists(TB_FolderPath.Text.RemoveAt(TB_FolderPath.Text.Length - 1))) { DisableTextChange = true; TB_FolderPath.Text = LastSpecificPathText[1] + "\\"; TB_FolderPath.Select(TB_FolderPath.Text.Length, 0); DisableTextChange = false; } if (!DisableTextChange && (TB_FolderPath.Text.EndsWith("\\") || !Directory.Exists(TB_FolderPath.Text)) && TB_FolderPath.Text.ToLower() != LastSpecificPathText[0].ToLower()) { try { LastSpecificPathText[0] = TB_FolderPath.Text; var SelectIndex = TB_FolderPath.SelectionStart; var NextDirectories = Directory.GetDirectories(Directory.GetParent(TB_FolderPath.Text).FullName); var NextDirectory = NextDirectories.Where(x => x.ToLower().StartsWith(TB_FolderPath.Text.ToLower())).FirstOrDefault(); if (NextDirectory != null) { TB_FolderPath.Text = NextDirectory; TB_FolderPath.Select(SelectIndex, NextDirectory.Length - SelectIndex); } } catch (Exception) { } } LastSpecificPathText[1] = TB_FolderPath.Text; CurrentFormState = GetFormState(); if (TB_FolderPath.Text == "" || (Directory.Exists(TB_FolderPath.Text) && Directory.GetParent(TB_FolderPath.Text) != null)) { Form1.ClearError(); RefreshFolder(); if (!MovieMode) { if (TB_FolderPath.Text.DirectoryName().ToLower().Contains("season")) { TB_SeriesName.Text = NameExtractor.GetSeriesName(TB_FolderPath.Text.Parent().DirectoryName()); } else { TB_SeriesName.Text = NameExtractor.GetSeriesName(TB_FolderPath.Text.DirectoryName()); } } } else { if (Directory.Exists(TB_FolderPath.Text) && Directory.GetParent(TB_FolderPath.Text) == null) { Form1.ShowError("Directory can not be Drive Root"); } CurrentFormState = FormState.Busy; } }
public Subtitle(string path) { FilePath = path; Name = NameExtractor.GetSubtitleName(Path.GetFileNameWithoutExtension(FilePath)); if (MovieMode) { return; } var filename = Path.GetFileNameWithoutExtension(path); foreach (var RX in TV_Renamer_2.Episode.Tests) { if (RX.IsMatch(filename)) { SeasonNumber = int.Parse(RX.Match(filename).Groups[1].Value); EpisodeNumber = int.Parse(RX.Match(filename).Groups[2].Value); return; } } throw new Exception("Given File is not Valid"); }
public string ExtractName() => NameExtractor.GetEpisodeName(Path.GetFileNameWithoutExtension(FilePath));