[banshee] Fixed up Scott's crappy line endings
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Fixed up Scott's crappy line endings
- Date: Thu, 25 Jun 2009 19:19:17 +0000 (UTC)
commit 4765631ba8cf0b4ac2e8eef96c02d10dac803c0a
Author: Aaron Bockover <abockover novell com>
Date: Thu Jun 25 15:22:59 2009 -0400
Fixed up Scott's crappy line endings
src/Libraries/MusicBrainz/MusicBrainz/Artist.cs | 6 +-
src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs | 4 +-
.../MusicBrainz/MusicBrainz/DiscWin32NT.cs | 366 ++++++++++----------
src/Libraries/MusicBrainz/MusicBrainz/Label.cs | 2 +-
src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs | 46 ++--
.../MusicBrainz/MusicBrainz/MusicBrainzEntity.cs | 14 +-
.../MusicBrainz/MusicBrainz/MusicBrainzItem.cs | 4 +-
.../MusicBrainz/MusicBrainz/MusicBrainzObject.cs | 106 +++---
src/Libraries/MusicBrainz/MusicBrainz/Query.cs | 26 +-
src/Libraries/MusicBrainz/MusicBrainz/Release.cs | 112 +++---
src/Libraries/MusicBrainz/MusicBrainz/Track.cs | 56 ++--
11 files changed, 371 insertions(+), 371 deletions(-)
---
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs b/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs
index 1278c8d..d823497 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs
@@ -102,7 +102,7 @@ namespace MusicBrainz
this.releases = releases.AsReadOnly ();
}
break;
- default:
+ default:
base.ProcessXmlCore (reader);
break;
}
@@ -253,8 +253,8 @@ namespace MusicBrainz
}
public static bool operator ==(ArtistReleaseType artistReleaseType1, ArtistReleaseType artistReleaseType2)
- {
- if (Object.ReferenceEquals (artistReleaseType1, null)) {
+ {
+ if (Object.ReferenceEquals (artistReleaseType1, null)) {
return Object.ReferenceEquals (artistReleaseType2, null);
}
return !Object.ReferenceEquals (artistReleaseType2, null) && artistReleaseType1.str == artistReleaseType2.str;
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs b/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs
index 9c52468..22c127d 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs
@@ -140,8 +140,8 @@ namespace MusicBrainz
if (fd < 0) throw new LocalDiscException (String.Format ("Cannot open device '{0}'", device));
- try {
- if (ReadTocHeader (fd) < 0) throw new LocalDiscException ("Cannot read table of contents");
+ try {
+ if (ReadTocHeader (fd) < 0) throw new LocalDiscException ("Cannot read table of contents");
if (last_track == 0) throw new LocalDiscException ("This disc has no tracks");
ulong lba = 0;
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32NT.cs b/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32NT.cs
index a974137..0c99834 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32NT.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32NT.cs
@@ -1,184 +1,184 @@
-// DiscWin32NT.cs
-//
-// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-namespace MusicBrainz
-{
- internal sealed class DiscWin32NT : LocalDisc
- {
- [DllImport ("kernel32.dll")]
- static extern bool DeviceIoControl (SafeFileHandle hDevice, uint dwIoControlCode,
- IntPtr lpInBuffer, uint nInBufferSize,
- IntPtr lpOutBuffer, uint nOutBufferSize,
- out uint lpBytesReturned, IntPtr lpOverlapped);
-
- [DllImport ("kernel32.dll")]
- static extern SafeFileHandle CreateFile (string lpFileName, uint dwDesiredAccess,
- uint dwShareMode, IntPtr SecurityAttributes,
- uint dwCreationDisposition, uint dwFlagsAndAttributes,
- IntPtr hTemplateFile);
-
- const uint GENERIC_READ = 0x80000000;
- const uint FILE_SHARE_READ = 0x00000001;
- const uint FILE_SHARE_WRITE = 0x00000002;
-
- const uint OPEN_EXISTING = 3;
-
- const uint IOCTL_CDROM_READ_TOC = 0x24000;
- const uint IOCTL_CDROM_GET_LAST_SESSION = 0x24038;
-
- const int XA_INTERVAL = ((60 + 90 + 2) * 75);
-
- [StructLayout (LayoutKind.Sequential)]
- struct TRACK_DATA
- {
- public byte Reserved;
- public byte ControlAndAdr;
- public byte TrackNumber;
- public byte Reserved1;
- public byte Address0;
- public byte Address1;
- public byte Address2;
- public byte Address3;
-
- public int GetSectors ()
- {
- return Address1 * 4500 + Address2 * 75 + Address3;
- }
- }
-
- const int MAX_TRACK_NUMBER = 100;
-
- [StructLayout (LayoutKind.Sequential)]
- class CDROM_TOC
- {
- public ushort Length;
- public byte FirstTrack;
- public byte LastTrack;
- public TRACK_DATA_Array TrackData = new TRACK_DATA_Array();
-
- public CDROM_TOC ()
- {
- Length = (ushort)Marshal.SizeOf (this);
- }
- }
-
- [StructLayout (LayoutKind.Sequential)]
- class TRACK_DATA_Array
- {
- [MarshalAs (UnmanagedType.ByValArray, SizeConst = MAX_TRACK_NUMBER * 8)]
- byte[] TrackData = new byte[MAX_TRACK_NUMBER * Marshal.SizeOf (typeof (TRACK_DATA))];
- public unsafe TRACK_DATA this[int index] {
- get {
- if (index < 0 || index >= MAX_TRACK_NUMBER)
- throw new IndexOutOfRangeException ();
-
- fixed (byte* b = TrackData) {
- TRACK_DATA* td = (TRACK_DATA*)b;
- td += index;
- return *td;
- }
- }
- }
- }
-
- [StructLayout (LayoutKind.Sequential)]
- class CDROM_TOC_SESSION_DATA
- {
- public ushort Length;
- public byte FirstCompleteSession;
- public byte LastCompleteSession;
- public TRACK_DATA TrackData;
-
- public CDROM_TOC_SESSION_DATA ()
- {
- Length = (ushort)Marshal.SizeOf (this);
- }
- }
-
- internal DiscWin32NT (string device)
- {
- int colon = device.IndexOf (':');
- if (colon == -1) {
- throw new ArgumentException ("The device path is not valid.", "device");
- }
-
- string filename = string.Concat (@"\\.\", device.Substring (0, colon + 1));
-
- CDROM_TOC_SESSION_DATA session = new CDROM_TOC_SESSION_DATA ();
- CDROM_TOC toc = new CDROM_TOC();
-
- using (SafeFileHandle file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)) {
-
- if (file.IsInvalid) {
- throw new LocalDiscException ("Could not open the CD device.");
- }
-
- uint returned;
-
- GCHandle session_handle = GCHandle.Alloc (session, GCHandleType.Pinned);
- try {
- bool result = DeviceIoControl (file, IOCTL_CDROM_GET_LAST_SESSION, IntPtr.Zero, 0,
- session_handle.AddrOfPinnedObject (), (uint)Marshal.SizeOf (session), out returned, IntPtr.Zero);
- if (!result) {
- throw new LocalDiscException ("There was a problem while reading the disc TOC.");
- }
- } finally {
- session_handle.Free ();
- }
-
- IntPtr toc_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (toc));
- Marshal.StructureToPtr (toc, toc_ptr, false);
- try {
- bool result = DeviceIoControl (file, IOCTL_CDROM_READ_TOC, IntPtr.Zero, 0,
- toc_ptr, (uint)Marshal.SizeOf (toc), out returned, IntPtr.Zero);
- if (!result) {
- throw new LocalDiscException ("There was a problem while reading the disc TOC.");
- }
- Marshal.PtrToStructure (toc_ptr, toc);
- } finally {
- Marshal.FreeHGlobal (toc_ptr);
- }
- }
-
- first_track = toc.FirstTrack;
-
- if (session.FirstCompleteSession != session.LastCompleteSession) {
- last_track = (byte)(session.TrackData.TrackNumber - 1);
- track_offsets[0] = toc.TrackData[last_track].GetSectors () - XA_INTERVAL;
- } else {
- last_track = toc.LastTrack;
- track_offsets[0] = toc.TrackData[last_track].GetSectors ();
- }
-
- for (int i = first_track; i <= last_track; i++) {
- track_offsets[i] = toc.TrackData[i - 1].GetSectors ();
- }
-
- Init ();
- }
- }
+// DiscWin32NT.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.Win32.SafeHandles;
+
+namespace MusicBrainz
+{
+ internal sealed class DiscWin32NT : LocalDisc
+ {
+ [DllImport ("kernel32.dll")]
+ static extern bool DeviceIoControl (SafeFileHandle hDevice, uint dwIoControlCode,
+ IntPtr lpInBuffer, uint nInBufferSize,
+ IntPtr lpOutBuffer, uint nOutBufferSize,
+ out uint lpBytesReturned, IntPtr lpOverlapped);
+
+ [DllImport ("kernel32.dll")]
+ static extern SafeFileHandle CreateFile (string lpFileName, uint dwDesiredAccess,
+ uint dwShareMode, IntPtr SecurityAttributes,
+ uint dwCreationDisposition, uint dwFlagsAndAttributes,
+ IntPtr hTemplateFile);
+
+ const uint GENERIC_READ = 0x80000000;
+ const uint FILE_SHARE_READ = 0x00000001;
+ const uint FILE_SHARE_WRITE = 0x00000002;
+
+ const uint OPEN_EXISTING = 3;
+
+ const uint IOCTL_CDROM_READ_TOC = 0x24000;
+ const uint IOCTL_CDROM_GET_LAST_SESSION = 0x24038;
+
+ const int XA_INTERVAL = ((60 + 90 + 2) * 75);
+
+ [StructLayout (LayoutKind.Sequential)]
+ struct TRACK_DATA
+ {
+ public byte Reserved;
+ public byte ControlAndAdr;
+ public byte TrackNumber;
+ public byte Reserved1;
+ public byte Address0;
+ public byte Address1;
+ public byte Address2;
+ public byte Address3;
+
+ public int GetSectors ()
+ {
+ return Address1 * 4500 + Address2 * 75 + Address3;
+ }
+ }
+
+ const int MAX_TRACK_NUMBER = 100;
+
+ [StructLayout (LayoutKind.Sequential)]
+ class CDROM_TOC
+ {
+ public ushort Length;
+ public byte FirstTrack;
+ public byte LastTrack;
+ public TRACK_DATA_Array TrackData = new TRACK_DATA_Array();
+
+ public CDROM_TOC ()
+ {
+ Length = (ushort)Marshal.SizeOf (this);
+ }
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ class TRACK_DATA_Array
+ {
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst = MAX_TRACK_NUMBER * 8)]
+ byte[] TrackData = new byte[MAX_TRACK_NUMBER * Marshal.SizeOf (typeof (TRACK_DATA))];
+ public unsafe TRACK_DATA this[int index] {
+ get {
+ if (index < 0 || index >= MAX_TRACK_NUMBER)
+ throw new IndexOutOfRangeException ();
+
+ fixed (byte* b = TrackData) {
+ TRACK_DATA* td = (TRACK_DATA*)b;
+ td += index;
+ return *td;
+ }
+ }
+ }
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ class CDROM_TOC_SESSION_DATA
+ {
+ public ushort Length;
+ public byte FirstCompleteSession;
+ public byte LastCompleteSession;
+ public TRACK_DATA TrackData;
+
+ public CDROM_TOC_SESSION_DATA ()
+ {
+ Length = (ushort)Marshal.SizeOf (this);
+ }
+ }
+
+ internal DiscWin32NT (string device)
+ {
+ int colon = device.IndexOf (':');
+ if (colon == -1) {
+ throw new ArgumentException ("The device path is not valid.", "device");
+ }
+
+ string filename = string.Concat (@"\\.\", device.Substring (0, colon + 1));
+
+ CDROM_TOC_SESSION_DATA session = new CDROM_TOC_SESSION_DATA ();
+ CDROM_TOC toc = new CDROM_TOC();
+
+ using (SafeFileHandle file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)) {
+
+ if (file.IsInvalid) {
+ throw new LocalDiscException ("Could not open the CD device.");
+ }
+
+ uint returned;
+
+ GCHandle session_handle = GCHandle.Alloc (session, GCHandleType.Pinned);
+ try {
+ bool result = DeviceIoControl (file, IOCTL_CDROM_GET_LAST_SESSION, IntPtr.Zero, 0,
+ session_handle.AddrOfPinnedObject (), (uint)Marshal.SizeOf (session), out returned, IntPtr.Zero);
+ if (!result) {
+ throw new LocalDiscException ("There was a problem while reading the disc TOC.");
+ }
+ } finally {
+ session_handle.Free ();
+ }
+
+ IntPtr toc_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (toc));
+ Marshal.StructureToPtr (toc, toc_ptr, false);
+ try {
+ bool result = DeviceIoControl (file, IOCTL_CDROM_READ_TOC, IntPtr.Zero, 0,
+ toc_ptr, (uint)Marshal.SizeOf (toc), out returned, IntPtr.Zero);
+ if (!result) {
+ throw new LocalDiscException ("There was a problem while reading the disc TOC.");
+ }
+ Marshal.PtrToStructure (toc_ptr, toc);
+ } finally {
+ Marshal.FreeHGlobal (toc_ptr);
+ }
+ }
+
+ first_track = toc.FirstTrack;
+
+ if (session.FirstCompleteSession != session.LastCompleteSession) {
+ last_track = (byte)(session.TrackData.TrackNumber - 1);
+ track_offsets[0] = toc.TrackData[last_track].GetSectors () - XA_INTERVAL;
+ } else {
+ last_track = toc.LastTrack;
+ track_offsets[0] = toc.TrackData[last_track].GetSectors ();
+ }
+
+ for (int i = first_track; i <= last_track; i++) {
+ track_offsets[i] = toc.TrackData[i - 1].GetSectors ();
+ }
+
+ Init ();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/Label.cs b/src/Libraries/MusicBrainz/MusicBrainz/Label.cs
index 1668c9d..547597d 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/Label.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/Label.cs
@@ -70,7 +70,7 @@ namespace MusicBrainz
internal override void ProcessXmlCore (XmlReader reader)
{
- if (reader.Name == "country") {
+ if (reader.Name == "country") {
country = reader.ReadString ();
} else base.ProcessXmlCore (reader);
}
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs b/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs
index a40af4f..1db5798 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs
@@ -58,12 +58,12 @@ namespace MusicBrainz
void GenerateId ()
{
- StringBuilder input_builder = new StringBuilder (804);
-
+ StringBuilder input_builder = new StringBuilder (804);
+
input_builder.AppendFormat ("{0:X2}", first_track);
input_builder.AppendFormat ("{0:X2}", last_track);
- for (int i = 0; i < track_offsets.Length; i++)
+ for (int i = 0; i < track_offsets.Length; i++)
input_builder.AppendFormat ("{0:X8}", track_offsets[i]);
// MB uses a slightly modified RFC822 for reasons of URL happiness.
@@ -71,20 +71,20 @@ namespace MusicBrainz
ComputeHash (Encoding.ASCII.GetBytes (input_builder.ToString ())));
StringBuilder hash_builder = new StringBuilder (base64.Length);
- foreach (char c in base64)
- switch (c) {
- case '+':
- hash_builder.Append ('.');
- break;
- case '/':
- hash_builder.Append ('_');
- break;
- case '=':
- hash_builder.Append ('-');
- break;
- default:
- hash_builder.Append (c);
- break;
+ foreach (char c in base64)
+ switch (c) {
+ case '+':
+ hash_builder.Append ('.');
+ break;
+ case '/':
+ hash_builder.Append ('_');
+ break;
+ case '=':
+ hash_builder.Append ('-');
+ break;
+ default:
+ hash_builder.Append (c);
+ break;
}
Id = hash_builder.ToString ();
@@ -97,9 +97,9 @@ namespace MusicBrainz
Uri submission_url;
public Uri SubmissionUrl {
- get {
- if (submission_url == null) {
- submission_url = BuildSubmissionUrl ();
+ get {
+ if (submission_url == null) {
+ submission_url = BuildSubmissionUrl ();
}
return submission_url; }
}
@@ -144,9 +144,9 @@ namespace MusicBrainz
}
public class LocalDiscException : Exception
- {
- public LocalDiscException (string message) : base (message)
- {
+ {
+ public LocalDiscException (string message) : base (message)
+ {
}
public LocalDiscException (Exception exception) : base ("Could not load local disc from device.", exception)
{
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs
index e6d965d..f5dd097 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs
@@ -72,18 +72,18 @@ namespace MusicBrainz
end_date = entity.GetEndDate ();
if (aliases == null) aliases = entity.GetAliases ();
base.LoadMissingDataCore (entity);
- }
-
+ }
+
internal override void ProcessXmlCore (XmlReader reader)
{
switch (reader.Name) {
- case "name":
- name = reader.ReadString ();
+ case "name":
+ name = reader.ReadString ();
break;
- case "sort-name":
+ case "sort-name":
sort_name = reader.ReadString ();
break;
- case "disambiguation":
+ case "disambiguation":
disambiguation = reader.ReadString ();
break;
case "life-span":
@@ -98,7 +98,7 @@ namespace MusicBrainz
this.aliases = aliases.AsReadOnly ();
}
break;
- default:
+ default:
base.ProcessXmlCore (reader);
break;
}
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs
index b4fbabf..73187e7 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs
@@ -68,13 +68,13 @@ namespace MusicBrainz
internal override void ProcessXmlCore (XmlReader reader)
{
switch (reader.Name) {
- case "title":
+ case "title":
title = reader.ReadString ();
break;
case "artist":
artist = new Artist (reader.ReadSubtree ());
break;
- default:
+ default:
base.ProcessXmlCore (reader);
break;
}
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
index dffb4de..765635e 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
@@ -77,13 +77,13 @@ namespace MusicBrainz
#endregion
- #region Private Methods
-
- string CreateInc ()
- {
- StringBuilder builder = new StringBuilder ();
- CreateIncCore (builder);
- return builder.ToString ();
+ #region Private Methods
+
+ string CreateInc ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ CreateIncCore (builder);
+ return builder.ToString ();
}
void CreateFromId (string id, string parameters)
@@ -121,7 +121,7 @@ namespace MusicBrainz
case "Label":
label_rels = CreateRelation<Label> (reader.ReadSubtree ());
break;
- case "Url":
+ case "Url":
url_rels = CreateUrlRelation (reader.ReadSubtree ());
break;
}
@@ -129,13 +129,13 @@ namespace MusicBrainz
ProcessXml (reader.ReadSubtree ());
}
reader.Close ();
- }
-
- void ProcessXml (XmlReader reader)
- {
- reader.Read ();
- ProcessXmlCore (reader);
- reader.Close ();
+ }
+
+ void ProcessXml (XmlReader reader)
+ {
+ reader.Read ();
+ ProcessXmlCore (reader);
+ reader.Close ();
}
#endregion
@@ -222,15 +222,15 @@ namespace MusicBrainz
{
if (field_reference == null && condition) LoadMissingData ();
return field_reference ?? new ReadOnlyCollection<T> (new T [0]);
- }
-
- internal virtual void ProcessXmlCore (XmlReader reader)
- {
- reader.Skip (); // FIXME this is a workaround for Mono bug 334752
- }
-
- internal virtual void ProcessAttributes (XmlReader reader)
- {
+ }
+
+ internal virtual void ProcessXmlCore (XmlReader reader)
+ {
+ reader.Skip (); // FIXME this is a workaround for Mono bug 334752
+ }
+
+ internal virtual void ProcessAttributes (XmlReader reader)
+ {
}
internal abstract void LoadMissingDataCore ();
@@ -279,9 +279,9 @@ namespace MusicBrainz
}
public static bool operator ==(MusicBrainzObject obj1, MusicBrainzObject obj2)
- {
- if (Object.ReferenceEquals (obj1, null)) {
- return Object.ReferenceEquals (obj2, null);
+ {
+ if (Object.ReferenceEquals (obj1, null)) {
+ return Object.ReferenceEquals (obj2, null);
}
return !Object.ReferenceEquals (obj2, null) && obj1.GetType () == obj2.GetType () && obj1.Id == obj2.Id;
}
@@ -326,28 +326,28 @@ namespace MusicBrainz
}
reader.Close ();
return relations.AsReadOnly ();
- }
-
- static ReadOnlyCollection<UrlRelation> CreateUrlRelation (XmlReader reader)
- {
- List<UrlRelation> url_rels = new List<UrlRelation> ();
- while (reader.ReadToDescendant ("relation")) {
- RelationDirection direction = RelationDirection.Forward;
- string direction_string = reader["direction"];
- if (direction_string != null && direction_string == "backward")
- direction = RelationDirection.Backward;
- string attributes_string = reader["attributes"];
- string[] attributes = attributes_string == null
- ? null : attributes_string.Split (' ');
- url_rels.Add (new UrlRelation (
- reader["type"],
- reader["target"],
- direction,
- reader["begin"],
- reader["end"],
- attributes));
- }
- return url_rels.AsReadOnly ();
+ }
+
+ static ReadOnlyCollection<UrlRelation> CreateUrlRelation (XmlReader reader)
+ {
+ List<UrlRelation> url_rels = new List<UrlRelation> ();
+ while (reader.ReadToDescendant ("relation")) {
+ RelationDirection direction = RelationDirection.Forward;
+ string direction_string = reader["direction"];
+ if (direction_string != null && direction_string == "backward")
+ direction = RelationDirection.Backward;
+ string attributes_string = reader["attributes"];
+ string[] attributes = attributes_string == null
+ ? null : attributes_string.Split (' ');
+ url_rels.Add (new UrlRelation (
+ reader["type"],
+ reader["target"],
+ direction,
+ reader["begin"],
+ reader["end"],
+ attributes));
+ }
+ return url_rels.AsReadOnly ();
}
static string CreateUrl (string url_extension, int limit, int offset, string parameters)
@@ -385,8 +385,8 @@ namespace MusicBrainz
// Don't access the MB server twice within a second
TimeSpan time = DateTime.Now - last_accessed;
if (min_interval > time)
- Thread.Sleep ((min_interval - time).Milliseconds);
-
+ Thread.Sleep ((min_interval - time).Milliseconds);
+
WebRequest request = WebRequest.Create (url);
bool cache_implemented = false;
@@ -419,9 +419,9 @@ namespace MusicBrainz
bool from_cache = false;
try {
- from_cache = cache_implemented && response.IsFromCache;
+ from_cache = cache_implemented && response.IsFromCache;
} catch (NotImplementedException) {}
-
+
if (from_cache) Monitor.Exit (server_mutex);
MusicBrainzService.OnXmlRequest (url, from_cache);
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/Query.cs b/src/Libraries/MusicBrainz/MusicBrainz/Query.cs
index 61f6910..1ec5ffb 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/Query.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/Query.cs
@@ -44,15 +44,15 @@ namespace MusicBrainz
List<T> results;
List<T> ResultsWindow {
get {
- if (results == null)
+ if (results == null)
LoadResults ();
return results;
}
- }
-
- void LoadResults ()
- {
- results = MusicBrainzObject.Query<T> (url_extension, limit, offset, parameters, out count);
+ }
+
+ void LoadResults ()
+ {
+ results = MusicBrainzObject.Query<T> (url_extension, limit, offset, parameters, out count);
}
Dictionary<int, WeakReference> weak_references = new Dictionary<int, WeakReference> ();
@@ -90,18 +90,18 @@ namespace MusicBrainz
#region Public
public int Count {
- get {
- if (count == null)
+ get {
+ if (count == null)
LoadResults ();
return count.Value;
}
}
public T this [int index] {
- get {
- if (index < 0 || index >= Count) throw new ArgumentOutOfRangeException ("index");
- if (index < offset || index >= offset + limit)
- Offset = index;
+ get {
+ if (index < 0 || index >= Count) throw new ArgumentOutOfRangeException ("index");
+ if (index < offset || index >= offset + limit)
+ Offset = index;
return ResultsWindow[index - offset];
}
}
@@ -116,7 +116,7 @@ namespace MusicBrainz
}
public T PerfectMatch ()
- {
+ {
int tmp_limit = limit;
limit = 2;
T result1 = Count > 0 ? this [0] : null;
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/Release.cs b/src/Libraries/MusicBrainz/MusicBrainz/Release.cs
index dbe20f8..2aa6164 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/Release.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/Release.cs
@@ -95,63 +95,63 @@ namespace MusicBrainz
{
// How sure am I about getting the type and status in the "Type Status" format?
// MB really ought to specify these two things seperatly.
- string type_string = reader ["type"];
- if (type_string != null) {
- foreach (string token in type_string.Split (' ')) {
- if (type == null) {
- type = Utils.StringToEnumOrNull<ReleaseType> (token);
- if (type != null) continue;
- }
- this.status = Utils.StringToEnumOrNull<ReleaseStatus> (token);
- }
+ string type_string = reader ["type"];
+ if (type_string != null) {
+ foreach (string token in type_string.Split (' ')) {
+ if (type == null) {
+ type = Utils.StringToEnumOrNull<ReleaseType> (token);
+ if (type != null) continue;
+ }
+ this.status = Utils.StringToEnumOrNull<ReleaseStatus> (token);
+ }
+ }
+ }
+
+ internal override void ProcessXmlCore (XmlReader reader)
+ {
+ switch (reader.Name) {
+ case "text-representation":
+ language = reader["language"];
+ script = reader["script"];
+ break;
+ case "asin":
+ asin = reader.ReadString ();
+ break;
+ case "disc-list":
+ if (reader.ReadToDescendant ("disc")) {
+ List<Disc> discs = new List<Disc> ();
+ do discs.Add (new Disc (reader.ReadSubtree ()));
+ while (reader.ReadToNextSibling ("disc"));
+ this.discs = discs.AsReadOnly ();
+ }
+ break;
+ case "release-event-list":
+ if (!AllDataLoaded) {
+ reader.Skip (); // FIXME this is a workaround for Mono bug 334752
+ return;
+ }
+ if (reader.ReadToDescendant ("event")) {
+ List<Event> events = new List<Event> ();
+ do events.Add (new Event (reader.ReadSubtree ()));
+ while (reader.ReadToNextSibling ("event"));
+ this.events = events.AsReadOnly ();
+ }
+ break;
+ case "track-list":
+ string offset = reader["offset"];
+ if (offset != null)
+ track_number = int.Parse (offset) + 1;
+ if (reader.ReadToDescendant ("track")) {
+ List<Track> tracks = new List<Track> ();
+ do tracks.Add (new Track (reader.ReadSubtree (), GetArtist (), AllDataLoaded));
+ while (reader.ReadToNextSibling ("track"));
+ this.tracks = tracks.AsReadOnly ();
+ }
+ break;
+ default:
+ base.ProcessXmlCore (reader);
+ break;
}
- }
-
- internal override void ProcessXmlCore (XmlReader reader)
- {
- switch (reader.Name) {
- case "text-representation":
- language = reader["language"];
- script = reader["script"];
- break;
- case "asin":
- asin = reader.ReadString ();
- break;
- case "disc-list":
- if (reader.ReadToDescendant ("disc")) {
- List<Disc> discs = new List<Disc> ();
- do discs.Add (new Disc (reader.ReadSubtree ()));
- while (reader.ReadToNextSibling ("disc"));
- this.discs = discs.AsReadOnly ();
- }
- break;
- case "release-event-list":
- if (!AllDataLoaded) {
- reader.Skip (); // FIXME this is a workaround for Mono bug 334752
- return;
- }
- if (reader.ReadToDescendant ("event")) {
- List<Event> events = new List<Event> ();
- do events.Add (new Event (reader.ReadSubtree ()));
- while (reader.ReadToNextSibling ("event"));
- this.events = events.AsReadOnly ();
- }
- break;
- case "track-list":
- string offset = reader["offset"];
- if (offset != null)
- track_number = int.Parse (offset) + 1;
- if (reader.ReadToDescendant ("track")) {
- List<Track> tracks = new List<Track> ();
- do tracks.Add (new Track (reader.ReadSubtree (), GetArtist (), AllDataLoaded));
- while (reader.ReadToNextSibling ("track"));
- this.tracks = tracks.AsReadOnly ();
- }
- break;
- default:
- base.ProcessXmlCore (reader);
- break;
- }
}
#endregion
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/Track.cs b/src/Libraries/MusicBrainz/MusicBrainz/Track.cs
index 5334ac9..0bf6d17 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/Track.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/Track.cs
@@ -76,34 +76,34 @@ namespace MusicBrainz
if (releases == null) releases = track.GetReleases ();
if (puids == null) puids = track.GetPuids ();
base.LoadMissingDataCore (track);
- }
-
- internal override void ProcessXmlCore (XmlReader reader)
- {
- switch (reader.Name) {
- case "duration":
- duration = TimeSpan.FromMilliseconds (reader.ReadElementContentAsDouble ());
- break;
- case "release-list":
- if (reader.ReadToDescendant ("release")) {
- List<Release> releases = new List<Release> ();
- do releases.Add (new Release (reader.ReadSubtree ()));
- while (reader.ReadToNextSibling ("release"));
- this.releases = releases.AsReadOnly ();
- }
- break;
- case "puid-list":
- if (reader.ReadToDescendant ("puid")) {
- List<string> puids = new List<string> ();
- do puids.Add (reader["id"]);
- while (reader.ReadToNextSibling ("puid"));
- this.puids = puids.AsReadOnly ();
- }
- break;
- default:
- base.ProcessXmlCore (reader);
- break;
- }
+ }
+
+ internal override void ProcessXmlCore (XmlReader reader)
+ {
+ switch (reader.Name) {
+ case "duration":
+ duration = TimeSpan.FromMilliseconds (reader.ReadElementContentAsDouble ());
+ break;
+ case "release-list":
+ if (reader.ReadToDescendant ("release")) {
+ List<Release> releases = new List<Release> ();
+ do releases.Add (new Release (reader.ReadSubtree ()));
+ while (reader.ReadToNextSibling ("release"));
+ this.releases = releases.AsReadOnly ();
+ }
+ break;
+ case "puid-list":
+ if (reader.ReadToDescendant ("puid")) {
+ List<string> puids = new List<string> ();
+ do puids.Add (reader["id"]);
+ while (reader.ReadToNextSibling ("puid"));
+ this.puids = puids.AsReadOnly ();
+ }
+ break;
+ default:
+ base.ProcessXmlCore (reader);
+ break;
+ }
}
#endregion
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]