mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
On uploads, throw exception only if there's an attached debugger.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
@@ -94,7 +95,7 @@ namespace DiscImageChef.Core
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
throw;
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
}
|
||||
});
|
||||
@@ -155,7 +156,7 @@ namespace DiscImageChef.Core
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
throw;
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@@ -90,13 +91,13 @@ namespace DiscImageChef.Server.Controllers
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||
return response;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
|
||||
/// </summary>
|
||||
@@ -109,10 +110,10 @@ namespace DiscImageChef.Server.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
HttpRequest request = HttpContext.Current.Request;
|
||||
HttpRequest request = HttpContext.Current.Request;
|
||||
|
||||
StreamReader sr = new StreamReader(request.InputStream);
|
||||
string jsonData = sr.ReadToEnd();
|
||||
StreamReader sr = new StreamReader(request.InputStream);
|
||||
string jsonData = sr.ReadToEnd();
|
||||
DeviceReportV2 newReport = JsonConvert.DeserializeObject<DeviceReportV2>(jsonData);
|
||||
|
||||
if(newReport == null)
|
||||
@@ -143,11 +144,10 @@ namespace DiscImageChef.Server.Controllers
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||
return response;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -158,9 +159,7 @@ namespace DiscImageChef.Server.Controllers
|
||||
{
|
||||
addNvs = new OsStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + 1,
|
||||
version = oldNvs.version
|
||||
name = oldNvs.name, Value = oldNvs.Value + 1, version = oldNvs.version
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
@@ -188,10 +187,9 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.Versions.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||
{
|
||||
addNvs = new NameValueStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
{
|
||||
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
}
|
||||
@@ -242,10 +240,9 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.Filesystems.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||
{
|
||||
addNvs = new NameValueStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
{
|
||||
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
}
|
||||
@@ -271,10 +268,9 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.Partitions.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||
{
|
||||
addNvs = new NameValueStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
{
|
||||
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
}
|
||||
@@ -300,10 +296,9 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.MediaImages.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||
{
|
||||
addNvs = new NameValueStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
{
|
||||
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
}
|
||||
@@ -329,10 +324,9 @@ namespace DiscImageChef.Server.Controllers
|
||||
oldStats.Filters.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||
{
|
||||
addNvs = new NameValueStats
|
||||
{
|
||||
name = oldNvs.name,
|
||||
Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
{
|
||||
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||
};
|
||||
removeNvs = oldNvs;
|
||||
break;
|
||||
}
|
||||
@@ -469,12 +463,10 @@ namespace DiscImageChef.Server.Controllers
|
||||
catch(Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
System.Console.WriteLine("{0} {1}", ex.Message, ex.InnerException);
|
||||
throw;
|
||||
#else
|
||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||
return response;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user