public static string GetBasicPath(this Track track, string pathFormat, IMediaCollection collection) { // Hacky method to clean the file path var formatStrComponents = pathFormat.Split(Path.DirectorySeparatorChar); var newFormat = String.Join("\0", formatStrComponents); var vars = Dictify.ObjectToDictionary(track); vars["PlaylistName"] = collection.Title; vars["CollectionName"] = collection.Title; vars["ServiceName"] = collection.Title; var finalPath = PathHelpers.CleanPath(Named.Format(newFormat, vars)); return finalPath; }
/// <summary> /// Gets the path for a track, without the extension. /// </summary> /// <param name="track">The track.</param> /// <param name="pathFormat">The path format.</param> /// <returns>A formatted path without an extension.</returns> public static string GetBasicPath(this Track track, string pathFormat) { return(GetBasicPath(track, pathFormat, Dictify.ObjectToDictionary(track))); }