sanity check

This commit is contained in:
pypy
2021-01-09 14:28:13 +09:00
parent b74b678405
commit e24c71481e
2 changed files with 33 additions and 14 deletions
+9
View File
@@ -59,21 +59,30 @@ namespace VRCX
{
var values = new object[reader.FieldCount];
reader.GetValues(values);
if (callback.CanExecute == true)
{
callback.ExecuteAsync(null, values);
}
}
}
}
if (callback.CanExecute == true)
{
callback.ExecuteAsync(null, null);
}
}
finally
{
m_ConnectionLock.ExitReadLock();
}
}
catch (Exception e)
{
if (callback.CanExecute == true)
{
callback.ExecuteAsync(e.Message, null);
}
}
callback.Dispose();
}
+11 -1
View File
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
namespace VRCX
{
@@ -124,6 +125,8 @@ namespace VRCX
using (var response = await request.GetResponseAsync() as HttpWebResponse)
using (var stream = response.GetResponseStream())
using (var streamReader = new StreamReader(stream))
{
if (callback.CanExecute == true)
{
callback.ExecuteAsync(null, new
{
@@ -132,12 +135,15 @@ namespace VRCX
});
}
}
}
catch (WebException webException)
{
if (webException.Response is HttpWebResponse response)
{
using (var stream = response.GetResponseStream())
using (var streamReader = new StreamReader(stream))
{
if (callback.CanExecute == true)
{
callback.ExecuteAsync(null, new
{
@@ -146,17 +152,21 @@ namespace VRCX
});
}
}
else
}
else if (callback.CanExecute == true)
{
callback.ExecuteAsync(webException.Message, null);
}
}
}
catch (Exception e)
{
if (callback.CanExecute == true)
{
// FIXME: 브라우저는 종료되었는데 얘는 이후에 실행되면 터짐
callback.ExecuteAsync(e.Message, null);
}
}
callback.Dispose();
}