[banshee] Playlists: refactoring, reuse constants in the base class
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Playlists: refactoring, reuse constants in the base class
- Date: Sun, 22 Jan 2012 16:11:00 +0000 (UTC)
commit 07a84a1c6d149b88aad3d86896eae439a13b35de
Author: Andres G. Aragoneses <knocte gmail com>
Date: Sun Jan 22 16:07:04 2012 +0000
Playlists: refactoring, reuse constants in the base class
After the constants DosFolderSeparator and UnixFolderSeparator
have been added in M3uPlaylistFormat class, we can make use
of them in its base class too, to make the code a bit more
readable.
.../Banshee.Playlists.Formats/M3uPlaylistFormat.cs | 3 ---
.../PlaylistFormatBase.cs | 7 +++++--
2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/M3uPlaylistFormat.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/M3uPlaylistFormat.cs
index d7ac56d..eaf3759 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/M3uPlaylistFormat.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/M3uPlaylistFormat.cs
@@ -40,9 +40,6 @@ namespace Banshee.Playlists.Formats
{
public class M3uPlaylistFormat : PlaylistFormatBase
{
- private const char DosFolderSeparator = '\\';
- private const char UnixFolderSeparator = '/';
-
public static readonly PlaylistFormatDescription FormatDescription = new PlaylistFormatDescription(
typeof(M3uPlaylistFormat), MagicHandler, Catalog.GetString("MPEG Version 3.0 Extended (*.m3u)"),
"m3u", new string [] {"audio/x-mpegurl", "audio/m3u", "audio/mpeg-url"});
diff --git a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
index d84b89c..c07469a 100644
--- a/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistFormatBase.cs
@@ -39,6 +39,9 @@ namespace Banshee.Playlists.Formats
{
public abstract class PlaylistFormatBase : IPlaylistFormat
{
+ protected const char DosFolderSeparator = '\\';
+ protected const char UnixFolderSeparator = '/';
+
private Dictionary<string, object> attributes = new Dictionary<string, object>();
private List<Dictionary<string, object>> elements = new List<Dictionary<string, object>>();
private Uri base_uri = null;
@@ -78,8 +81,8 @@ namespace Banshee.Playlists.Formats
protected virtual Uri ResolveUri(string uri)
{
- if (!uri.Contains ("/") && uri.Contains ("\\")) {
- uri = uri.Replace ("\\", "/");
+ if (!uri.Contains (UnixFolderSeparator.ToString ()) && uri.Contains (DosFolderSeparator.ToString ())) {
+ uri = uri.Replace (DosFolderSeparator, UnixFolderSeparator);
}
return BaseUri == null ? new Uri(uri) : new Uri(BaseUri, uri);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]