mirror of
https://github.com/netchx/netch.git
synced 2026-03-28 18:59:46 +08:00
catch error
This commit is contained in:
@@ -59,7 +59,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://netch.org/#/?id=%e4%be%9d%e8%b5%96");
|
||||
}
|
||||
Utils.Logging.Info("设置系统代理失败"+e.ToString());
|
||||
Utils.Logging.Info("设置系统代理失败" + e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,26 +137,33 @@ namespace Netch.Controllers
|
||||
|
||||
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
try
|
||||
{
|
||||
File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n");
|
||||
|
||||
if (State == Models.State.Starting)
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
{
|
||||
if (Instance.HasExited)
|
||||
File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n");
|
||||
|
||||
if (State == Models.State.Starting)
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("listening at"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
else if (e.Data.Contains("Invalid config path") || e.Data.Contains("usage") || e.Data.Contains("plugin service exit unexpectedly"))
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
if (Instance.HasExited)
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("listening at"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
else if (e.Data.Contains("Invalid config path") || e.Data.Contains("usage") || e.Data.Contains("plugin service exit unexpectedly"))
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ec)
|
||||
{
|
||||
Logging.Info("写入Shadowsocks日志失败" + ec.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user