private static void CopySong(Song Song, string Destination) { string DestinationPath; string OriginalFilePath = Song.Location; string Artist, Album, SongName; string FullDirectory; SongName = Path.GetFileName(OriginalFilePath); FullDirectory = Path.GetDirectoryName(OriginalFilePath); Album = FullDirectory.Substring(FullDirectory.LastIndexOf(Path.DirectorySeparatorChar) + 1); FullDirectory = FullDirectory.Substring(0, FullDirectory.LastIndexOf(Path.DirectorySeparatorChar)); Artist = FullDirectory.Substring(FullDirectory.LastIndexOf(Path.DirectorySeparatorChar) + 1); DestinationPath = Path.Combine(Destination, Artist); if (!Directory.Exists(DestinationPath)) { Directory.CreateDirectory(DestinationPath); } DestinationPath = Path.Combine(DestinationPath, Album); if (!Directory.Exists(DestinationPath)) { Directory.CreateDirectory(DestinationPath); } DestinationPath = Path.Combine(DestinationPath, SongName); File.Copy(Song.Location, DestinationPath); }
private string _getParentDirectory() { if (_isDrive) { return(null); } string directory = FullDirectory.Substring(0, FullDirectory.LastIndexOf('\\')); if (directory.Length == 2) { directory += '\\'; } return(directory); }