mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
2.0.8 final
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\Release\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
@@ -37,6 +37,7 @@
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
<TargetFrameworkVersion>v1.1</TargetFrameworkVersion>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Xml" />
|
||||
|
||||
@@ -38,7 +38,15 @@ namespace MusicBrainz
|
||||
: base ("Specified resource was not found. Perhaps it was merged or deleted.")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MusicBrainzUnavailableException : Exception
|
||||
{
|
||||
public MusicBrainzUnavailableException(string message)
|
||||
: base(message ?? "Service is unavailable.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MusicBrainzUnauthorizedException : Exception
|
||||
{
|
||||
|
||||
@@ -408,32 +408,47 @@ namespace MusicBrainz
|
||||
|
||||
if (response == null) throw new MusicBrainzNotFoundException ();
|
||||
|
||||
switch (response.StatusCode) {
|
||||
case HttpStatusCode.BadRequest:
|
||||
Monitor.Exit (server_mutex);
|
||||
throw new MusicBrainzInvalidParameterException ();
|
||||
case HttpStatusCode.Unauthorized:
|
||||
Monitor.Exit (server_mutex);
|
||||
throw new MusicBrainzUnauthorizedException ();
|
||||
case HttpStatusCode.NotFound:
|
||||
Monitor.Exit (server_mutex);
|
||||
throw new MusicBrainzNotFoundException ();
|
||||
}
|
||||
switch (response.StatusCode)
|
||||
{
|
||||
case HttpStatusCode.BadRequest:
|
||||
Monitor.Exit(server_mutex);
|
||||
throw new MusicBrainzInvalidParameterException();
|
||||
case HttpStatusCode.Unauthorized:
|
||||
Monitor.Exit(server_mutex);
|
||||
throw new MusicBrainzUnauthorizedException();
|
||||
case HttpStatusCode.NotFound:
|
||||
Monitor.Exit(server_mutex);
|
||||
throw new MusicBrainzNotFoundException();
|
||||
case HttpStatusCode.ServiceUnavailable:
|
||||
Monitor.Exit(server_mutex);
|
||||
throw new MusicBrainzUnavailableException(response.StatusDescription);
|
||||
case HttpStatusCode.OK:
|
||||
break;
|
||||
default:
|
||||
Monitor.Exit(server_mutex);
|
||||
throw new MusicBrainzUnavailableException(response.StatusDescription);
|
||||
}
|
||||
|
||||
bool from_cache = cache_implemented && response.IsFromCache;
|
||||
|
||||
if (from_cache) Monitor.Exit (server_mutex);
|
||||
|
||||
MusicBrainzService.OnXmlRequest (url, from_cache);
|
||||
try
|
||||
{
|
||||
MusicBrainzService.OnXmlRequest(url, from_cache);
|
||||
|
||||
// Should we read the stream into a memory stream and run the XmlReader off of that?
|
||||
code (new XmlTextReader (response.GetResponseStream ()));
|
||||
response.Close ();
|
||||
|
||||
if (!from_cache) {
|
||||
last_accessed = DateTime.Now;
|
||||
Monitor.Exit (server_mutex);
|
||||
}
|
||||
// Should we read the stream into a memory stream and run the XmlReader off of that?
|
||||
code(new XmlTextReader(response.GetResponseStream()));
|
||||
}
|
||||
finally
|
||||
{
|
||||
response.Close();
|
||||
if (!from_cache)
|
||||
{
|
||||
last_accessed = DateTime.Now;
|
||||
Monitor.Exit(server_mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user