From 090e487733f4801f312024b2e50742d735dfe52c Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Sun, 28 Mar 2021 00:30:05 +0800 Subject: [PATCH] Move MessageException Namespace and Optimize import --- Netch/Controllers/MainController.cs | 12 ------------ Netch/Controllers/RedirectorInterop.cs | 1 - Netch/Controllers/TUNController.cs | 6 ------ Netch/Flags.cs | 1 - Netch/Forms/MainForm.cs | 1 - Netch/Forms/Mode/Process.cs | 1 - Netch/Forms/SettingForm.cs | 1 - Netch/Models/MessageException.cs | 15 +++++++++++++++ Netch/Models/Mode.cs | 1 - Netch/Models/OutboundAdapter.cs | 2 -- Netch/Servers/Shadowsocks/SSController.cs | 2 -- Netch/Servers/ShadowsocksR/SSRController.cs | 2 -- Netch/Updater/Updater.cs | 1 + Netch/Utils/AdapterUtils.cs | 1 - Netch/Utils/Bandwidth.cs | 1 - Netch/Utils/PortHelper.cs | 1 - Netch/Utils/Utils.cs | 1 - 17 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 Netch/Models/MessageException.cs diff --git a/Netch/Controllers/MainController.cs b/Netch/Controllers/MainController.cs index ec9f90f8..f3b06aeb 100644 --- a/Netch/Controllers/MainController.cs +++ b/Netch/Controllers/MainController.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.IO; using System.Threading.Tasks; using Netch.Models; @@ -212,15 +211,4 @@ namespace Netch.Controllers PortCheck(port, portName, PortType.TCP); } } - - public class MessageException : Exception - { - public MessageException() - { - } - - public MessageException(string message) : base(message) - { - } - } } \ No newline at end of file diff --git a/Netch/Controllers/RedirectorInterop.cs b/Netch/Controllers/RedirectorInterop.cs index 9de52278..f1353ffd 100644 --- a/Netch/Controllers/RedirectorInterop.cs +++ b/Netch/Controllers/RedirectorInterop.cs @@ -1,5 +1,4 @@ using System.Runtime.InteropServices; -using System.Text; using Netch.Utils; namespace Netch.Controllers diff --git a/Netch/Controllers/TUNController.cs b/Netch/Controllers/TUNController.cs index 33512c9b..c370d1dc 100644 --- a/Netch/Controllers/TUNController.cs +++ b/Netch/Controllers/TUNController.cs @@ -1,20 +1,14 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; -using System.Text; -using System.Threading; using System.Threading.Tasks; using Netch.Models; using Netch.Servers.Socks5; using Netch.Utils; -using Vanara.PInvoke; using static Netch.Controllers.TUNInterop; -using static Vanara.PInvoke.IpHlpApi; -using static Vanara.PInvoke.Ws2_32; namespace Netch.Controllers { diff --git a/Netch/Flags.cs b/Netch/Flags.cs index e6872ed7..1216e0b2 100644 --- a/Netch/Flags.cs +++ b/Netch/Flags.cs @@ -1,5 +1,4 @@ using System; -using Netch.Controllers; namespace Netch { diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index 2fa5d93e..7a851da3 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -5,7 +5,6 @@ using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.IO; using System.Linq; -using System.Net; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; diff --git a/Netch/Forms/Mode/Process.cs b/Netch/Forms/Mode/Process.cs index 7d8a3afe..520c037b 100644 --- a/Netch/Forms/Mode/Process.cs +++ b/Netch/Forms/Mode/Process.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.WindowsAPICodePack.Dialogs; using Netch.Controllers; diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index 118d68d0..91fd7174 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -4,7 +4,6 @@ using System.Drawing; using System.IO; using System.Linq; using System.Net; -using System.Threading.Tasks; using System.Windows.Forms; using Netch.Models; using Netch.Properties; diff --git a/Netch/Models/MessageException.cs b/Netch/Models/MessageException.cs new file mode 100644 index 00000000..d2faf2a7 --- /dev/null +++ b/Netch/Models/MessageException.cs @@ -0,0 +1,15 @@ +using System; + +namespace Netch.Models +{ + public class MessageException : Exception + { + public MessageException() + { + } + + public MessageException(string message) : base(message) + { + } + } +} \ No newline at end of file diff --git a/Netch/Models/Mode.cs b/Netch/Models/Mode.cs index 28d207c0..7e7584dd 100644 --- a/Netch/Models/Mode.cs +++ b/Netch/Models/Mode.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Netch.Controllers; using Netch.Utils; namespace Netch.Models diff --git a/Netch/Models/OutboundAdapter.cs b/Netch/Models/OutboundAdapter.cs index 22ea76fc..33d9e6cd 100644 --- a/Netch/Models/OutboundAdapter.cs +++ b/Netch/Models/OutboundAdapter.cs @@ -2,8 +2,6 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; -using Microsoft.Win32; -using Netch.Controllers; using Netch.Utils; using Vanara.PInvoke; diff --git a/Netch/Servers/Shadowsocks/SSController.cs b/Netch/Servers/Shadowsocks/SSController.cs index 765eb3c0..48e934a6 100644 --- a/Netch/Servers/Shadowsocks/SSController.cs +++ b/Netch/Servers/Shadowsocks/SSController.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using System.IO; -using System.Text; using Netch.Controllers; using Netch.Models; diff --git a/Netch/Servers/ShadowsocksR/SSRController.cs b/Netch/Servers/ShadowsocksR/SSRController.cs index 5724b8f8..59ac5eba 100644 --- a/Netch/Servers/ShadowsocksR/SSRController.cs +++ b/Netch/Servers/ShadowsocksR/SSRController.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using System.IO; -using System.Text; using Netch.Controllers; using Netch.Models; diff --git a/Netch/Updater/Updater.cs b/Netch/Updater/Updater.cs index aa7ea74c..43bddc15 100644 --- a/Netch/Updater/Updater.cs +++ b/Netch/Updater/Updater.cs @@ -8,6 +8,7 @@ using System.Net; using System.Text; using System.Windows.Threading; using Netch.Controllers; +using Netch.Models; using Netch.Properties; using Netch.Utils; diff --git a/Netch/Utils/AdapterUtils.cs b/Netch/Utils/AdapterUtils.cs index 82758103..6fafcb90 100644 --- a/Netch/Utils/AdapterUtils.cs +++ b/Netch/Utils/AdapterUtils.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using Microsoft.Win32; diff --git a/Netch/Utils/Bandwidth.cs b/Netch/Utils/Bandwidth.cs index 499b27e4..1f563258 100644 --- a/Netch/Utils/Bandwidth.cs +++ b/Netch/Utils/Bandwidth.cs @@ -6,7 +6,6 @@ using Microsoft.Diagnostics.Tracing.Parsers; using Microsoft.Diagnostics.Tracing.Session; using Netch.Controllers; using Netch.Models; -using Netch.Servers.Shadowsocks; namespace Netch.Utils { diff --git a/Netch/Utils/PortHelper.cs b/Netch/Utils/PortHelper.cs index 34054f10..89e97f54 100644 --- a/Netch/Utils/PortHelper.cs +++ b/Netch/Utils/PortHelper.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.NetworkInformation; -using Netch.Models; using static Vanara.PInvoke.IpHlpApi; using static Vanara.PInvoke.Ws2_32; using Range = Netch.Models.Range; diff --git a/Netch/Utils/Utils.cs b/Netch/Utils/Utils.cs index c771a388..3b11746a 100644 --- a/Netch/Utils/Utils.cs +++ b/Netch/Utils/Utils.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.IO; using System.Linq;