/// <summary> /// Scan folder. Will be called recursively to find alle episodes /// </summary> /// <param name="folder">folder to scan</param> internal override void scanFolder(String folder) { SeriesLocations locations = new SeriesLocations(); String[] elements; // First, let's scan the files ... elements = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories); //Log.Add(elements.Length + " Elements total"); for (int i = 0; i < elements.Length; i++) { if (isValidExt(elements[i])) { FileAttributes fAttr = File.GetAttributes(elements[i]); if ((fAttr | FileAttributes.ReadOnly) == fAttr) { //MessageBox.Show("File is write protected: \n"+elements[i]); } else { Episode ep = Episode.parseFile(elements[i]); if (ep == null) continue; if (!ep.special && ep.needRenaming()) { OnListEpisode(ep); } else { locations.addSeriesLocation(ep); } } } OnScanProgress(i, elements.Length - 1); } locations.saveLocations(); OnScanDone(); }
public void rename() { FileInfo fi = new FileInfo(_filename.Trim()); if (Episode.validEpisodeFile(fi.Name)) { Episode ep = Episode.parseFile(fi.FullName); SeriesLocations locations = new SeriesLocations(); String path = locations.getEpisodePath(ep); _targetName = ep.modifiedName(); if (!localRename && path != null && Directory.Exists(path)) { ep.renameEpisodeAndMove(path, copyFile); locations.addSeriesLocation(ep); } else { ep.renameEpisode(); } } else { Movie movie = Movie.parseFile(fi.FullName); _targetName = movie.modifiedName(); if (!localRename && Settings.GetValueAsBool(SettingKeys.MoveMovies)) { String path = Settings.GetValueAsString(SettingKeys.MovieLocation); movie.renameMovieAndMove(path, copyFile); } else { movie.renameMovie(); } } if (_tip != null) { _tip.Dispose(); } this.OnRenameDone(); }
/// <summary> /// Scan folder. Will be called recursively to find alle episodes /// </summary> /// <param name="folder">folder to scan</param> override internal void scanFolder(String folder) { SeriesLocations locations = new SeriesLocations(); String[] elements; // First, let's scan the files ... elements = Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories); //Log.Add(elements.Length + " Elements total"); for (int i = 0; i < elements.Length; i++) { if (isValidExt(elements[i])) { FileAttributes fAttr = File.GetAttributes(elements[i]); if ((fAttr | FileAttributes.ReadOnly) == fAttr) { //MessageBox.Show("File is write protected: \n"+elements[i]); } else { Episode ep = Episode.parseFile(elements[i]); if (ep == null) { continue; } if (!ep.special && ep.needRenaming()) { OnListEpisode(ep); } else { locations.addSeriesLocation(ep); } } } OnScanProgress(i, elements.Length - 1); } locations.saveLocations(); OnScanDone(); }