From ca9840abf42fbfb079ea7b1c2a76a295a3299bdc Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 18 Apr 2020 13:21:47 +0800 Subject: [PATCH] code style --- v2rayN/v2rayN/Base/WebClientEx.cs | 5 +- v2rayN/v2rayN/Forms/OptionSettingForm.cs | 10 +- v2rayN/v2rayN/Global.cs | 40 +-- v2rayN/v2rayN/Handler/StatisticsHandler.cs | 10 +- .../v2rayN/HttpProxyHandler/PrivoxyHandler.cs | 5 +- v2rayN/v2rayN/Mode/Config.cs | 289 ++++-------------- v2rayN/v2rayN/Mode/ServerStatistics.cs | 35 +-- v2rayN/v2rayN/Mode/VmessQRCode.cs | 22 +- 8 files changed, 89 insertions(+), 327 deletions(-) diff --git a/v2rayN/v2rayN/Base/WebClientEx.cs b/v2rayN/v2rayN/Base/WebClientEx.cs index 096826cc..e581575c 100644 --- a/v2rayN/v2rayN/Base/WebClientEx.cs +++ b/v2rayN/v2rayN/Base/WebClientEx.cs @@ -5,10 +5,7 @@ namespace v2rayN.Base { class WebClientEx : WebClient { - public int Timeout - { - get; set; - } + public int Timeout { get; set; } public WebClientEx(int timeout = 3000) { Timeout = timeout; diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index 1d4394a8..4d16a860 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -458,13 +458,7 @@ namespace v2rayN.Forms class ComboItem { - public int ID - { - get; set; - } - public string Text - { - get; set; - } + public int ID { get; set; } + public string Text { get; set; } } } diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 862910fa..3d1e6137 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -173,59 +173,35 @@ namespace v2rayN /// /// 是否需要重启服务V2ray。如果为假,LoadV2ray()不做任何事。 /// - public static bool reloadV2ray - { - get; set; - } + public static bool reloadV2ray { get; set; } /// /// 是否开启全局代理(http) /// - public static bool sysAgent - { - get; set; - } + public static bool sysAgent { get; set; } /// /// socks端口 /// - public static int socksPort - { - get; set; - } + public static int socksPort { get; set; } /// /// http端口 /// - public static int httpPort - { - get; set; - } + public static int httpPort { get; set; } /// /// PAC端口 /// - public static int pacPort - { - get; set; - } + public static int pacPort { get; set; } /// /// /// - public static int statePort - { - get; set; - } + public static int statePort { get; set; } - public static Job processJob - { - get; set; - } - public static System.Threading.Mutex mutexObj - { - get; set; - } + public static Job processJob { get; set; } + public static System.Threading.Mutex mutexObj { get; set; } #endregion diff --git a/v2rayN/v2rayN/Handler/StatisticsHandler.cs b/v2rayN/v2rayN/Handler/StatisticsHandler.cs index ab4d4a6a..bed9298b 100644 --- a/v2rayN/v2rayN/Handler/StatisticsHandler.cs +++ b/v2rayN/v2rayN/Handler/StatisticsHandler.cs @@ -20,15 +20,9 @@ namespace v2rayN.Handler Action> updateFunc_; - public bool Enable - { - get; set; - } + public bool Enable { get; set; } - public bool UpdateUI - { - get; set; - } + public bool UpdateUI { get; set; } public List Statistic { diff --git a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs index f738a318..310054f0 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs @@ -55,10 +55,7 @@ namespace v2rayN.HttpProxyHandler } } - public int RunningPort - { - get; set; - } + public int RunningPort { get; set; } public void Restart(int localPort, Config config) { diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 0e213609..65f74893 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -15,205 +15,127 @@ namespace v2rayN.Mode /// /// 本地监听 /// - public List inbound - { - get; set; - } + public List inbound { get; set; } /// /// 允许日志 /// - public bool logEnabled - { - get; set; - } + public bool logEnabled { get; set; } /// /// 日志等级 /// - public string loglevel - { - get; set; - } + public string loglevel { get; set; } /// /// 活动配置序号 /// - public int index - { - get; set; - } + public int index { get; set; } /// /// vmess服务器信息 /// - public List vmess - { - get; set; - } + public List vmess { get; set; } /// /// 允许Mux多路复用 /// - public bool muxEnabled - { - get; set; - } + public bool muxEnabled { get; set; } /// /// 域名解析策略 /// - public string domainStrategy - { - get; set; - } + public string domainStrategy { get; set; } /// /// 路由模式 /// - public int routingMode - { - get; set; - } + public int routingMode { get; set; } /// /// 用户自定义需代理的网址或ip /// - public List useragent - { - get; set; - } + public List useragent { get; set; } /// /// 用户自定义直连的网址或ip /// - public List userdirect - { - get; set; - } + public List userdirect { get; set; } /// /// 用户自定义阻止的网址或ip /// - public List userblock - { - get; set; - } + public List userblock { get; set; } /// /// KcpItem /// - public KcpItem kcpItem - { - get; set; - } + public KcpItem kcpItem { get; set; } /// /// 监听状态 /// - public ListenerType listenerType - { - get; set; - } + public ListenerType listenerType { get; set; } /// /// 自定义服务器下载测速url /// - public string speedTestUrl - { - get; set; - } + public string speedTestUrl { get; set; } /// /// 自定义“服务器真连接延迟”测试url /// - public string speedPingTestUrl - { - get; set; - } + public string speedPingTestUrl { get; set; } /// /// 自定义GFWList url /// - public string urlGFWList - { - get; set; - } + public string urlGFWList { get; set; } /// /// 允许来自局域网的连接 /// - public bool allowLANConn - { - get; set; - } + public bool allowLANConn { get; set; } /// /// 启用实时网速和流量统计 /// - public bool enableStatistics - { - get; set; - } + public bool enableStatistics { get; set; } /// /// 去重时优先保留较旧(顶部)节点 /// - public bool keepOlderDedupl - { - get; set; - } + public bool keepOlderDedupl { get; set; } /// /// 服务器列表隔行着色 /// - public bool interlaceColoring - { - get; set; - } + public bool interlaceColoring { get; set; } /// /// 视图刷新率 /// - public int statisticsFreshRate - { - get; set; - } + public int statisticsFreshRate { get; set; } /// /// 自定义远程DNS /// - public string remoteDNS - { - get; set; - } + public string remoteDNS { get; set; } /// /// 是否允许不安全连接 /// - public string defaultAllowInsecure - { - get; set; - } + public string defaultAllowInsecure { get; set; } /// /// 订阅 /// - public List subItem - { - get; set; - } + public List subItem { get; set; } /// /// UI /// - public UIItem uiItem - { - get; set; - } + public UIItem uiItem { get; set; } - public List userPacRule - { - get; set; - } + public List userPacRule { get; set; } #region 函数 @@ -467,125 +389,77 @@ namespace v2rayN.Mode /// /// 版本(现在=2) /// - public int configVersion - { - get; set; - } + public int configVersion { get; set; } /// /// 远程服务器地址 /// - public string address - { - get; set; - } + public string address { get; set; } /// /// 远程服务器端口 /// - public int port - { - get; set; - } + public int port { get; set; } /// /// 远程服务器ID /// - public string id - { - get; set; - } + public string id { get; set; } /// /// 远程服务器额外ID /// - public int alterId - { - get; set; - } + public int alterId { get; set; } /// /// 本地安全策略 /// - public string security - { - get; set; - } + public string security { get; set; } /// /// tcp,kcp,ws,h2,quic /// - public string network - { - get; set; - } + public string network { get; set; } /// /// 备注或别名 /// - public string remarks - { - get; set; - } + public string remarks { get; set; } /// /// 伪装类型 /// - public string headerType - { - get; set; - } + public string headerType { get; set; } /// /// 伪装的域名 /// - public string requestHost - { - get; set; - } + public string requestHost { get; set; } /// /// ws h2 path /// - public string path - { - get; set; - } + public string path { get; set; } /// /// 底层传输安全 /// - public string streamSecurity - { - get; set; - } + public string streamSecurity { get; set; } /// /// 是否允许不安全连接(用于客户端) /// - public string allowInsecure - { - get; set; - } + public string allowInsecure { get; set; } /// /// config type(1=normal,2=custom) /// - public int configType - { - get; set; - } + public int configType { get; set; } /// /// /// - public string testResult - { - get; set; - } + public string testResult { get; set; } /// /// SubItem id /// - public string subid - { - get; set; - } + public string subid { get; set; } } [Serializable] @@ -594,26 +468,17 @@ namespace v2rayN.Mode /// /// 本地监听端口 /// - public int localPort - { - get; set; - } + public int localPort { get; set; } /// /// 协议,默认为socks /// - public string protocol - { - get; set; - } + public string protocol { get; set; } /// /// 允许udp /// - public bool udpEnabled - { - get; set; - } + public bool udpEnabled { get; set; } /// /// 开启流量探测 @@ -627,52 +492,31 @@ namespace v2rayN.Mode /// /// /// - public int mtu - { - get; set; - } + public int mtu { get; set; } /// /// /// - public int tti - { - get; set; - } + public int tti { get; set; } /// /// /// - public int uplinkCapacity - { - get; set; - } + public int uplinkCapacity { get; set; } /// /// /// - public int downlinkCapacity - { - get; set; - } + public int downlinkCapacity { get; set; } /// /// /// - public bool congestion - { - get; set; - } + public bool congestion { get; set; } /// /// /// - public int readBufferSize - { - get; set; - } + public int readBufferSize { get; set; } /// /// /// - public int writeBufferSize - { - get; set; - } + public int writeBufferSize { get; set; } } @@ -682,27 +526,15 @@ namespace v2rayN.Mode /// /// /// - public string id - { - get; set; - } - + public string id { get; set; } /// /// 备注 /// - public string remarks - { - get; set; - } - + public string remarks { get; set; } /// /// url /// - public string url - { - get; set; - } - + public string url { get; set; } /// /// enable /// @@ -714,14 +546,7 @@ namespace v2rayN.Mode { - public System.Drawing.Size mainSize - { - get; set; - } - - public Dictionary mainLvColWidth - { - get; set; - } + public System.Drawing.Size mainSize { get; set; } + public Dictionary mainLvColWidth { get; set; } } } diff --git a/v2rayN/v2rayN/Mode/ServerStatistics.cs b/v2rayN/v2rayN/Mode/ServerStatistics.cs index e4a42a5a..f6c655d2 100644 --- a/v2rayN/v2rayN/Mode/ServerStatistics.cs +++ b/v2rayN/v2rayN/Mode/ServerStatistics.cs @@ -6,38 +6,17 @@ namespace v2rayN.Mode [Serializable] public class ServerStatistics { - public List server - { - get; set; - } + public List server { get; set; } } [Serializable] public class ServerStatItem { - public string itemId - { - get; set; - } - public ulong totalUp - { - get; set; - } - public ulong totalDown - { - get; set; - } - public ulong todayUp - { - get; set; - } - public ulong todayDown - { - get; set; - } - public long dateNow - { - get; set; - } + public string itemId { get; set; } + public ulong totalUp { get; set; } + public ulong totalDown { get; set; } + public ulong todayUp { get; set; } + public ulong todayDown { get; set; } + public long dateNow { get; set; } } } diff --git a/v2rayN/v2rayN/Mode/VmessQRCode.cs b/v2rayN/v2rayN/Mode/VmessQRCode.cs index 0a9cc8ab..4c5cb520 100644 --- a/v2rayN/v2rayN/Mode/VmessQRCode.cs +++ b/v2rayN/v2rayN/Mode/VmessQRCode.cs @@ -8,46 +8,46 @@ namespace v2rayN.Mode /// /// 版本 /// - public string v { get; set; } = string.Empty; + public string v { get; set; } /// /// 备注 /// - public string ps { get; set; } = string.Empty; + public string ps { get; set; } /// /// 远程服务器地址 /// - public string add { get; set; } = string.Empty; + public string add { get; set; } /// /// 远程服务器端口 /// - public string port { get; set; } = string.Empty; + public string port { get; set; } /// /// 远程服务器ID /// - public string id { get; set; } = string.Empty; + public string id { get; set; } /// /// 远程服务器额外ID /// - public string aid { get; set; } = string.Empty; + public string aid { get; set; } /// /// 传输协议tcp,kcp,ws /// - public string net { get; set; } = string.Empty; + public string net { get; set; } /// /// 伪装类型 /// - public string type { get; set; } = string.Empty; + public string type { get; set; } /// /// 伪装的域名 /// - public string host { get; set; } = string.Empty; + public string host { get; set; } /// /// path /// - public string path { get; set; } = string.Empty; + public string path { get; set; } /// /// 底层传输安全 /// - public string tls { get; set; } = string.Empty; + public string tls { get; set; } } }