mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-22 17:49:54 +08:00
Add ProxyMode
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace System.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// 代理模式
|
||||
/// </summary>
|
||||
public enum ProxyMode : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// 通过注入驱动实现 DNS 拦截进行代理 (Windows Only)
|
||||
/// </summary>
|
||||
DNSIntercept,
|
||||
|
||||
/// <summary>
|
||||
/// 修改 Hosts 文件进行代理 (Desktop Only)
|
||||
/// </summary>
|
||||
Hosts,
|
||||
|
||||
/// <summary>
|
||||
/// 系统代理模式
|
||||
/// </summary>
|
||||
System,
|
||||
|
||||
/// <summary>
|
||||
/// VPN 代理模式(虚拟网卡)
|
||||
/// </summary>
|
||||
VPN,
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Application.Services;
|
||||
using System.Application.UI;
|
||||
using System.Collections.Generic;
|
||||
using IPAddress = System.Net.IPAddress;
|
||||
using EProxyMode = System.Application.ProxyMode;
|
||||
|
||||
namespace System.Application.Settings
|
||||
{
|
||||
@@ -127,5 +128,27 @@ namespace System.Application.Settings
|
||||
= GetProperty(defaultValue: string.Empty, autoSave: false);
|
||||
|
||||
#endregion
|
||||
|
||||
static EProxyMode DefaultProxyMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (OperatingSystem2.IsWindows)
|
||||
{
|
||||
return EProxyMode.DNSIntercept;
|
||||
}
|
||||
else if (OperatingSystem2.IsAndroid)
|
||||
{
|
||||
return EProxyMode.VPN;
|
||||
}
|
||||
return EProxyMode.Hosts;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前代理模式
|
||||
/// </summary>
|
||||
public static SerializableProperty<EProxyMode> ProxyMode { get; }
|
||||
= GetProperty(defaultValue: DefaultProxyMode, autoSave: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user