Skip to content

Commit ed61f5c

Browse files
committed
Rename ViewModel properties to PascalCase
1 parent bf98c40 commit ed61f5c

3 files changed

Lines changed: 131 additions & 131 deletions

File tree

v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ public class OptionSettingViewModel : MyReactiveObject
44
{
55
#region Core
66

7-
[Reactive] public int localPort { get; set; }
7+
[Reactive] public int LocalPort { get; set; }
88
[Reactive] public bool SecondLocalPortEnabled { get; set; }
9-
[Reactive] public bool udpEnabled { get; set; }
10-
[Reactive] public bool sniffingEnabled { get; set; }
11-
public IList<string> destOverride { get; set; }
12-
[Reactive] public bool routeOnly { get; set; }
13-
[Reactive] public bool allowLANConn { get; set; }
14-
[Reactive] public bool newPort4LAN { get; set; }
15-
[Reactive] public string user { get; set; }
16-
[Reactive] public string pass { get; set; }
17-
[Reactive] public bool muxEnabled { get; set; }
18-
[Reactive] public bool logEnabled { get; set; }
19-
[Reactive] public string loglevel { get; set; }
20-
[Reactive] public bool defAllowInsecure { get; set; }
21-
[Reactive] public string defFingerprint { get; set; }
22-
[Reactive] public string defUserAgent { get; set; }
23-
[Reactive] public string sendThrough { get; set; }
24-
[Reactive] public string bindInterface { get; set; }
25-
[Reactive] public string mux4SboxProtocol { get; set; }
26-
[Reactive] public bool enableCacheFile4Sbox { get; set; }
27-
[Reactive] public int? hyUpMbps { get; set; }
28-
[Reactive] public int? hyDownMbps { get; set; }
29-
[Reactive] public bool enableFragment { get; set; }
9+
[Reactive] public bool UdpEnabled { get; set; }
10+
[Reactive] public bool SniffingEnabled { get; set; }
11+
public IList<string> DestOverride { get; set; }
12+
[Reactive] public bool RouteOnly { get; set; }
13+
[Reactive] public bool AllowLANConn { get; set; }
14+
[Reactive] public bool NewPort4LAN { get; set; }
15+
[Reactive] public string User { get; set; }
16+
[Reactive] public string Pass { get; set; }
17+
[Reactive] public bool MuxEnabled { get; set; }
18+
[Reactive] public bool LogEnabled { get; set; }
19+
[Reactive] public string Loglevel { get; set; }
20+
[Reactive] public bool DefAllowInsecure { get; set; }
21+
[Reactive] public string DefFingerprint { get; set; }
22+
[Reactive] public string DefUserAgent { get; set; }
23+
[Reactive] public string SendThrough { get; set; }
24+
[Reactive] public string BindInterface { get; set; }
25+
[Reactive] public string Mux4SboxProtocol { get; set; }
26+
[Reactive] public bool EnableCacheFile4Sbox { get; set; }
27+
[Reactive] public int? HyUpMbps { get; set; }
28+
[Reactive] public int? HyDownMbps { get; set; }
29+
[Reactive] public bool EnableFragment { get; set; }
3030

3131
#endregion Core
3232

@@ -83,9 +83,9 @@ public class OptionSettingViewModel : MyReactiveObject
8383

8484
#region System proxy
8585

86-
[Reactive] public bool notProxyLocalAddress { get; set; }
87-
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
88-
[Reactive] public string systemProxyExceptions { get; set; }
86+
[Reactive] public bool NotProxyLocalAddress { get; set; }
87+
[Reactive] public string SystemProxyAdvancedProtocol { get; set; }
88+
[Reactive] public string SystemProxyExceptions { get; set; }
8989
[Reactive] public string CustomSystemProxyPacPath { get; set; }
9090
[Reactive] public string CustomSystemProxyScriptPath { get; set; }
9191

@@ -142,28 +142,28 @@ private async Task Init()
142142
#region Core
143143

144144
var inbound = _config.Inbound.First();
145-
localPort = inbound.LocalPort;
145+
LocalPort = inbound.LocalPort;
146146
SecondLocalPortEnabled = inbound.SecondLocalPortEnabled;
147-
udpEnabled = inbound.UdpEnabled;
148-
sniffingEnabled = inbound.SniffingEnabled;
149-
routeOnly = inbound.RouteOnly;
150-
allowLANConn = inbound.AllowLANConn;
151-
newPort4LAN = inbound.NewPort4LAN;
152-
user = inbound.User;
153-
pass = inbound.Pass;
154-
muxEnabled = _config.CoreBasicItem.MuxEnabled;
155-
logEnabled = _config.CoreBasicItem.LogEnabled;
156-
loglevel = _config.CoreBasicItem.Loglevel;
157-
defAllowInsecure = _config.CoreBasicItem.DefAllowInsecure;
158-
defFingerprint = _config.CoreBasicItem.DefFingerprint;
159-
defUserAgent = _config.CoreBasicItem.DefUserAgent;
160-
sendThrough = _config.CoreBasicItem.SendThrough ?? string.Empty;
161-
bindInterface = _config.CoreBasicItem.BindInterface ?? string.Empty;
162-
mux4SboxProtocol = _config.Mux4SboxItem.Protocol;
163-
enableCacheFile4Sbox = _config.CoreBasicItem.EnableCacheFile4Sbox;
164-
hyUpMbps = _config.HysteriaItem.UpMbps;
165-
hyDownMbps = _config.HysteriaItem.DownMbps;
166-
enableFragment = _config.CoreBasicItem.EnableFragment;
147+
UdpEnabled = inbound.UdpEnabled;
148+
SniffingEnabled = inbound.SniffingEnabled;
149+
RouteOnly = inbound.RouteOnly;
150+
AllowLANConn = inbound.AllowLANConn;
151+
NewPort4LAN = inbound.NewPort4LAN;
152+
User = inbound.User;
153+
Pass = inbound.Pass;
154+
MuxEnabled = _config.CoreBasicItem.MuxEnabled;
155+
LogEnabled = _config.CoreBasicItem.LogEnabled;
156+
Loglevel = _config.CoreBasicItem.Loglevel;
157+
DefAllowInsecure = _config.CoreBasicItem.DefAllowInsecure;
158+
DefFingerprint = _config.CoreBasicItem.DefFingerprint;
159+
DefUserAgent = _config.CoreBasicItem.DefUserAgent;
160+
SendThrough = _config.CoreBasicItem.SendThrough ?? string.Empty;
161+
BindInterface = _config.CoreBasicItem.BindInterface ?? string.Empty;
162+
Mux4SboxProtocol = _config.Mux4SboxItem.Protocol;
163+
EnableCacheFile4Sbox = _config.CoreBasicItem.EnableCacheFile4Sbox;
164+
HyUpMbps = _config.HysteriaItem.UpMbps;
165+
HyDownMbps = _config.HysteriaItem.DownMbps;
166+
EnableFragment = _config.CoreBasicItem.EnableFragment;
167167

168168
#endregion Core
169169

@@ -211,9 +211,9 @@ private async Task Init()
211211

212212
#region System proxy
213213

214-
notProxyLocalAddress = _config.SystemProxyItem.NotProxyLocalAddress;
215-
systemProxyAdvancedProtocol = _config.SystemProxyItem.SystemProxyAdvancedProtocol;
216-
systemProxyExceptions = _config.SystemProxyItem.SystemProxyExceptions;
214+
NotProxyLocalAddress = _config.SystemProxyItem.NotProxyLocalAddress;
215+
SystemProxyAdvancedProtocol = _config.SystemProxyItem.SystemProxyAdvancedProtocol;
216+
SystemProxyExceptions = _config.SystemProxyItem.SystemProxyExceptions;
217217
CustomSystemProxyPacPath = _config.SystemProxyItem.CustomSystemProxyPacPath;
218218
CustomSystemProxyScriptPath = _config.SystemProxyItem.CustomSystemProxyScriptPath;
219219

@@ -297,13 +297,13 @@ private async Task InitCoreType()
297297

298298
private async Task SaveSettingAsync()
299299
{
300-
if (localPort.ToString().IsNullOrEmpty() || !Utils.IsNumeric(localPort.ToString())
301-
|| localPort <= 0 || localPort >= Global.MaxPort)
300+
if (LocalPort.ToString().IsNullOrEmpty() || !Utils.IsNumeric(LocalPort.ToString())
301+
|| LocalPort <= 0 || LocalPort >= Global.MaxPort)
302302
{
303303
NoticeManager.Instance.Enqueue(ResUI.FillLocalListeningPort);
304304
return;
305305
}
306-
var sendThroughValue = sendThrough.TrimEx();
306+
var sendThroughValue = SendThrough.TrimEx();
307307
if (sendThroughValue.IsNotEmpty() && !Utils.IsIpv4(sendThroughValue))
308308
{
309309
NoticeManager.Instance.Enqueue(ResUI.FillCorrectSendThroughIPv4);
@@ -328,33 +328,33 @@ private async Task SaveSettingAsync()
328328
//}
329329

330330
//Core
331-
_config.Inbound.First().LocalPort = localPort;
331+
_config.Inbound.First().LocalPort = LocalPort;
332332
_config.Inbound.First().SecondLocalPortEnabled = SecondLocalPortEnabled;
333-
_config.Inbound.First().UdpEnabled = udpEnabled;
334-
_config.Inbound.First().SniffingEnabled = sniffingEnabled;
335-
_config.Inbound.First().DestOverride = destOverride?.ToList();
336-
_config.Inbound.First().RouteOnly = routeOnly;
337-
_config.Inbound.First().AllowLANConn = allowLANConn;
338-
_config.Inbound.First().NewPort4LAN = newPort4LAN;
339-
_config.Inbound.First().User = user;
340-
_config.Inbound.First().Pass = pass;
333+
_config.Inbound.First().UdpEnabled = UdpEnabled;
334+
_config.Inbound.First().SniffingEnabled = SniffingEnabled;
335+
_config.Inbound.First().DestOverride = DestOverride?.ToList();
336+
_config.Inbound.First().RouteOnly = RouteOnly;
337+
_config.Inbound.First().AllowLANConn = AllowLANConn;
338+
_config.Inbound.First().NewPort4LAN = NewPort4LAN;
339+
_config.Inbound.First().User = User;
340+
_config.Inbound.First().Pass = Pass;
341341
if (_config.Inbound.Count > 1)
342342
{
343343
_config.Inbound.RemoveAt(1);
344344
}
345-
_config.CoreBasicItem.LogEnabled = logEnabled;
346-
_config.CoreBasicItem.Loglevel = loglevel;
347-
_config.CoreBasicItem.MuxEnabled = muxEnabled;
348-
_config.CoreBasicItem.DefAllowInsecure = defAllowInsecure;
349-
_config.CoreBasicItem.DefFingerprint = defFingerprint;
350-
_config.CoreBasicItem.DefUserAgent = defUserAgent;
351-
_config.CoreBasicItem.SendThrough = sendThrough.TrimEx();
352-
_config.CoreBasicItem.BindInterface = bindInterface.TrimEx();
353-
_config.Mux4SboxItem.Protocol = mux4SboxProtocol;
354-
_config.CoreBasicItem.EnableCacheFile4Sbox = enableCacheFile4Sbox;
355-
_config.HysteriaItem.UpMbps = hyUpMbps ?? 0;
356-
_config.HysteriaItem.DownMbps = hyDownMbps ?? 0;
357-
_config.CoreBasicItem.EnableFragment = enableFragment;
345+
_config.CoreBasicItem.LogEnabled = LogEnabled;
346+
_config.CoreBasicItem.Loglevel = Loglevel;
347+
_config.CoreBasicItem.MuxEnabled = MuxEnabled;
348+
_config.CoreBasicItem.DefAllowInsecure = DefAllowInsecure;
349+
_config.CoreBasicItem.DefFingerprint = DefFingerprint;
350+
_config.CoreBasicItem.DefUserAgent = DefUserAgent;
351+
_config.CoreBasicItem.SendThrough = SendThrough.TrimEx();
352+
_config.CoreBasicItem.BindInterface = BindInterface.TrimEx();
353+
_config.Mux4SboxItem.Protocol = Mux4SboxProtocol;
354+
_config.CoreBasicItem.EnableCacheFile4Sbox = EnableCacheFile4Sbox;
355+
_config.HysteriaItem.UpMbps = HyUpMbps ?? 0;
356+
_config.HysteriaItem.DownMbps = HyDownMbps ?? 0;
357+
_config.CoreBasicItem.EnableFragment = EnableFragment;
358358

359359
_config.GuiItem.AutoRun = AutoRun;
360360
_config.GuiItem.EnableStatistics = EnableStatistics;
@@ -383,9 +383,9 @@ private async Task SaveSettingAsync()
383383
_config.SpeedTestItem.IPAPIUrl = IPAPIUrl;
384384

385385
//systemProxy
386-
_config.SystemProxyItem.SystemProxyExceptions = systemProxyExceptions;
387-
_config.SystemProxyItem.NotProxyLocalAddress = notProxyLocalAddress;
388-
_config.SystemProxyItem.SystemProxyAdvancedProtocol = systemProxyAdvancedProtocol;
386+
_config.SystemProxyItem.SystemProxyExceptions = SystemProxyExceptions;
387+
_config.SystemProxyItem.NotProxyLocalAddress = NotProxyLocalAddress;
388+
_config.SystemProxyItem.SystemProxyAdvancedProtocol = SystemProxyAdvancedProtocol;
389389
_config.SystemProxyItem.CustomSystemProxyPacPath = CustomSystemProxyPacPath;
390390
_config.SystemProxyItem.CustomSystemProxyScriptPath = CustomSystemProxyScriptPath;
391391

v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,30 @@ public OptionSettingWindow()
6060

6161
this.WhenActivated(disposables =>
6262
{
63-
this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables);
63+
this.Bind(ViewModel, vm => vm.LocalPort, v => v.txtlocalPort.Text).DisposeWith(disposables);
6464
this.Bind(ViewModel, vm => vm.SecondLocalPortEnabled, v => v.togSecondLocalPortEnabled.IsChecked).DisposeWith(disposables);
65-
this.Bind(ViewModel, vm => vm.udpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables);
66-
this.Bind(ViewModel, vm => vm.sniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables);
67-
this.Bind(ViewModel, vm => vm.routeOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables);
68-
this.Bind(ViewModel, vm => vm.allowLANConn, v => v.togAllowLANConn.IsChecked).DisposeWith(disposables);
69-
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.togNewPort4LAN.IsChecked).DisposeWith(disposables);
70-
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtuser.IsEnabled).DisposeWith(disposables);
71-
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables);
72-
this.Bind(ViewModel, vm => vm.user, v => v.txtuser.Text).DisposeWith(disposables);
73-
this.Bind(ViewModel, vm => vm.pass, v => v.txtpass.Text).DisposeWith(disposables);
74-
this.Bind(ViewModel, vm => vm.muxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
75-
this.Bind(ViewModel, vm => vm.logEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables);
76-
this.Bind(ViewModel, vm => vm.loglevel, v => v.cmbloglevel.SelectedValue).DisposeWith(disposables);
77-
this.Bind(ViewModel, vm => vm.defAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables);
78-
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.SelectedValue).DisposeWith(disposables);
79-
this.Bind(ViewModel, vm => vm.defUserAgent, v => v.cmbdefUserAgent.SelectedValue).DisposeWith(disposables);
80-
this.Bind(ViewModel, vm => vm.bindInterface, v => v.txtbindInterface.Text).DisposeWith(disposables);
81-
this.Bind(ViewModel, vm => vm.sendThrough, v => v.txtsendThrough.Text).DisposeWith(disposables);
82-
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.SelectedValue).DisposeWith(disposables);
83-
this.Bind(ViewModel, vm => vm.enableCacheFile4Sbox, v => v.togenableCacheFile4Sbox.IsChecked).DisposeWith(disposables);
84-
this.Bind(ViewModel, vm => vm.hyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
85-
this.Bind(ViewModel, vm => vm.hyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
86-
this.Bind(ViewModel, vm => vm.enableFragment, v => v.togenableFragment.IsChecked).DisposeWith(disposables);
65+
this.Bind(ViewModel, vm => vm.UdpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables);
66+
this.Bind(ViewModel, vm => vm.SniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables);
67+
this.Bind(ViewModel, vm => vm.RouteOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables);
68+
this.Bind(ViewModel, vm => vm.AllowLANConn, v => v.togAllowLANConn.IsChecked).DisposeWith(disposables);
69+
this.Bind(ViewModel, vm => vm.NewPort4LAN, v => v.togNewPort4LAN.IsChecked).DisposeWith(disposables);
70+
this.Bind(ViewModel, vm => vm.NewPort4LAN, v => v.txtuser.IsEnabled).DisposeWith(disposables);
71+
this.Bind(ViewModel, vm => vm.NewPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables);
72+
this.Bind(ViewModel, vm => vm.User, v => v.txtuser.Text).DisposeWith(disposables);
73+
this.Bind(ViewModel, vm => vm.Pass, v => v.txtpass.Text).DisposeWith(disposables);
74+
this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
75+
this.Bind(ViewModel, vm => vm.LogEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables);
76+
this.Bind(ViewModel, vm => vm.Loglevel, v => v.cmbloglevel.SelectedValue).DisposeWith(disposables);
77+
this.Bind(ViewModel, vm => vm.DefAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables);
78+
this.Bind(ViewModel, vm => vm.DefFingerprint, v => v.cmbdefFingerprint.SelectedValue).DisposeWith(disposables);
79+
this.Bind(ViewModel, vm => vm.DefUserAgent, v => v.cmbdefUserAgent.SelectedValue).DisposeWith(disposables);
80+
this.Bind(ViewModel, vm => vm.BindInterface, v => v.txtbindInterface.Text).DisposeWith(disposables);
81+
this.Bind(ViewModel, vm => vm.SendThrough, v => v.txtsendThrough.Text).DisposeWith(disposables);
82+
this.Bind(ViewModel, vm => vm.Mux4SboxProtocol, v => v.cmbmux4SboxProtocol.SelectedValue).DisposeWith(disposables);
83+
this.Bind(ViewModel, vm => vm.EnableCacheFile4Sbox, v => v.togenableCacheFile4Sbox.IsChecked).DisposeWith(disposables);
84+
this.Bind(ViewModel, vm => vm.HyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
85+
this.Bind(ViewModel, vm => vm.HyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
86+
this.Bind(ViewModel, vm => vm.EnableFragment, v => v.togenableFragment.IsChecked).DisposeWith(disposables);
8787

8888
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
8989
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
@@ -109,9 +109,9 @@ public OptionSettingWindow()
109109
this.Bind(ViewModel, vm => vm.RoutingRulesSourceUrl, v => v.cmbRoutingRulesSourceUrl.Text).DisposeWith(disposables);
110110
this.Bind(ViewModel, vm => vm.IPAPIUrl, v => v.cmbIPAPIUrl.Text).DisposeWith(disposables);
111111

112-
this.Bind(ViewModel, vm => vm.notProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
113-
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.SelectedValue).DisposeWith(disposables);
114-
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
112+
this.Bind(ViewModel, vm => vm.NotProxyLocalAddress, v => v.tognotProxyLocalAddress.IsChecked).DisposeWith(disposables);
113+
this.Bind(ViewModel, vm => vm.SystemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.SelectedValue).DisposeWith(disposables);
114+
this.Bind(ViewModel, vm => vm.SystemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
115115
this.Bind(ViewModel, vm => vm.CustomSystemProxyPacPath, v => v.txtCustomSystemProxyPacPath.Text).DisposeWith(disposables);
116116
this.Bind(ViewModel, vm => vm.CustomSystemProxyScriptPath, v => v.txtCustomSystemProxyScriptPath.Text).DisposeWith(disposables);
117117

@@ -185,7 +185,7 @@ private void ClbdestOverride_SelectionChanged(object? sender, SelectionChangedEv
185185
{
186186
if (ViewModel != null)
187187
{
188-
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
188+
ViewModel.DestOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
189189
}
190190
}
191191

0 commit comments

Comments
 (0)