public void updateSectionLocations() { if (m_importFile != null) { foreach (ImportEntry entry in m_importFile.Entries) { bool usePlexLocation; SectionLocation sectionLocation = findSectionLocation(entry, out usePlexLocation); if (sectionLocation != null && sectionLocation.Owner() != null) { entry.setSectionLocation(sectionLocation, usePlexLocation, progressMessage); if (entry.FolderSection != null) { Debug.WriteLine(String.Format("==> FOLDER FOUND[{0}]: {1} - {2}", entry.FullFileName, entry.FolderSection.Key, entry.FolderSection.Title)); } else { Debug.WriteLine(String.Format("==> folderSection NOT FOUND[{0}]", entry.FullFileName)); } } else { entry.FolderSection = null; Debug.WriteLine(String.Format("==> Mapped SectionLocation NOT FOUND[{0}]", entry.FullFileName)); } } } progressMessage("", true); }
private MainSection getSelectedMainSection() { if (gvSectionLocation.SelectedRows.Count == 1) { SectionLocation sectionLocation = gvSectionLocation.SelectedRows[0].DataBoundItem as SectionLocation; return(sectionLocation != null?sectionLocation.Owner() : null); } return(null); }
public void setSectionLocation(SectionLocation _sectionLocation, bool _usePlexLocation, ImportManager.ProgressEventHandler _progressMessage) { string relativePath = RelativePath(_usePlexLocation ? _sectionLocation.PlexLocation : _sectionLocation.MappedLocation); MainSection = _sectionLocation.Owner(); MainSection.loadFromCache(false, true, _progressMessage); var folders = from folder in MainSection.folders where folder.Title.Equals(relativePath, StringComparison.OrdinalIgnoreCase) select folder; FolderSection = folders.FirstOrDefault(); char directorySeparatorFrom = PMSServer.DirectorySeparator == PMSBase.BACKWARD_SLASH ? PMSBase.FORWARD_SLASH : PMSBase.BACKWARD_SLASH; m_fullPlexFileName = FullFileName; if (!_usePlexLocation && !String.IsNullOrEmpty(_sectionLocation.MappedLocation)) { if (m_fullPlexFileName.StartsWith(_sectionLocation.MappedLocation, StringComparison.OrdinalIgnoreCase)) { m_fullPlexFileName = _sectionLocation.PlexLocation + m_fullPlexFileName.Remove(0, _sectionLocation.MappedLocation.Length); } m_fullPlexFileName = normalizePath(m_fullPlexFileName, directorySeparatorFrom, PMSServer.DirectorySeparator); } }