diff --git a/Netch/Controllers/HTTPController.cs b/Netch/Controllers/HTTPController.cs
index 92839e4a..83a5c798 100644
--- a/Netch/Controllers/HTTPController.cs
+++ b/Netch/Controllers/HTTPController.cs
@@ -25,7 +25,7 @@ namespace Netch.Controllers
///
/// 模式
/// 是否启动成功
- public bool Start(Mode mode)
+ public bool Start(in Mode mode)
{
RecordPrevious();
diff --git a/Netch/Controllers/IModeController.cs b/Netch/Controllers/IModeController.cs
index 86c325ec..5fc5e2e0 100644
--- a/Netch/Controllers/IModeController.cs
+++ b/Netch/Controllers/IModeController.cs
@@ -9,6 +9,6 @@ namespace Netch.Controllers
///
/// 模式
/// 是否成功
- public abstract bool Start(Mode mode);
+ public abstract bool Start(in Mode mode);
}
}
\ No newline at end of file
diff --git a/Netch/Controllers/IServerController.cs b/Netch/Controllers/IServerController.cs
index 4ccb0c22..396dacb3 100644
--- a/Netch/Controllers/IServerController.cs
+++ b/Netch/Controllers/IServerController.cs
@@ -13,10 +13,10 @@ namespace Netch.Controllers
///
/// 启动
///
- /// 服务器
+ /// 服务器
/// 模式
/// 是否启动成功
- public abstract bool Start(Server server, Mode mode);
+ public abstract bool Start(in Server s, in Mode mode);
}
public static class ServerControllerExtension
diff --git a/Netch/Controllers/MainController.cs b/Netch/Controllers/MainController.cs
index 72f58ac2..468e334d 100644
--- a/Netch/Controllers/MainController.cs
+++ b/Netch/Controllers/MainController.cs
@@ -120,7 +120,7 @@ namespace Netch.Controllers
PortCheckAndShowMessageBox(controller.Socks5LocalPort(), "Socks5");
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", controller.Name));
- if (controller.Start(server, mode))
+ if (controller.Start(in server, mode))
{
UsingPorts.Add(StatusPortInfoText.Socks5Port = controller.Socks5LocalPort());
StatusPortInfoText.ShareLan = controller.LocalAddress == "0.0.0.0";
diff --git a/Netch/Controllers/NFController.cs b/Netch/Controllers/NFController.cs
index de13621a..d8dcc8e7 100644
--- a/Netch/Controllers/NFController.cs
+++ b/Netch/Controllers/NFController.cs
@@ -45,7 +45,7 @@ namespace Netch.Controllers
BinDriver = "bin\\" + fileName;
}
- public bool Start(Mode mode)
+ public bool Start(in Mode mode)
{
Logging.Info("内置驱动版本: " + Utils.Utils.GetFileVersion(BinDriver));
if (Utils.Utils.GetFileVersion(SystemDriver) != Utils.Utils.GetFileVersion(BinDriver))
@@ -80,7 +80,7 @@ namespace Netch.Controllers
return aio_init();
}
- private void SetServer(IServerController controller, PortType portType)
+ private void SetServer(in IServerController controller, in PortType portType)
{
if (portType == PortType.Both)
{
diff --git a/Netch/Controllers/TUNTAPController.cs b/Netch/Controllers/TUNTAPController.cs
index 328ea9be..23027498 100644
--- a/Netch/Controllers/TUNTAPController.cs
+++ b/Netch/Controllers/TUNTAPController.cs
@@ -39,7 +39,7 @@ namespace Netch.Controllers
public override string Name { get; protected set; } = "tun2socks";
public override string MainFile { get; protected set; } = "tun2socks.exe";
- public bool Start(Mode mode)
+ public bool Start(in Mode mode)
{
_savedMode = mode;
_savedServer = MainController.ServerController.Server;
diff --git a/Netch/Models/IServerUtil.cs b/Netch/Models/IServerUtil.cs
index 0b619001..32c36a6e 100644
--- a/Netch/Models/IServerUtil.cs
+++ b/Netch/Models/IServerUtil.cs
@@ -28,7 +28,7 @@ namespace Netch.Models
///
string[] UriScheme { get; }
- Server ParseJObject(JObject j);
+ Server ParseJObject(in JObject j);
public void Edit(Server s);
diff --git a/Netch/Servers/Shadowsocks/SSController.cs b/Netch/Servers/Shadowsocks/SSController.cs
index 87b073fb..ccadd84d 100644
--- a/Netch/Servers/Shadowsocks/SSController.cs
+++ b/Netch/Servers/Shadowsocks/SSController.cs
@@ -18,7 +18,7 @@ namespace Netch.Servers.Shadowsocks
private Mode _savedMode;
public bool DllFlag => Global.Settings.BootShadowsocksFromDLL && (_savedMode.Type == 0 || _savedMode.Type == 1 || _savedMode.Type == 2);
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s, in Mode mode)
{
_savedMode = mode;
Server = s;
diff --git a/Netch/Servers/Shadowsocks/SSUtil.cs b/Netch/Servers/Shadowsocks/SSUtil.cs
index 885c1751..1fb3410b 100644
--- a/Netch/Servers/Shadowsocks/SSUtil.cs
+++ b/Netch/Servers/Shadowsocks/SSUtil.cs
@@ -21,7 +21,7 @@ namespace Netch.Servers.Shadowsocks
public string ShortName { get; } = "SS";
public string[] UriScheme { get; } = {"ss", "ssd"};
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Servers/ShadowsocksR/SSRController.cs b/Netch/Servers/ShadowsocksR/SSRController.cs
index 97c978d2..4437ab70 100644
--- a/Netch/Servers/ShadowsocksR/SSRController.cs
+++ b/Netch/Servers/ShadowsocksR/SSRController.cs
@@ -15,7 +15,7 @@ namespace Netch.Servers.ShadowsocksR
public ushort? Socks5LocalPort { get; set; }
public string LocalAddress { get; set; }
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s, in Mode mode)
{
Server = s;
var server = (ShadowsocksR) s;
diff --git a/Netch/Servers/ShadowsocksR/SSRUtil.cs b/Netch/Servers/ShadowsocksR/SSRUtil.cs
index ad8ff9bf..d1b0f609 100644
--- a/Netch/Servers/ShadowsocksR/SSRUtil.cs
+++ b/Netch/Servers/ShadowsocksR/SSRUtil.cs
@@ -17,7 +17,7 @@ namespace Netch.Servers.ShadowsocksR
public string ShortName { get; } = "SR";
public string[] UriScheme { get; } = {"ssr"};
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Servers/Socks5/S5Controller.cs b/Netch/Servers/Socks5/S5Controller.cs
index 4ffb8a3f..7c7d2142 100644
--- a/Netch/Servers/Socks5/S5Controller.cs
+++ b/Netch/Servers/Socks5/S5Controller.cs
@@ -10,7 +10,7 @@ namespace Netch.Servers.Socks5
public override string Name { get; protected set; } = "Socks5";
public override string MainFile { get; protected set; } = "v2ray.exe";
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s, in Mode mode)
{
Server = s;
var server = (Socks5) s;
diff --git a/Netch/Servers/Socks5/S5Util.cs b/Netch/Servers/Socks5/S5Util.cs
index 3983de7e..96f7b61b 100644
--- a/Netch/Servers/Socks5/S5Util.cs
+++ b/Netch/Servers/Socks5/S5Util.cs
@@ -15,7 +15,7 @@ namespace Netch.Servers.Socks5
public string ShortName { get; } = "S5";
public string[] UriScheme { get; } = { };
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Servers/Trojan/TrojanController.cs b/Netch/Servers/Trojan/TrojanController.cs
index 179063f8..6a11656b 100644
--- a/Netch/Servers/Trojan/TrojanController.cs
+++ b/Netch/Servers/Trojan/TrojanController.cs
@@ -23,7 +23,7 @@ namespace Netch.Servers.Trojan
public string LocalAddress { get; set; }
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s, in Mode mode)
{
Server = s;
var server = (Trojan) s;
diff --git a/Netch/Servers/Trojan/TrojanUtil.cs b/Netch/Servers/Trojan/TrojanUtil.cs
index 9917176d..b750c008 100644
--- a/Netch/Servers/Trojan/TrojanUtil.cs
+++ b/Netch/Servers/Trojan/TrojanUtil.cs
@@ -17,7 +17,7 @@ namespace Netch.Servers.Trojan
public string ShortName { get; } = "TR";
public string[] UriScheme { get; } = {"trojan"};
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Servers/VLESS/VLESSController.cs b/Netch/Servers/VLESS/VLESSController.cs
index c35a1c11..d9031b8a 100644
--- a/Netch/Servers/VLESS/VLESSController.cs
+++ b/Netch/Servers/VLESS/VLESSController.cs
@@ -15,7 +15,7 @@ namespace Netch.Servers.VLESS
public string LocalAddress { get; set; }
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s,in Mode mode)
{
Server = s;
File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode));
diff --git a/Netch/Servers/VLESS/VLESSUtil.cs b/Netch/Servers/VLESS/VLESSUtil.cs
index a7050609..813838bf 100644
--- a/Netch/Servers/VLESS/VLESSUtil.cs
+++ b/Netch/Servers/VLESS/VLESSUtil.cs
@@ -13,7 +13,7 @@ namespace Netch.Servers.VLESS
public string ShortName { get; } = "VL";
public string[] UriScheme { get; } = { };
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Servers/VMess/VMessController.cs b/Netch/Servers/VMess/VMessController.cs
index de4038da..0b96e463 100644
--- a/Netch/Servers/VMess/VMessController.cs
+++ b/Netch/Servers/VMess/VMessController.cs
@@ -20,7 +20,7 @@ namespace Netch.Servers.VMess
public string LocalAddress { get; set; }
- public bool Start(Server s, Mode mode)
+ public bool Start(in Server s,in Mode mode)
{
Server = s;
File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode));
diff --git a/Netch/Servers/VMess/VMessUtil.cs b/Netch/Servers/VMess/VMessUtil.cs
index 649b826d..b36b9a00 100644
--- a/Netch/Servers/VMess/VMessUtil.cs
+++ b/Netch/Servers/VMess/VMessUtil.cs
@@ -18,7 +18,7 @@ namespace Netch.Servers.VMess
public string ShortName { get; } = "V2";
public string[] UriScheme { get; } = {"vmess"};
- public Server ParseJObject(JObject j)
+ public Server ParseJObject(in JObject j)
{
return j.ToObject();
}
diff --git a/Netch/Utils/Bandwidth.cs b/Netch/Utils/Bandwidth.cs
index efcdae3a..c6f5f2be 100644
--- a/Netch/Utils/Bandwidth.cs
+++ b/Netch/Utils/Bandwidth.cs
@@ -53,7 +53,7 @@ namespace Netch.Utils
///
/// 根据程序名统计流量
///
- public static void NetTraffic(Server server, Mode mode)
+ public static void NetTraffic(in Server server, in Mode mode)
{
if (!Global.Flags.IsWindows10Upper)
return;
diff --git a/Netch/Utils/ShareLink.cs b/Netch/Utils/ShareLink.cs
index 45e9d9c0..730401ea 100644
--- a/Netch/Utils/ShareLink.cs
+++ b/Netch/Utils/ShareLink.cs
@@ -149,7 +149,7 @@ namespace Netch.Utils
return list;
}
- private static IEnumerable ParseUri(string text)
+ private static IEnumerable ParseUri(in string text)
{
var list = new List();
diff --git a/Netch/Utils/Utils.cs b/Netch/Utils/Utils.cs
index 79a20942..0e4ec4da 100644
--- a/Netch/Utils/Utils.cs
+++ b/Netch/Utils/Utils.cs
@@ -197,7 +197,7 @@ namespace Netch.Utils
}
}
- public static void ComponentIterator(Component component, Action func)
+ public static void ComponentIterator(in Component component, in Action func)
{
func.Invoke(component);
switch (component)
diff --git a/Netch/Utils/i18N.cs b/Netch/Utils/i18N.cs
index 03a25be9..588fefe3 100644
--- a/Netch/Utils/i18N.cs
+++ b/Netch/Utils/i18N.cs
@@ -106,7 +106,7 @@ namespace Netch.Utils
return translateFile;
}
- public static void TranslateForm(Control c)
+ public static void TranslateForm(in Control c)
{
Utils.ComponentIterator(c, component =>
{