Cleanup code

This commit is contained in:
Bruce Wayne
2020-01-23 20:44:17 +08:00
parent c5e46844da
commit 087f6e4eb9
33 changed files with 294 additions and 407 deletions

View File

@@ -34,21 +34,21 @@ namespace Netch.Controllers
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod}";
if (!String.IsNullOrEmpty(server.Protocol))
if (!string.IsNullOrEmpty(server.Protocol))
{
Instance.StartInfo.Arguments += $" -O {server.Protocol}";
if (!String.IsNullOrEmpty(server.ProtocolParam))
if (!string.IsNullOrEmpty(server.ProtocolParam))
{
Instance.StartInfo.Arguments += $" -G \"{server.ProtocolParam}\"";
}
}
if (!String.IsNullOrEmpty(server.OBFS))
if (!string.IsNullOrEmpty(server.OBFS))
{
Instance.StartInfo.Arguments += $" -o {server.OBFS}";
if (!String.IsNullOrEmpty(server.OBFSParam))
if (!string.IsNullOrEmpty(server.OBFSParam))
{
Instance.StartInfo.Arguments += $" -g \"{server.OBFSParam}\"";
}
@@ -68,7 +68,7 @@ namespace Netch.Controllers
Instance.Start();
Instance.BeginOutputReadLine();
Instance.BeginErrorReadLine();
for (int i = 0; i < 1000; i++)
for (var i = 0; i < 1000; i++)
{
Thread.Sleep(10);
@@ -111,7 +111,7 @@ namespace Netch.Controllers
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (!String.IsNullOrWhiteSpace(e.Data))
if (!string.IsNullOrWhiteSpace(e.Data))
{
File.AppendAllText("logging\\shadowsocksr.log", $"{e.Data}\r\n");