mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Reduce Reference and cleanup
This commit is contained in:
@@ -66,22 +66,34 @@ namespace Netch.Controllers
|
||||
|
||||
private new void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(e.Data))
|
||||
if (string.IsNullOrEmpty(e.Data)) return;
|
||||
var str = e.Data.Split(':');
|
||||
if (str.Length < 2)
|
||||
return;
|
||||
str[1] = str[1].Trim();
|
||||
switch (str[0])
|
||||
{
|
||||
if (e.Data.StartsWith("Other address is: "))
|
||||
_Other_address = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("Binding test: "))
|
||||
_Binding_test = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("Local address: "))
|
||||
_Local_address = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("Mapped address: "))
|
||||
_Mapped_address = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("Nat mapping behavior: "))
|
||||
_Nat_mapping_behavior = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("Nat filtering behavior: "))
|
||||
_Nat_filtering_behavior = e.Data.Split(':')[1].Trim();
|
||||
if (e.Data.StartsWith("result: "))
|
||||
_lastResult = e.Data.Split(':')[1].Trim();
|
||||
case "Other address is":
|
||||
_Other_address = str[1];
|
||||
break;
|
||||
case "Binding test":
|
||||
_Binding_test = str[1];
|
||||
break;
|
||||
case "Local address":
|
||||
_Local_address = str[1];
|
||||
break;
|
||||
case "Mapped address":
|
||||
_Mapped_address = str[1];
|
||||
break;
|
||||
case "Nat mapping behavior":
|
||||
_Nat_mapping_behavior = str[1];
|
||||
break;
|
||||
case "Nat filtering behavior":
|
||||
_Nat_filtering_behavior = str[1];
|
||||
break;
|
||||
case "result":
|
||||
_lastResult = str[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user