Add error message for invalid proxy server (#862)

This commit is contained in:
Nekromateion
2024-08-07 10:54:30 +02:00
committed by GitHub
parent 1d09785896
commit c3f4771f4d
+13 -3
View File
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Cookie = System.Net.Cookie; using Cookie = System.Net.Cookie;
using System.Windows;
namespace VRCX namespace VRCX
{ {
@@ -70,9 +71,18 @@ namespace VRCX
if (string.IsNullOrEmpty(ProxyUrl)) if (string.IsNullOrEmpty(ProxyUrl))
return; return;
ProxySet = true; try
Proxy = new WebProxy(ProxyUrl); {
ProxySet = true;
Proxy = new WebProxy(ProxyUrl);
}
catch (UriFormatException)
{
VRCXStorage.Instance.Set("VRCX_ProxyServer", string.Empty);
MessageBox.Show("The proxy server URI you used is invalid.\nVRCX will close, please correct the proxy URI.", "Invalid Proxy URI", MessageBoxButton.OK);
Environment.Exit(0);
}
} }
internal void Exit() internal void Exit()