Skip to content

Commit 31748aa

Browse files
committed
Refactor code
1 parent d0c6ea6 commit 31748aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+54
-464
lines changed

v2rayN/v2rayN/Models/EConfigType.cs renamed to v2rayN/v2rayN/Enums/EConfigType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EConfigType
44
{

v2rayN/v2rayN/Models/ECoreType.cs renamed to v2rayN/v2rayN/Enums/ECoreType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum ECoreType
44
{

v2rayN/v2rayN/Models/EGlobalHotkey.cs renamed to v2rayN/v2rayN/Enums/EGlobalHotkey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EGlobalHotkey
44
{

v2rayN/v2rayN/Models/EInboundProtocol.cs renamed to v2rayN/v2rayN/Enums/EInboundProtocol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EInboundProtocol
44
{

v2rayN/v2rayN/Models/EMove.cs renamed to v2rayN/v2rayN/Enums/EMove.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EMove
44
{

v2rayN/v2rayN/Models/EServerColName.cs renamed to v2rayN/v2rayN/Enums/EServerColName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EServerColName
44
{

v2rayN/v2rayN/Models/ESpeedActionType.cs renamed to v2rayN/v2rayN/Enums/ESpeedActionType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum ESpeedActionType
44
{

v2rayN/v2rayN/Models/ESysProxyType.cs renamed to v2rayN/v2rayN/Enums/ESysProxyType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum ESysProxyType
44
{

v2rayN/v2rayN/Models/ETransport.cs renamed to v2rayN/v2rayN/Enums/ETransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum ETransport
44
{

v2rayN/v2rayN/Models/EViewAction.cs renamed to v2rayN/v2rayN/Enums/EViewAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace v2rayN.Models
1+
namespace v2rayN.Enums
22
{
33
public enum EViewAction
44
{

v2rayN/v2rayN/Global.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using v2rayN.Models;
1+
using v2rayN.Enums;
22

33
namespace v2rayN
44
{

v2rayN/v2rayN/Handler/ConfigHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Data;
22
using System.IO;
33
using System.Text.RegularExpressions;
4+
using v2rayN.Enums;
45
using v2rayN.Models;
56

67
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/CoreConfigHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using v2rayN.Enums;
23
using v2rayN.Models;
34
using v2rayN.Resx;
45

v2rayN/v2rayN/Handler/CoreConfigSingbox.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Net;
22
using System.Net.NetworkInformation;
3+
using v2rayN.Enums;
34
using v2rayN.Models;
45
using v2rayN.Resx;
56

v2rayN/v2rayN/Handler/CoreConfigV2ray.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Net;
22
using System.Net.NetworkInformation;
3+
using v2rayN.Enums;
34
using v2rayN.Models;
45
using v2rayN.Resx;
56

v2rayN/v2rayN/Handler/CoreHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.IO;
33
using System.Reactive.Linq;
44
using System.Text;
5+
using v2rayN.Enums;
56
using v2rayN.Models;
67
using v2rayN.Resx;
78

v2rayN/v2rayN/Handler/DownloadHandle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Net.Http;
55
using System.Net.Http.Headers;
66
using System.Net.Sockets;
7-
using v2rayN.Models;
7+
using v2rayN.Enums;
88
using v2rayN.Resx;
99

1010
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/HotkeyHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Windows;
55
using System.Windows.Input;
66
using System.Windows.Interop;
7+
using v2rayN.Enums;
78
using v2rayN.Models;
89
using v2rayN.Resx;
910

v2rayN/v2rayN/Handler/LazyConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Runtime.Intrinsics.X86;
2+
using v2rayN.Enums;
23
using v2rayN.Models;
34

45
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/MainFormHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Drawing;
44
using System.IO;
55
using System.Windows.Media.Imaging;
6+
using v2rayN.Enums;
67
using v2rayN.Models;
78
using v2rayN.Resx;
89

v2rayN/v2rayN/Handler/ShareHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Specialized;
22
using System.Text.RegularExpressions;
3+
using v2rayN.Enums;
34
using v2rayN.Models;
45
using v2rayN.Resx;
56

v2rayN/v2rayN/Handler/SpeedtestHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Diagnostics;
33
using System.Net;
44
using System.Net.Sockets;
5+
using v2rayN.Enums;
56
using v2rayN.Models;
67
using v2rayN.Resx;
78

v2rayN/v2rayN/Handler/StatisticsSingbox.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Net.WebSockets;
22
using System.Text;
3+
using v2rayN.Enums;
34
using v2rayN.Models;
45

56
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/StatisticsV2ray.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Grpc.Core;
22
using Grpc.Net.Client;
33
using ProtosLib.Statistics;
4+
using v2rayN.Enums;
45
using v2rayN.Models;
56

67
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/SysProxyHandle.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using PacLib;
2+
using v2rayN.Enums;
23
using v2rayN.Models;
34

45
namespace v2rayN.Handler

v2rayN/v2rayN/Handler/UpdateHandle.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text;
77
using System.Text.RegularExpressions;
88
using System.Windows;
9+
using v2rayN.Enums;
910
using v2rayN.Models;
1011
using v2rayN.Resx;
1112

@@ -299,9 +300,6 @@ public void UpdateGeoFileAll(Config config, Action<bool, string> update)
299300
{
300301
await UpdateGeoFile("geosite", _config, update);
301302
await UpdateGeoFile("geoip", _config, update);
302-
303-
//await UpdateGeoFile4Singbox("geosite", _config, false, update);
304-
//await UpdateGeoFile4Singbox("geoip", _config, true, update);
305303
});
306304
}
307305

@@ -327,7 +325,7 @@ private async void CheckUpdateAsync(ECoreType type, bool preRelease)
327325
var result = await (new DownloadHandle()).DownloadStringAsync(url, true, "");
328326
if (!Utils.IsNullOrEmpty(result))
329327
{
330-
responseHandler(type, result, preRelease);
328+
ResponseHandler(type, result, preRelease);
331329
}
332330
else
333331
{
@@ -345,7 +343,7 @@ private async void CheckUpdateAsync(ECoreType type, bool preRelease)
345343
/// <summary>
346344
/// 获取V2RayCore版本
347345
/// </summary>
348-
private SemanticVersion getCoreVersion(ECoreType type)
346+
private SemanticVersion GetCoreVersion(ECoreType type)
349347
{
350348
try
351349
{
@@ -410,7 +408,7 @@ private SemanticVersion getCoreVersion(ECoreType type)
410408
}
411409
}
412410

413-
private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRelease)
411+
private void ResponseHandler(ECoreType type, string gitHubReleaseApi, bool preRelease)
414412
{
415413
try
416414
{
@@ -431,7 +429,7 @@ private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRe
431429
case ECoreType.Xray:
432430
case ECoreType.v2fly_v5:
433431
{
434-
curVersion = getCoreVersion(type);
432+
curVersion = GetCoreVersion(type);
435433
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
436434
string osBit = "64";
437435
switch (RuntimeInformation.ProcessArchitecture)
@@ -456,7 +454,7 @@ private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRe
456454
case ECoreType.clash_meta:
457455
case ECoreType.mihomo:
458456
{
459-
curVersion = getCoreVersion(type);
457+
curVersion = GetCoreVersion(type);
460458
message = string.Format(ResUI.IsLatestCore, type, curVersion);
461459
switch (RuntimeInformation.ProcessArchitecture)
462460
{
@@ -477,7 +475,7 @@ private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRe
477475
}
478476
case ECoreType.sing_box:
479477
{
480-
curVersion = getCoreVersion(type);
478+
curVersion = GetCoreVersion(type);
481479
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
482480
switch (RuntimeInformation.ProcessArchitecture)
483481
{

v2rayN/v2rayN/Models/Config.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace v2rayN.Models
1+
using v2rayN.Enums;
2+
3+
namespace v2rayN.Models
24
{
35
/// <summary>
46
/// 本软件配置文件实体类

v2rayN/v2rayN/Models/ConfigItems.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Windows.Input;
2+
using v2rayN.Enums;
23

34
namespace v2rayN.Models
45
{

0 commit comments

Comments
 (0)