Skip to content

Commit 622c84d

Browse files
committed
Code style
1 parent 0e27645 commit 622c84d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

IPConfig/Helpers/NetworkManagement.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public static IPv6AdvancedConfig GetIPv6AdvancedConfig(NetworkInterface nic)
122122

123123
public static bool IsAutoDns(string nicId)
124124
{
125-
string path = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\" + nicId;
125+
string path = $@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{nicId}";
126126
string? ns = Registry.GetValue(path, "NameServer", null) as string;
127127

128128
// Wi-Fi 可能使用配置文件而不是网卡配置,需要优先判断。
@@ -136,7 +136,7 @@ public static bool IsAutoDns(string nicId)
136136

137137
public static bool IsDhcpEnabled(string nicId)
138138
{
139-
string path = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\" + nicId;
139+
string path = $@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{nicId}";
140140
object? dhcp = Registry.GetValue(path, "EnableDHCP", 0);
141141

142142
return dhcp is 1;
@@ -145,7 +145,7 @@ public static bool IsDhcpEnabled(string nicId)
145145
public static bool IsPhysicalAdapter(string nicId)
146146
{
147147
using var searcher = new ManagementObjectSearcher(@"root\CIMV2",
148-
@$"SELECT * FROM Win32_NetworkAdapter WHERE GUID='{nicId}' AND NOT PNPDeviceID LIKE 'ROOT\\%'");
148+
$@"SELECT * FROM Win32_NetworkAdapter WHERE GUID='{nicId}' AND NOT PNPDeviceID LIKE 'ROOT\\%'");
149149

150150
var managementObject = searcher.Get().OfType<ManagementObject>().FirstOrDefault();
151151
bool isPhysical = Convert.ToBoolean(managementObject?.Properties["PhysicalAdapter"].Value);

IPConfig/ViewModels/IPConfigListViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private void AddUntitledIPConfig(string name = "")
184184
if (String.IsNullOrWhiteSpace(name))
185185
{
186186
var orders = from x in IPConfigList
187-
let match = Regex.Match(x.Name, @$"^{Lang.Untitled}(\d+)$")
187+
let match = Regex.Match(x.Name, $@"^{Lang.Untitled}(\d+)$")
188188
where match.Success
189189
select Convert.ToInt32(match.Groups[1].Value);
190190

@@ -413,7 +413,7 @@ private void MakeSelectedIPConfigCopy(EditableIPConfigModel? original)
413413
}
414414

415415
var orders = from x in IPConfigList
416-
let match = Regex.Match(x.Name, @$"^{Lang.Copy_Noun}(\d+)-{Regex.Escape(original.Name)}$")
416+
let match = Regex.Match(x.Name, $@"^{Lang.Copy_Noun}(\d+)-{Regex.Escape(original.Name)}$")
417417
where match.Success
418418
select Convert.ToInt32(match.Groups[1].Value);
419419

0 commit comments

Comments
 (0)