Compare commits

..

24 Commits
6.20 ... 6.21

Author SHA1 Message Date
2dust
2e64f23ef9 up 6.21 2023-04-07 11:03:23 +08:00
2dust
801d1fd320 clean up res 2023-04-07 10:16:05 +08:00
2dust
cfffb5756e Update ResUI.zh-Hans.resx 2023-04-06 20:39:40 +08:00
2dust
b30daf8e56 Add more subscription url for one group 2023-04-06 15:09:49 +08:00
2dust
84eba671f0 Optimize add batch servers 2023-04-06 11:40:28 +08:00
2dust
f28b93daa0 Use H.NotifyIcon.Wpf 2023-04-06 10:44:58 +08:00
2dust
dc16136c59 Add Reboot as administrator 2023-04-06 10:44:29 +08:00
2dust
e47caf8c4f VLESS flow check 2023-04-05 21:07:47 +08:00
2dust
8ad80bb75d Remove System.Windows.Forms references 2023-04-05 20:53:05 +08:00
2dust
22475e459d Remove the function of minimizing at startup, because it affects the startup position 2023-04-05 09:43:33 +08:00
2dust
73ad33dfc9 Merge pull request #3611 from fonaix/master
fix bug #3218  and optimize the background color display effect of the active row
2023-04-05 08:23:33 +08:00
fonaix
f1782c78f4 fix bug #3218 2023-04-05 00:57:30 +08:00
fonaix
b544dde2c6 Optimize the background color display effect of the active row 2023-04-04 23:39:56 +08:00
2dust
1a7dca8e58 Fix subscription update duplicate server bug 2023-04-04 20:19:52 +08:00
2dust
23c7d7fb46 Remove some System.Windows.Forms references 2023-04-04 15:59:28 +08:00
2dust
65fda407dc RemoveSystem.Windows.Forms references 2023-04-04 15:59:08 +08:00
2dust
12ebad436a Autofit Column Width 2023-04-04 13:30:29 +08:00
2dust
c7297dba7e Merge pull request #3598 from JasonWues/master
当前选中节点标识改为背景颜色更改
2023-04-04 10:31:56 +08:00
2dust
e61368a26e Remove some System.Windows.Forms references 2023-04-04 10:22:13 +08:00
2dust
b98da3a5dc Optimized move to group 2023-04-04 10:21:12 +08:00
2dust
12f3400894 Subscription multi-select delete 2023-04-04 10:20:19 +08:00
Metatron
4b5508fc3c Style change 2023-04-03 14:43:30 +08:00
Metatron
5f40e6e0b7 fix 2023-04-03 10:50:56 +08:00
Metatron
080d660cfa Select row background change 2023-04-03 10:45:21 +08:00
35 changed files with 381 additions and 593 deletions

View File

@@ -30,8 +30,9 @@ namespace v2rayN
{
Global.ExePathKey = Utils.GetMD5(Utils.GetExePath());
var rebootas = (e.Args ?? new string[] { }).Any(t => t == Global.RebootAs);
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, Global.ExePathKey, out bool bCreatedNew);
if (!bCreatedNew)
if (!rebootas && !bCreatedNew)
{
ProgramStarted.Set();
Current.Shutdown();

View File

@@ -80,6 +80,7 @@
public const string DelayUnit = "";
public const string SpeedUnit = "";
public const int MinFontSize = 10;
public const string RebootAs = "rebootas";
public static readonly List<string> IEProxyProtocols = new() {
"{ip}:{http_port}",

View File

@@ -795,6 +795,11 @@ namespace v2rayN.Handler
profileItem.path = profileItem.path.TrimEx();
profileItem.streamSecurity = profileItem.streamSecurity.TrimEx();
if (!Global.flows.Contains(profileItem.flow))
{
return -1;
}
AddServerCommon(ref config, profileItem, toFile);
return 0;
@@ -933,12 +938,14 @@ namespace v2rayN.Handler
}
int countServers = 0;
//Check for duplicate indexId
List<string>? lstDbIndexId = null;
List<ProfileItem> lstAdd = new();
string[] arrData = clipboardData.Split(Environment.NewLine.ToCharArray());
foreach (string str in arrData)
{
//maybe sub
if (Utils.IsNullOrEmpty(subid) && (str.StartsWith(Global.httpsProtocol) || str.StartsWith(Global.httpProtocol)))
if (!isSub && (str.StartsWith(Global.httpsProtocol) || str.StartsWith(Global.httpProtocol)))
{
if (AddSubItem(ref config, str) == 0)
{
@@ -958,7 +965,20 @@ namespace v2rayN.Handler
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub && CompareProfileItem(t, profileItem, true));
if (existItem != null)
{
profileItem.indexId = existItem.indexId;
//Check for duplicate indexId
if (lstDbIndexId is null)
{
lstDbIndexId = LazyConfig.Instance.ProfileItemIndexs("");
}
if (lstAdd.Any(t => t.indexId == existItem.indexId)
|| lstDbIndexId.Any(t => t == existItem.indexId))
{
profileItem.indexId = string.Empty;
}
else
{
profileItem.indexId = existItem.indexId;
}
}
//filter
if (!Utils.IsNullOrEmpty(subFilter))
@@ -1167,7 +1187,15 @@ namespace v2rayN.Handler
lstOriSub = LazyConfig.Instance.ProfileItems(subid);
}
int counter = AddBatchServers(ref config, clipboardData, subid, isSub, lstOriSub);
var counter = 0;
if (Utils.IsBase64String(clipboardData))
{
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
}
if (counter < 1)
{
counter = AddBatchServers(ref config, clipboardData, subid, isSub, lstOriSub);
}
if (counter < 1)
{
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
@@ -1287,17 +1315,11 @@ namespace v2rayN.Handler
public static int MoveToGroup(Config config, List<ProfileItem> lstProfile, string subid)
{
foreach (var it in lstProfile)
foreach (var item in lstProfile)
{
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
if (item is null)
{
continue;
}
item.subid = subid;
SqliteHelper.Instance.Update(item);
}
SqliteHelper.Instance.UpdateAll(lstProfile);
return 0;
}

View File

@@ -1465,6 +1465,11 @@ namespace v2rayN.Handler
{
continue;
}
if (item.configType == EConfigType.VLESS
&& !Global.flows.Contains(item.flow))
{
continue;
}
outbound(item, ref v2rayConfigCopy);
v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();

View File

@@ -1,7 +1,7 @@

using Microsoft.Win32;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using v2rayN.Mode;
using v2rayN.Resx;
@@ -142,7 +142,7 @@ namespace v2rayN.Handler
FilterIndex = 2,
RestoreDirectory = true
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}
@@ -181,7 +181,7 @@ namespace v2rayN.Handler
FilterIndex = 2,
RestoreDirectory = true
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}
@@ -218,7 +218,7 @@ namespace v2rayN.Handler
FilterIndex = 2,
RestoreDirectory = true
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}
@@ -246,22 +246,22 @@ namespace v2rayN.Handler
public bool RestoreGuiNConfig(ref Config config)
{
var fileContent = string.Empty;
using (OpenFileDialog fileDialog = new())
{
fileDialog.InitialDirectory = Utils.GetBackupPath("");
fileDialog.Filter = "guiNConfig|*.json|All|*.*";
fileDialog.FilterIndex = 2;
fileDialog.RestoreDirectory = true;
OpenFileDialog fileDialog = new();
if (fileDialog.ShowDialog() == DialogResult.OK)
{
fileContent = Utils.LoadResource(fileDialog.FileName);
}
else
{
return false;
}
fileDialog.InitialDirectory = Utils.GetBackupPath("");
fileDialog.Filter = "guiNConfig|*.json|All|*.*";
fileDialog.FilterIndex = 2;
fileDialog.RestoreDirectory = true;
if (fileDialog.ShowDialog() == true)
{
fileContent = Utils.LoadResource(fileDialog.FileName);
}
else
{
return false;
}
if (Utils.IsNullOrEmpty(fileContent))
{
UI.ShowWarning(ResUI.OperationFailed);

View File

@@ -49,7 +49,7 @@ namespace v2rayN.Handler
VmessQRCode vmessQRCode = new()
{
v = item.configVersion.ToString(),
ps = item.remarks.TrimEx(), //备注也许很长 ;
ps = item.remarks.TrimEx(),
add = item.address,
port = item.port.ToString(),
id = item.id,

View File

@@ -1,9 +1,10 @@
using Splat;
using DynamicData;
using Splat;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Windows;
using v2rayN.Base;
using v2rayN.Mode;
using v2rayN.Resx;
@@ -163,16 +164,6 @@ namespace v2rayN.Handler
Task.Run(async () =>
{
//Turn off system proxy
//bool bSysProxyType = false;
//if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange)
//{
// bSysProxyType = true;
// config.sysProxyType = ESysProxyType.ForcedClear;
// SysProxyHandle.UpdateSysProxy(config, false);
// Thread.Sleep(3000);
//}
foreach (var item in subItem)
{
string id = item.id.TrimEx();
@@ -196,16 +187,55 @@ namespace v2rayN.Handler
_updateFunc(false, $"{hashCode}{args.GetException().Message}");
};
//idn to idc
url = Utils.GetPunycode(url);
_updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
//one url
url = Utils.GetPunycode(url);
var result = await downloadHandle.TryDownloadString(url, blProxy, userAgent);
if (blProxy && Utils.IsNullOrEmpty(result))
{
result = await downloadHandle.TryDownloadString(url, false, userAgent);
}
//more url
if (!Utils.IsNullOrEmpty(item.moreUrl.TrimEx()))
{
if (!Utils.IsNullOrEmpty(result) && Utils.IsBase64String(result))
{
result = Utils.Base64Decode(result);
}
var lstUrl = new List<string>
{
item.moreUrl.TrimEx().Split(",")
};
foreach (var it in lstUrl)
{
var url2 = Utils.GetPunycode(it);
if (Utils.IsNullOrEmpty(url2))
{
continue;
}
var result2 = await downloadHandle.TryDownloadString(url2, blProxy, userAgent);
if (blProxy && Utils.IsNullOrEmpty(result2))
{
result2 = await downloadHandle.TryDownloadString(url2, false, userAgent);
}
if (!Utils.IsNullOrEmpty(result2))
{
if (Utils.IsBase64String(result2))
{
result += Utils.Base64Decode(result2);
}
else
{
result += result2;
}
}
}
}
if (Utils.IsNullOrEmpty(result))
{
_updateFunc(false, $"{hashCode}{ResUI.MsgSubscriptionDecodingFailed}");
@@ -231,18 +261,12 @@ namespace v2rayN.Handler
}
_updateFunc(false, "-------------------------------------------------------");
}
////restore system proxy
//if (bSysProxyType)
//{
// config.sysProxyType = ESysProxyType.ForcedChange;
// SysProxyHandle.UpdateSysProxy(config, false);
//}
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
});
}
public void UpdateGeoFile(string geoName, Config config, Action<bool, string> update)
{
_config = config;
@@ -479,7 +503,7 @@ namespace v2rayN.Handler
bool blDownload = false;
if (blAsk)
{
if (UI.ShowYesNo(string.Format(ResUI.DownloadYesNo, url)) == DialogResult.Yes)
if (UI.ShowYesNo(string.Format(ResUI.DownloadYesNo, url)) == MessageBoxResult.Yes)
{
blDownload = true;
}

View File

@@ -301,7 +301,7 @@
get; set;
}
/// <summary>
/// 备注或别名
///
/// </summary>
public string remarks
{

View File

@@ -0,0 +1,9 @@
namespace v2rayN.Mode
{
public enum EViewAction
{
AdjustMainLvColWidth,
ProfilesFocus
}
}

View File

@@ -121,7 +121,7 @@ namespace v2rayN.Mode
/// </summary>
public string network { get; set; }
/// <summary>
/// 备注或别名
///
/// </summary>
public string remarks { get; set; }

View File

@@ -6,45 +6,20 @@ namespace v2rayN.Mode
public class SubItem
{
[PrimaryKey]
public string id
{
get; set;
}
public string id { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remarks
{
get; set;
}
public string remarks { get; set; }
/// <summary>
/// url
/// </summary>
public string url
{
get; set;
}
public string url { get; set; }
public string moreUrl { get; set; }
/// <summary>
/// enable
/// </summary>
public bool enabled { get; set; } = true;
/// <summary>
///
/// </summary>
public string userAgent
{
get; set;
} = string.Empty;
public string userAgent { get; set; } = string.Empty;
public int sort { get; set; }
public int sort
{
get; set;
}
public string filter { get; set; }
}

View File

@@ -366,15 +366,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Alias 的本地化字符串。
/// </summary>
public static string LvAlias {
get {
return ResourceManager.GetString("LvAlias", resourceCulture);
}
}
/// <summary>
/// 查找类似 Count 的本地化字符串。
/// </summary>
@@ -420,6 +411,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 More urls, separated by commas 的本地化字符串。
/// </summary>
public static string LvMoreUrl {
get {
return ResourceManager.GetString("LvMoreUrl", resourceCulture);
}
}
/// <summary>
/// 查找类似 Port 的本地化字符串。
/// </summary>
@@ -474,15 +474,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Test Results 的本地化字符串。
/// </summary>
public static string LvTestResults {
get {
return ResourceManager.GetString("LvTestResults", resourceCulture);
}
}
/// <summary>
/// 查找类似 Speed(M/s) 的本地化字符串。
/// </summary>
@@ -564,15 +555,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Medium 的本地化字符串。
/// </summary>
public static string MediumFresh {
get {
return ResourceManager.GetString("MediumFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Add a custom configuration server 的本地化字符串。
/// </summary>
@@ -933,6 +915,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Reboot as administrator 的本地化字符串。
/// </summary>
public static string menuRebootAsAdmin {
get {
return ResourceManager.GetString("menuRebootAsAdmin", resourceCulture);
}
}
/// <summary>
/// 查找类似 Reload 的本地化字符串。
/// </summary>
@@ -1401,24 +1392,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 PAC update failed 的本地化字符串。
/// </summary>
public static string MsgPACUpdateFailed {
get {
return ResourceManager.GetString("MsgPACUpdateFailed", resourceCulture);
}
}
/// <summary>
/// 查找类似 PAC update succeeded 的本地化字符串。
/// </summary>
public static string MsgPACUpdateSuccessfully {
get {
return ResourceManager.GetString("MsgPACUpdateSuccessfully", resourceCulture);
}
}
/// <summary>
/// 查找类似 Resolve {0} successfully 的本地化字符串。
/// </summary>
@@ -1437,15 +1410,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Simplify PAC Success 的本地化字符串。
/// </summary>
public static string MsgSimplifyPAC {
get {
return ResourceManager.GetString("MsgSimplifyPAC", resourceCulture);
}
}
/// <summary>
/// 查找类似 Updates are not enabled, skip this subscription 的本地化字符串。
/// </summary>
@@ -1473,15 +1437,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Start updating PAC... 的本地化字符串。
/// </summary>
public static string MsgStartUpdatingPAC {
get {
return ResourceManager.GetString("MsgStartUpdatingPAC", resourceCulture);
}
}
/// <summary>
/// 查找类似 Invalid subscription content 的本地化字符串。
/// </summary>
@@ -1536,24 +1491,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 This feature relies on the Http global proxy, please set it correctly first. 的本地化字符串。
/// </summary>
public static string NeedHttpGlobalProxy {
get {
return ResourceManager.GetString("NeedHttpGlobalProxy", resourceCulture);
}
}
/// <summary>
/// 查找类似 Normal use of this version requires .NET Framework 4.8 的本地化字符串。
/// </summary>
public static string NetFrameworkRequirementsTip {
get {
return ResourceManager.GetString("NetFrameworkRequirementsTip", resourceCulture);
}
}
/// <summary>
/// 查找类似 Non-VMess or ss protocol 的本地化字符串。
/// </summary>
@@ -1662,15 +1599,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Fast 的本地化字符串。
/// </summary>
public static string QuickFresh {
get {
return ResourceManager.GetString("QuickFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Global hotkey {0} registered failed, reason {1} 的本地化字符串。
/// </summary>
@@ -1753,20 +1681,11 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Slow 的本地化字符串。
/// 查找类似 {0}:{1}/s↑ | {2}/s↓ 的本地化字符串。
/// </summary>
public static string SlowFresh {
public static string SpeedDisplayText {
get {
return ResourceManager.GetString("SlowFresh", resourceCulture);
}
}
/// <summary>
/// 查找类似 Note: This feature relies on the Http global proxy. Please manually adjust the Http global proxy and active node after testing. 的本地化字符串。
/// </summary>
public static string SpeedServerTips {
get {
return ResourceManager.GetString("SpeedServerTips", resourceCulture);
return ResourceManager.GetString("SpeedDisplayText", resourceCulture);
}
}
@@ -1806,15 +1725,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 PAC failed to start. Please run this program as Administrator. 的本地化字符串。
/// </summary>
public static string StartPacFailed {
get {
return ResourceManager.GetString("StartPacFailed", resourceCulture);
}
}
/// <summary>
/// 查找类似 Start service ({0})... 的本地化字符串。
/// </summary>
@@ -2347,15 +2257,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Automatic latency test interval (minutes) 的本地化字符串。
/// </summary>
public static string TbSettingsAutoTest {
get {
return ResourceManager.GetString("TbSettingsAutoTest", resourceCulture);
}
}
/// <summary>
/// 查找类似 Automatic update interval of subscriptions (hours) 的本地化字符串。
/// </summary>
@@ -2581,15 +2482,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Enable IPv6 的本地化字符串。
/// </summary>
public static string TbSettingsIpv6 {
get {
return ResourceManager.GetString("TbSettingsIpv6", resourceCulture);
}
}
/// <summary>
/// 查找类似 Keep older when deduplication 的本地化字符串。
/// </summary>
@@ -2653,15 +2545,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Pac listen port 的本地化字符串。
/// </summary>
public static string TbSettingsPacListenPort {
get {
return ResourceManager.GetString("TbSettingsPacListenPort", resourceCulture);
}
}
/// <summary>
/// 查找类似 Auth pass 的本地化字符串。
/// </summary>
@@ -2689,15 +2572,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 After modifying the following parameters, click Save to take effect 的本地化字符串。
/// </summary>
public static string TbSettingsSaveTip {
get {
return ResourceManager.GetString("TbSettingsSaveTip", resourceCulture);
}
}
/// <summary>
/// 查找类似 Set Win10 UWP Loopback 的本地化字符串。
/// </summary>

View File

@@ -195,9 +195,6 @@
<data name="LvAddress" xml:space="preserve">
<value>آدرس</value>
</data>
<data name="LvAlias" xml:space="preserve">
<value>Alias</value>
</data>
<data name="LvEncryptionMethod" xml:space="preserve">
<value>امنیت</value>
</data>
@@ -210,9 +207,6 @@
<data name="LvSubscription" xml:space="preserve">
<value>گروه فرعی</value>
</data>
<data name="LvTestResults" xml:space="preserve">
<value>نتایج تست</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value> ترافیک دانلود امروز</value>
</data>
@@ -228,9 +222,6 @@
<data name="LvTransportProtocol" xml:space="preserve">
<value>جابجایی</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>متوسط</value>
</data>
<data name="MsgClearSubscription" xml:space="preserve">
<value>محتوای اشتراک اصلی را پاک کنید</value>
</data>
@@ -246,27 +237,15 @@
<data name="MsgNoValidSubscription" xml:space="preserve">
<value>هیچ اشتراک معتبری تنظیم نشده است</value>
</data>
<data name="MsgPACUpdateFailed" xml:space="preserve">
<value>به روز رسانی PAC ناموفق بود</value>
</data>
<data name="MsgPACUpdateSuccessfully" xml:space="preserve">
<value>به روز رسانی PAC با موفقیت انجام شد</value>
</data>
<data name="MsgParsingSuccessfully" xml:space="preserve">
<value>Resolve {0} successfully</value>
</data>
<data name="MsgSimplifyPAC" xml:space="preserve">
<value>Simplify PAC Success</value>
</data>
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
<value>شروع به دریافت اشتراک شد</value>
</data>
<data name="MsgStartUpdating" xml:space="preserve">
<value>شروع بروزرسانی {0}...</value>
</data>
<data name="MsgStartUpdatingPAC" xml:space="preserve">
<value>شروع بروزرسانی PAC...</value>
</data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>محتوای اشتراک نامعتبر است</value>
</data>
@@ -285,9 +264,6 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>هسته با موفقیت بروزرسانی شد! راه اندازی مجدد سرویس...</value>
</data>
<data name="NeedHttpGlobalProxy" xml:space="preserve">
<value> This feature relies on the Http global proxy, please set it correctly first.</value>
</data>
<data name="NonvmessOrssProtocol" xml:space="preserve">
<value>Non-VMess or ss protocol</value>
</data>
@@ -315,9 +291,6 @@
<data name="PleaseSelectServer" xml:space="preserve">
<value>لطفا ابتدا سرور را انتخاب کنید</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>سریع</value>
</data>
<data name="RemoveDuplicateServerResult" xml:space="preserve">
<value>Servers deduplication completed. Old: {0}, New: {1}.</value>
</data>
@@ -330,15 +303,6 @@
<data name="SaveServerConfigurationIn" xml:space="preserve">
<value>The server configuration file is saved at: {0}</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>آهسته. تدریجی</value>
</data>
<data name="SpeedServerTips" xml:space="preserve">
<value>توجه: این ویژگی به پروکسی جهانی Http متکی است. لطفاً پس از آزمایش، پراکسی جهانی Http و گره فعال را به صورت دستی تنظیم کنید.</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC شروع نشد. لطفا این برنامه را به عنوان Administrator اجرا کنید.</value>
</data>
<data name="StartService" xml:space="preserve">
<value>Start service ({0})...</value>
</data>
@@ -472,9 +436,6 @@
<data name="MsgServerTitle" xml:space="preserve">
<value>فیلتر سرورها</value>
</data>
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
<value>استفاده معمولی از این نسخه به .NET Framework 4.8 نیاز دارد</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>بررسی بروزرسانی</value>
</data>
@@ -763,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoTest" xml:space="preserve">
<value>فاصله تست تأخیر خودکار (دقیقه)</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>فاصله به روز رسانی خودکار اشتراک ها (ساعت)</value>
</data>
@@ -808,9 +766,6 @@
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>هنگام به‌روزرسانی هسته، فایل‌های Geo را نادیده بگیرید</value>
</data>
<data name="TbSettingsIpv6" xml:space="preserve">
<value>IPv6 را فعال کنید</value>
</data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Keep older when deduplication</value>
</data>
@@ -826,18 +781,12 @@
<data name="TbSettingsN" xml:space="preserve">
<value>تنظیمات v2rayN</value>
</data>
<data name="TbSettingsPacListenPort" xml:space="preserve">
<value>Pac پورت درحال شنود</value>
</data>
<data name="TbSettingsPass" xml:space="preserve">
<value>Auth pass</value>
</data>
<data name="TbSettingsRemoteDNS" xml:space="preserve">
<value>سفارشی DNS (multiple, separated by commas (,))</value>
</data>
<data name="TbSettingsSaveTip" xml:space="preserve">
<value>After modifying the following parameters, click Save to take effect</value>
</data>
<data name="TbSettingsSetUWP" xml:space="preserve">
<value>Set Win10 UWP Loopback</value>
</data>

View File

@@ -195,9 +195,6 @@
<data name="LvAddress" xml:space="preserve">
<value>Address</value>
</data>
<data name="LvAlias" xml:space="preserve">
<value>Alias</value>
</data>
<data name="LvEncryptionMethod" xml:space="preserve">
<value>Security</value>
</data>
@@ -210,9 +207,6 @@
<data name="LvSubscription" xml:space="preserve">
<value>Subs group</value>
</data>
<data name="LvTestResults" xml:space="preserve">
<value>Test Results</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>Download traffic today</value>
</data>
@@ -228,9 +222,6 @@
<data name="LvTransportProtocol" xml:space="preserve">
<value>Transport</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>Medium</value>
</data>
<data name="MsgClearSubscription" xml:space="preserve">
<value>Clear original subscription content</value>
</data>
@@ -246,27 +237,15 @@
<data name="MsgNoValidSubscription" xml:space="preserve">
<value>No valid subscriptions set</value>
</data>
<data name="MsgPACUpdateFailed" xml:space="preserve">
<value>PAC update failed</value>
</data>
<data name="MsgPACUpdateSuccessfully" xml:space="preserve">
<value>PAC update succeeded</value>
</data>
<data name="MsgParsingSuccessfully" xml:space="preserve">
<value>Resolve {0} successfully</value>
</data>
<data name="MsgSimplifyPAC" xml:space="preserve">
<value>Simplify PAC Success</value>
</data>
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
<value>Start getting subscriptions</value>
</data>
<data name="MsgStartUpdating" xml:space="preserve">
<value>Start updating {0}...</value>
</data>
<data name="MsgStartUpdatingPAC" xml:space="preserve">
<value>Start updating PAC...</value>
</data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>Invalid subscription content</value>
</data>
@@ -285,9 +264,6 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>Update Core successfully! Restarting service...</value>
</data>
<data name="NeedHttpGlobalProxy" xml:space="preserve">
<value> This feature relies on the Http global proxy, please set it correctly first.</value>
</data>
<data name="NonvmessOrssProtocol" xml:space="preserve">
<value>Non-VMess or ss protocol</value>
</data>
@@ -315,9 +291,6 @@
<data name="PleaseSelectServer" xml:space="preserve">
<value>Please select the server first</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>Fast</value>
</data>
<data name="RemoveDuplicateServerResult" xml:space="preserve">
<value>Servers deduplication completed. Old: {0}, New: {1}.</value>
</data>
@@ -330,15 +303,6 @@
<data name="SaveServerConfigurationIn" xml:space="preserve">
<value>The server configuration file is saved at: {0}</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>Slow</value>
</data>
<data name="SpeedServerTips" xml:space="preserve">
<value>Note: This feature relies on the Http global proxy. Please manually adjust the Http global proxy and active node after testing.</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC failed to start. Please run this program as Administrator.</value>
</data>
<data name="StartService" xml:space="preserve">
<value>Start service ({0})...</value>
</data>
@@ -472,9 +436,6 @@
<data name="MsgServerTitle" xml:space="preserve">
<value>Servers Filter</value>
</data>
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
<value>Normal use of this version requires .NET Framework 4.8</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>Check Update</value>
</data>
@@ -763,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoTest" xml:space="preserve">
<value>Automatic latency test interval (minutes)</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>Automatic update interval of subscriptions (hours)</value>
</data>
@@ -808,9 +766,6 @@
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Ignore Geo files when updating core</value>
</data>
<data name="TbSettingsIpv6" xml:space="preserve">
<value>Enable IPv6</value>
</data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Keep older when deduplication</value>
</data>
@@ -826,18 +781,12 @@
<data name="TbSettingsN" xml:space="preserve">
<value>v2rayN settings</value>
</data>
<data name="TbSettingsPacListenPort" xml:space="preserve">
<value>Pac listen port</value>
</data>
<data name="TbSettingsPass" xml:space="preserve">
<value>Auth pass</value>
</data>
<data name="TbSettingsRemoteDNS" xml:space="preserve">
<value>Custom DNS (multiple, separated by commas (,))</value>
</data>
<data name="TbSettingsSaveTip" xml:space="preserve">
<value>After modifying the following parameters, click Save to take effect</value>
</data>
<data name="TbSettingsSetUWP" xml:space="preserve">
<value>Set Win10 UWP Loopback</value>
</data>
@@ -1153,4 +1102,13 @@
<data name="MsgSkipSubscriptionUpdate" xml:space="preserve">
<value>Updates are not enabled, skip this subscription</value>
</data>
<data name="menuRebootAsAdmin" xml:space="preserve">
<value>Reboot as administrator</value>
</data>
<data name="LvMoreUrl" xml:space="preserve">
<value>More urls, separated by commas</value>
</data>
<data name="SpeedDisplayText" xml:space="preserve">
<value>{0}:{1}/s↑ | {2}/s↓</value>
</data>
</root>

View File

@@ -195,9 +195,6 @@
<data name="LvAddress" xml:space="preserve">
<value>Адрес</value>
</data>
<data name="LvAlias" xml:space="preserve">
<value>Псевдоним</value>
</data>
<data name="LvEncryptionMethod" xml:space="preserve">
<value>Безопасность</value>
</data>
@@ -210,9 +207,6 @@
<data name="LvSubscription" xml:space="preserve">
<value>Группа подписки</value>
</data>
<data name="LvTestResults" xml:space="preserve">
<value>Результаты тестирования</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>Загружено трафика сегодня</value>
</data>
@@ -228,9 +222,6 @@
<data name="LvTransportProtocol" xml:space="preserve">
<value>Протокол</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>Medium</value>
</data>
<data name="MsgClearSubscription" xml:space="preserve">
<value>Очистить контент оригинальной подписки</value>
</data>
@@ -246,27 +237,15 @@
<data name="MsgNoValidSubscription" xml:space="preserve">
<value>Нет установлены подписки</value>
</data>
<data name="MsgPACUpdateFailed" xml:space="preserve">
<value>Ошибка обновления PAC</value>
</data>
<data name="MsgPACUpdateSuccessfully" xml:space="preserve">
<value>PAC успешно обновлен</value>
</data>
<data name="MsgParsingSuccessfully" xml:space="preserve">
<value>Парсинг {0} прошел успешно</value>
</data>
<data name="MsgSimplifyPAC" xml:space="preserve">
<value>Упрощение PAC прошло успешно</value>
</data>
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
<value>Начинаю получать подписки</value>
</data>
<data name="MsgStartUpdating" xml:space="preserve">
<value>Начинаю обновление {0}...</value>
</data>
<data name="MsgStartUpdatingPAC" xml:space="preserve">
<value>Начинаю обновление PAC...</value>
</data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>Некорректное содержимое подписки</value>
</data>
@@ -285,9 +264,6 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>Успешное обновление ядра! Перезапуск службы...</value>
</data>
<data name="NeedHttpGlobalProxy" xml:space="preserve">
<value>Эта функция зависит от глобального прокси-сервера HTTP, пожалуйста, сначала установите его правильно.</value>
</data>
<data name="NonvmessOrssProtocol" xml:space="preserve">
<value>Не является протоколом Vmess или SS</value>
</data>
@@ -315,9 +291,6 @@
<data name="PleaseSelectServer" xml:space="preserve">
<value>Сначала выберите сервер</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>Быстрый</value>
</data>
<data name="RemoveDuplicateServerResult" xml:space="preserve">
<value>Удаление дублей завершено. Старая: {0}, Новая: {1}.</value>
</data>
@@ -330,15 +303,6 @@
<data name="SaveServerConfigurationIn" xml:space="preserve">
<value>Файл конфигурации сервера сохранен по адресу: {0}</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>Медленный</value>
</data>
<data name="SpeedServerTips" xml:space="preserve">
<value>Примечание. Эта функция зависит от глобального прокси-сервера HTTP. После тестирования вручную настройте глобальный прокси-сервер HTTP и активный узел.</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC не удалось запустить. Пожалуйста, запустите эту программу от имени администратора.</value>
</data>
<data name="StartService" xml:space="preserve">
<value>Запуск сервиса ({0})...</value>
</data>
@@ -472,9 +436,6 @@
<data name="MsgServerTitle" xml:space="preserve">
<value>Фильтр серверов</value>
</data>
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
<value>Для корректной работы требуется .NET Framework 4.8</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>Проверить обновления</value>
</data>
@@ -763,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoTest" xml:space="preserve">
<value>Интервал автоматической проверки задержки в минутах</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>Интервал автоматического обновления подписок в часах</value>
</data>
@@ -808,9 +766,6 @@
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Игнорировать файлы Geo при обновлении ядра</value>
</data>
<data name="TbSettingsIpv6" xml:space="preserve">
<value>Включить IPv6</value>
</data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Сохранить старые при удалении дублей</value>
</data>
@@ -826,18 +781,12 @@
<data name="TbSettingsN" xml:space="preserve">
<value>Настройки v2rayN</value>
</data>
<data name="TbSettingsPacListenPort" xml:space="preserve">
<value>Порт PAC</value>
</data>
<data name="TbSettingsPass" xml:space="preserve">
<value>Пароль аутентификации</value>
</data>
<data name="TbSettingsRemoteDNS" xml:space="preserve">
<value>Пользовательский DNS (если несколько делите с запятыми (,))</value>
</data>
<data name="TbSettingsSaveTip" xml:space="preserve">
<value>После изменения следующих параметров нажмите «Сохранить», чтобы изменения вступили в силу</value>
</data>
<data name="TbSettingsSetUWP" xml:space="preserve">
<value>Set Win10 UWP Loopback</value>
</data>

View File

@@ -195,9 +195,6 @@
<data name="LvAddress" xml:space="preserve">
<value>地址</value>
</data>
<data name="LvAlias" xml:space="preserve">
<value>别名</value>
</data>
<data name="LvEncryptionMethod" xml:space="preserve">
<value>加密方式</value>
</data>
@@ -210,9 +207,6 @@
<data name="LvSubscription" xml:space="preserve">
<value>订阅分组</value>
</data>
<data name="LvTestResults" xml:space="preserve">
<value>测试结果</value>
</data>
<data name="LvTodayDownloadDataAmount" xml:space="preserve">
<value>今日下载</value>
</data>
@@ -228,9 +222,6 @@
<data name="LvTransportProtocol" xml:space="preserve">
<value>传输协议</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>中等</value>
</data>
<data name="MsgClearSubscription" xml:space="preserve">
<value>清除原订阅内容</value>
</data>
@@ -246,27 +237,15 @@
<data name="MsgNoValidSubscription" xml:space="preserve">
<value>未设置有效的订阅</value>
</data>
<data name="MsgPACUpdateFailed" xml:space="preserve">
<value>PAC更新失败</value>
</data>
<data name="MsgPACUpdateSuccessfully" xml:space="preserve">
<value>PAC更新成功</value>
</data>
<data name="MsgParsingSuccessfully" xml:space="preserve">
<value>解析{0}成功</value>
</data>
<data name="MsgSimplifyPAC" xml:space="preserve">
<value>简化PAC成功</value>
</data>
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
<value>开始获取订阅内容</value>
</data>
<data name="MsgStartUpdating" xml:space="preserve">
<value>开始更新 {0}...</value>
</data>
<data name="MsgStartUpdatingPAC" xml:space="preserve">
<value>开始更新 PAC...</value>
</data>
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
<value>无效的订阅内容</value>
</data>
@@ -285,9 +264,6 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>更新Core成功正在重启服务...</value>
</data>
<data name="NeedHttpGlobalProxy" xml:space="preserve">
<value>此功能依赖Http全局代理,请先设置正确。</value>
</data>
<data name="NonvmessOrssProtocol" xml:space="preserve">
<value>非VMess或ss协议</value>
</data>
@@ -315,9 +291,6 @@
<data name="PleaseSelectServer" xml:space="preserve">
<value>请先选择服务器</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>快</value>
</data>
<data name="RemoveDuplicateServerResult" xml:space="preserve">
<value>服务器去重完成。原数量: {0},现数量: {1}</value>
</data>
@@ -330,15 +303,6 @@
<data name="SaveServerConfigurationIn" xml:space="preserve">
<value>服务端配置文件保存在:{0}</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>慢</value>
</data>
<data name="SpeedServerTips" xml:space="preserve">
<value>注意此功能依赖Http全局代理!测试完成后,请手工调整Http全局代理和活动节点。</value>
</data>
<data name="StartPacFailed" xml:space="preserve">
<value>PAC服务启动失败,请用管理员启动</value>
</data>
<data name="StartService" xml:space="preserve">
<value>启动服务({0})...</value>
</data>
@@ -410,13 +374,13 @@
<value>*grpc serviceName</value>
</data>
<data name="TransportRequestHostTip1" xml:space="preserve">
<value>*http host中间逗号(,)隔</value>
<value>*http host中间逗号(,)隔</value>
</data>
<data name="TransportRequestHostTip2" xml:space="preserve">
<value>*ws host</value>
</data>
<data name="TransportRequestHostTip3" xml:space="preserve">
<value>*h2 host中间逗号(,)隔</value>
<value>*h2 host中间逗号(,)隔</value>
</data>
<data name="TransportRequestHostTip4" xml:space="preserve">
<value>*QUIC 加密方式</value>
@@ -472,9 +436,6 @@
<data name="MsgServerTitle" xml:space="preserve">
<value>服务器过滤器</value>
</data>
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
<value>正常使用此版本需要.NET Framework 4.8,请更新后重启</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>检查更新</value>
</data>
@@ -763,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>启动后隐藏窗口</value>
</data>
<data name="TbSettingsAutoTest" xml:space="preserve">
<value>自动延迟测试的间隔 (单位分钟)</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>自动更新订阅的间隔(单位小时)</value>
</data>
@@ -808,9 +766,6 @@
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>更新Core时忽略Geo文件</value>
</data>
<data name="TbSettingsIpv6" xml:space="preserve">
<value>启用IPv6</value>
</data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>去重时保留序号较小的项</value>
</data>
@@ -826,17 +781,11 @@
<data name="TbSettingsN" xml:space="preserve">
<value>v2rayN 设置</value>
</data>
<data name="TbSettingsPacListenPort" xml:space="preserve">
<value>Pac监听端口号</value>
</data>
<data name="TbSettingsPass" xml:space="preserve">
<value>认证密码</value>
</data>
<data name="TbSettingsRemoteDNS" xml:space="preserve">
<value>自定义DNS(可多个,用逗号(,)隔)</value>
</data>
<data name="TbSettingsSaveTip" xml:space="preserve">
<value>修改以下参数后,点击保存才生效</value>
<value>自定义DNS(可多个,用逗号(,)隔)</value>
</data>
<data name="TbSettingsSetUWP" xml:space="preserve">
<value>解除Win10 UWP应用回环代理限制</value>
@@ -1153,4 +1102,10 @@
<data name="MsgSkipSubscriptionUpdate" xml:space="preserve">
<value>未启用更新,跳过此订阅</value>
</data>
<data name="menuRebootAsAdmin" xml:space="preserve">
<value>以管理员身份重启</value>
</data>
<data name="LvMoreUrl" xml:space="preserve">
<value>更多地址(url),用逗号(,)分隔</value>
</data>
</root>

View File

@@ -1,45 +1,22 @@
using System.Windows.Forms;
using System.Windows;
namespace v2rayN
{
class UI
{
private readonly static string caption = "v2rayN";
public static void Show(string msg)
{
MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
public static void ShowWarning(string msg)
{
MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
}
public static void ShowError(string msg)
public static MessageBoxResult ShowYesNo(string msg)
{
MessageBox.Show(msg, "v2rayN", MessageBoxButtons.OK, MessageBoxIcon.Error);
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);
}
public static DialogResult ShowYesNo(string msg)
{
return MessageBox.Show(msg, "v2rayN", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
}
//public static string GetResourseString(string key)
//{
// CultureInfo cultureInfo = null;
// try
// {
// string languageCode = this.LanguageCode;
// cultureInfo = new CultureInfo(languageCode);
// return Common.ResourceManager.GetString(key, cultureInfo);
// }
// catch (Exception)
// {
// //默认读取英文的多语言
// cultureInfo = new CultureInfo(MKey.kDefaultLanguageCode);
// return Common.ResourceManager.GetString(key, cultureInfo);
// }
//}
}
}

View File

@@ -18,7 +18,7 @@ using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Windows.Forms;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@@ -429,6 +429,11 @@ namespace v2rayN
BitmapSizeOptions.FromEmptyOptions());
}
/// <summary>
/// idn to idc
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string GetPunycode(string url)
{
if (string.IsNullOrWhiteSpace(url))
@@ -453,6 +458,12 @@ namespace v2rayN
}
}
public static bool IsBase64String(string plainText)
{
var buffer = new Span<byte>(new byte[plainText.Length]);
return Convert.TryFromBase64String(plainText, buffer, out int _);
}
#endregion
@@ -667,12 +678,12 @@ namespace v2rayN
/// <returns></returns>
public static string GetExePath()
{
return Application.ExecutablePath;
return Environment.ProcessPath;
}
public static string StartupPath()
{
return Application.StartupPath;
return AppDomain.CurrentDomain.BaseDirectory;
}
public static string? RegReadValue(string path, string name, string def)
@@ -1177,47 +1188,44 @@ namespace v2rayN
#region scan screen
public static string ScanScreen()
public static string ScanScreen(float dpiX, float dpiY)
{
try
{
foreach (Screen screen in Screen.AllScreens)
var left = (int)(SystemParameters.WorkArea.Left);
var top = (int)(SystemParameters.WorkArea.Top);
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
using Bitmap fullImage = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(fullImage))
{
using Bitmap fullImage = new Bitmap(screen.Bounds.Width,
screen.Bounds.Height);
using (Graphics g = Graphics.FromImage(fullImage))
g.CopyFromScreen(left, top, 0, 0, fullImage.Size, CopyPixelOperation.SourceCopy);
}
int maxTry = 10;
for (int i = 0; i < maxTry; i++)
{
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
Bitmap target = new(width, height);
double imageScale = (double)width / (double)cropRect.Width;
using (Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(screen.Bounds.X,
screen.Bounds.Y,
0, 0,
fullImage.Size,
CopyPixelOperation.SourceCopy);
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}
int maxTry = 10;
for (int i = 0; i < maxTry; i++)
BitmapLuminanceSource source = new(target);
BinaryBitmap bitmap = new(new HybridBinarizer(source));
QRCodeReader reader = new();
Result result = reader.decode(bitmap);
if (result != null)
{
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
Bitmap target = new(screen.Bounds.Width, screen.Bounds.Height);
double imageScale = (double)screen.Bounds.Width / (double)cropRect.Width;
using (Graphics g = Graphics.FromImage(target))
{
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}
BitmapLuminanceSource source = new(target);
BinaryBitmap bitmap = new(new HybridBinarizer(source));
QRCodeReader reader = new();
Result result = reader.decode(bitmap);
if (result != null)
{
string ret = result.Text;
return ret;
}
string ret = result.Text;
return ret;
}
}
}
@@ -1228,6 +1236,14 @@ namespace v2rayN
return string.Empty;
}
public static Tuple<float, float> GetDpiXY(Window window)
{
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
Graphics g = Graphics.FromHwnd(hWnd);
return new(96 / g.DpiX, 96 / g.DpiY);
}
#endregion

View File

@@ -1,3 +1,4 @@
using Microsoft.Win32;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using ReactiveUI.Validation.Helpers;
@@ -5,7 +6,6 @@ using Splat;
using System.IO;
using System.Reactive;
using System.Windows;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
using v2rayN.Mode;
@@ -111,7 +111,7 @@ namespace v2rayN.ViewModels
Multiselect = false,
Filter = "Config|*.json|YAML|*.yaml;*.yml|All|*.*"
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}

View File

@@ -3,16 +3,17 @@ using DynamicData.Binding;
using MaterialDesignColors;
using MaterialDesignColors.ColorManipulation;
using MaterialDesignThemes.Wpf;
using Microsoft.Win32;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Splat;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media;
using v2rayN.Base;
using v2rayN.Handler;
@@ -20,7 +21,6 @@ using v2rayN.Mode;
using v2rayN.Resx;
using v2rayN.Tool;
using v2rayN.Views;
using Application = System.Windows.Application;
namespace v2rayN.ViewModels
@@ -38,7 +38,7 @@ namespace v2rayN.ViewModels
private NoticeHandler? _noticeHandler;
private readonly PaletteHelper _paletteHelper = new();
private Dictionary<string, bool> _dicHeaderSort = new();
private Action<string> _updateView;
private Action<EViewAction> _updateView;
#endregion
@@ -122,6 +122,7 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> OptionSettingCmd { get; }
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; }
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
public ReactiveCommand<Unit, Unit> ImportOldGuiConfigCmd { get; }
@@ -201,7 +202,7 @@ namespace v2rayN.ViewModels
#region Init
public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<string> updateView)
public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EViewAction> updateView)
{
_updateView = updateView;
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
@@ -432,6 +433,10 @@ namespace v2rayN.ViewModels
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
}
});
RebootAsAdminCmd = ReactiveCommand.Create(() =>
{
RebootAsAdmin();
});
ClearServerStatisticsCmd = ReactiveCommand.Create(() =>
{
_statistics?.ClearAllServerStatistics();
@@ -549,7 +554,7 @@ namespace v2rayN.ViewModels
}
if (_config.uiItem.enableAutoAdjustMainLvColWidth)
{
_updateView("AdjustMainLvColWidth");
_updateView(EViewAction.AdjustMainLvColWidth);
}
}
}
@@ -563,8 +568,9 @@ namespace v2rayN.ViewModels
{
return;
}
SpeedProxyDisplay = string.Format("{0}:{1}/s<><73> | {2}/s<><73>", Global.agentTag, Utils.HumanFy(update.proxyUp), Utils.HumanFy(update.proxyDown));
SpeedDirectDisplay = string.Format("{0}:{1}/s<><73> | {2}/s<><73>", Global.directTag, Utils.HumanFy(update.directUp), Utils.HumanFy(update.directDown));
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.agentTag, Utils.HumanFy(update.proxyUp), Utils.HumanFy(update.proxyDown));
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.directTag, Utils.HumanFy(update.directUp), Utils.HumanFy(update.directDown));
if (update.proxyUp + update.proxyDown > 0)
{
@@ -702,7 +708,7 @@ namespace v2rayN.ViewModels
RefreshServers();
_updateView("ProfilesFocus");
_updateView(EViewAction.ProfilesFocus);
}
private void ServerFilterChanged(bool c)
@@ -924,9 +930,10 @@ namespace v2rayN.ViewModels
{
ShowHideWindow(false);
var dpiXY = Utils.GetDpiXY(Application.Current.MainWindow);
string result = await Task.Run(() =>
{
return Utils.ScanScreen();
return Utils.ScanScreen(dpiXY.Item1, dpiXY.Item2);
});
ShowHideWindow(true);
@@ -953,7 +960,7 @@ namespace v2rayN.ViewModels
return;
}
if (UI.ShowYesNo(ResUI.RemoveServer) == DialogResult.No)
if (UI.ShowYesNo(ResUI.RemoveServer) == MessageBoxResult.No)
{
return;
}
@@ -1068,10 +1075,7 @@ namespace v2rayN.ViewModels
return;
}
if (!_dicHeaderSort.ContainsKey(colName))
{
_dicHeaderSort.Add(colName, true);
}
_dicHeaderSort.TryAdd(colName, true);
_dicHeaderSort.TryGetValue(colName, out bool asc);
if (ConfigHandler.SortServers(ref _config, _subId, colName, asc) != 0)
{
@@ -1110,7 +1114,7 @@ namespace v2rayN.ViewModels
return;
}
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
if (GetProfileItems(out List<ProfileItem> lstSelecteds, true) < 0)
{
return;
}
@@ -1295,6 +1299,24 @@ namespace v2rayN.ViewModels
}
}
private void RebootAsAdmin()
{
ProcessStartInfo startInfo = new()
{
UseShellExecute = true,
Arguments = Global.RebootAs,
WorkingDirectory = Utils.StartupPath(),
FileName = Utils.GetExePath(),
Verb = "runas",
};
try
{
Process.Start(startInfo);
MyAppExit(false);
}
catch { }
}
private void ImportOldGuiConfig()
{
OpenFileDialog fileDialog = new()
@@ -1302,7 +1324,7 @@ namespace v2rayN.ViewModels
Multiselect = false,
Filter = "guiNConfig|*.json|All|*.*"
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}

View File

@@ -1,10 +1,10 @@
using DynamicData.Binding;
using Microsoft.Win32;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Splat;
using System.Reactive;
using System.Windows;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
using v2rayN.Mode;
@@ -173,7 +173,7 @@ namespace v2rayN.ViewModels
UI.Show(ResUI.PleaseSelectRules);
return;
}
if (UI.ShowYesNo(ResUI.RemoveRules) == DialogResult.No)
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
{
return;
}
@@ -268,7 +268,7 @@ namespace v2rayN.ViewModels
Multiselect = false,
Filter = "Rules|*.json|All|*.*"
};
if (fileDialog.ShowDialog() != DialogResult.OK)
if (fileDialog.ShowDialog() != true)
{
return;
}
@@ -322,7 +322,7 @@ namespace v2rayN.ViewModels
private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData)
{
bool blReplace = false;
if (UI.ShowYesNo(ResUI.AddBatchRoutingRulesYesNo) == DialogResult.No)
if (UI.ShowYesNo(ResUI.AddBatchRoutingRulesYesNo) == MessageBoxResult.No)
{
blReplace = true;
}

View File

@@ -4,7 +4,6 @@ using ReactiveUI.Fody.Helpers;
using Splat;
using System.Reactive;
using System.Windows;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
using v2rayN.Mode;
@@ -244,7 +243,7 @@ namespace v2rayN.ViewModels
UI.Show(ResUI.PleaseSelectRules);
return;
}
if (UI.ShowYesNo(ResUI.RemoveRules) == DialogResult.No)
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
{
return;
}

View File

@@ -62,6 +62,7 @@ namespace v2rayN.ViewModels
{
item.remarks = SelectedSource.remarks;
item.url = SelectedSource.url;
item.moreUrl = SelectedSource.moreUrl;
item.enabled = SelectedSource.enabled;
item.userAgent = SelectedSource.userAgent;
item.sort = SelectedSource.sort;

View File

@@ -6,7 +6,6 @@ using ReactiveUI.Fody.Helpers;
using Splat;
using System.Reactive;
using System.Windows;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
using v2rayN.Mode;
@@ -24,6 +23,7 @@ namespace v2rayN.ViewModels
public IObservableCollection<SubItem> SubItems => _subItems;
[Reactive]
public SubItem SelectedSource { get; set; }
public IList<SubItem> SelectedSources { get; set; }
public ReactiveCommand<Unit, Unit> SubAddCmd { get; }
public ReactiveCommand<Unit, Unit> SubDeleteCmd { get; }
@@ -96,12 +96,15 @@ namespace v2rayN.ViewModels
private void DeleteSub()
{
if (UI.ShowYesNo(ResUI.RemoveServer) == DialogResult.No)
if (UI.ShowYesNo(ResUI.RemoveServer) == MessageBoxResult.No)
{
return;
}
ConfigHandler.DeleteSubItem(ref _config, SelectedSource?.id);
foreach (var it in SelectedSources)
{
ConfigHandler.DeleteSubItem(ref _config, it?.id);
}
RefreshSubItems();
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
IsModified = true;

View File

@@ -139,7 +139,7 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedSource.fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.alpn, v => v.cmbAlpn.Text).DisposeWith(disposables);
//reality
this.Bind(ViewModel, vm => vm.SelectedSource.sni, v => v.txtSNI2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.sni, v => v.txtSNI2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.fingerprint, v => v.cmbFingerprint2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.publicKey, v => v.txtPublicKey.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.shortId, v => v.txtShortId.Text).DisposeWith(disposables);

View File

@@ -10,7 +10,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:v2rayN.Resx"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
xmlns:vms="clr-namespace:v2rayN.ViewModels"
Title="v2rayN"
Width="900"
@@ -157,6 +157,10 @@
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
<Separator Margin="-40,5" />
<MenuItem
x:Name="menuRebootAsAdmin"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRebootAsAdmin}" />
<MenuItem
x:Name="menuSettingsSetUWP"
Height="{StaticResource MenuItemHeight}"
@@ -378,6 +382,14 @@
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Plus" />
</Button>
<Button
x:Name="btnAutofitColumnWidth"
Width="30"
Height="30"
Margin="4,0"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowSplitVertical" />
</Button>
<TextBox
x:Name="txtServerFilter"
Width="200"
@@ -484,7 +496,6 @@
CanUserSortColumns="False"
EnableRowVirtualization="True"
Focusable="True"
FrozenColumnCount="1"
GridLinesVisibility="All"
HeadersVisibility="All"
IsReadOnly="True"
@@ -615,19 +626,19 @@
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
</Style>
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding isActive}" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTemplateColumn Width="40">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border
Width="auto"
Height="auto"
Background="{DynamicResource PrimaryHueLightBrush}"
Visibility="{Binding Path=isActive, Converter={StaticResource BoolToVisConverter}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<base:MyDGTextColumn
Width="80"
@@ -638,7 +649,7 @@
Width="150"
Binding="{Binding remarks}"
ExName="remarks"
Header="{x:Static resx:ResUI.LvAlias}" />
Header="{x:Static resx:ResUI.LvRemarks}" />
<base:MyDGTextColumn
Width="120"
Binding="{Binding address}"

View File

@@ -1,7 +1,6 @@
using ReactiveUI;
using Splat;
using System.ComponentModel;
using System.Drawing;
using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Controls;
@@ -15,7 +14,6 @@ using v2rayN.Mode;
using v2rayN.Resx;
using v2rayN.ViewModels;
using Point = System.Windows.Point;
using SystemInformation = System.Windows.Forms.SystemInformation;
namespace v2rayN.Views
{
@@ -31,9 +29,11 @@ namespace v2rayN.Views
App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown;
lstProfiles.SelectionChanged += lstProfiles_SelectionChanged;
lstProfiles.LoadingRow += LstProfiles_LoadingRow;
lstProfiles.RowHeaderWidth = 30;
if (_config.uiItem.enableDragDropSort)
{
lstProfiles.AllowDrop = true;
@@ -118,6 +118,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.OptionSettingCmd, v => v.menuOptionSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RoutingSettingCmd, v => v.menuRoutingSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ImportOldGuiConfigCmd, v => v.menuImportOldGuiConfig).DisposeWith(disposables);
@@ -193,10 +194,10 @@ namespace v2rayN.Views
spEnableTun.Visibility = IsAdministrator ? Visibility.Visible : Visibility.Collapsed;
if (_config.uiItem.autoHideStartup)
{
WindowState = WindowState.Minimized;
}
//if (_config.uiItem.autoHideStartup)
//{
// WindowState = WindowState.Minimized;
//}
if (!_config.guiItem.enableHWA)
{
@@ -206,19 +207,16 @@ namespace v2rayN.Views
#region Event
private void UpdateViewHandler(string action)
private void UpdateViewHandler(EViewAction action)
{
if (action == "AdjustMainLvColWidth")
if (action == EViewAction.AdjustMainLvColWidth)
{
Application.Current.Dispatcher.Invoke(() =>
{
foreach (var it in lstProfiles.Columns)
{
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
AutofitColumnWidth();
});
}
else if (action == "ProfilesFocus")
else if (action == EViewAction.ProfilesFocus)
{
lstProfiles.Focus();
}
@@ -278,16 +276,6 @@ namespace v2rayN.Views
return;
}
if (colHeader.Column.GetType().Name != typeof(MyDGTextColumn).Name)
{
foreach (var it in lstProfiles.Columns)
{
//it.MinWidth = it.ActualWidth;
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
return;
}
var colName = ((MyDGTextColumn)colHeader.Column).ExName;
ViewModel?.SortServer(colName);
}
@@ -408,6 +396,18 @@ namespace v2rayN.Views
{
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
}
private void BtnAutofitColumnWidth_Click(object sender, RoutedEventArgs e)
{
AutofitColumnWidth();
}
private void AutofitColumnWidth()
{
foreach (var it in lstProfiles.Columns)
{
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
}
#endregion
#region UI
@@ -420,16 +420,10 @@ namespace v2rayN.Views
Height = _config.uiItem.mainHeight;
}
IntPtr hWnd = new WindowInteropHelper(this).EnsureHandle();
Graphics g = Graphics.FromHwnd(hWnd);
if (Width > SystemInformation.WorkingArea.Width * 96 / g.DpiX)
{
Width = SystemInformation.WorkingArea.Width * 96 / g.DpiX;
}
if (Height > SystemInformation.WorkingArea.Height * 96 / g.DpiY)
{
Height = SystemInformation.WorkingArea.Height * 96 / g.DpiY;
}
var maxWidth = SystemParameters.WorkArea.Width;
var maxHeight = SystemParameters.WorkArea.Height;
if (Width > maxWidth) Width = maxWidth;
if (Height > maxHeight) Height = maxHeight;
if (_config.uiItem.mainGirdHeight1 > 0 && _config.uiItem.mainGirdHeight2 > 0)
{
gridMain.RowDefinitions[0].Height = new GridLength(_config.uiItem.mainGirdHeight1, GridUnitType.Star);
@@ -452,7 +446,7 @@ namespace v2rayN.Views
else
{
item2.Width = item.Width;
item2.DisplayIndex = i + 1;
item2.DisplayIndex = i;
}
}
}

View File

@@ -1,4 +1,5 @@
using ReactiveUI;
using Microsoft.Win32;
using ReactiveUI;
using System.Globalization;
using System.IO;
using System.Reactive.Disposables;
@@ -210,7 +211,7 @@ namespace v2rayN.Views
}
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
{
var openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
var openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "tunConfig|*.json|All|*.*";
openFileDialog1.ShowDialog();

View File

@@ -1,4 +1,5 @@
using ReactiveUI;
using Microsoft.Win32;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Input;
@@ -108,7 +109,7 @@ namespace v2rayN.Views
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
{
var openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
var openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "PNG|*.png";
openFileDialog1.ShowDialog();

View File

@@ -202,7 +202,7 @@
<DataGridTextColumn
Width="200"
Binding="{Binding remarks}"
Header="{x:Static resx:ResUI.LvAlias}" />
Header="{x:Static resx:ResUI.LvRemarks}" />
<DataGridTextColumn
Width="60"
Binding="{Binding ruleNum}"

View File

@@ -23,6 +23,14 @@
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Popupbox.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<ScrollViewer
materialDesign:ScrollViewerAssist.IsAutoHideEnabled="True"
HorizontalScrollBarVisibility="Auto"
@@ -45,6 +53,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
@@ -92,6 +101,31 @@
Style="{StaticResource MyOutlinedTextBox}"
TextWrapping="Wrap" />
<materialDesign:PopupBox
Grid.Row="2"
Grid.Column="2"
HorizontalAlignment="Right"
StaysOpen="True"
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
<StackPanel>
<TextBlock
Margin="4"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvMoreUrl}" />
<TextBox
x:Name="txtMoreUrl"
Width="400"
Margin="4"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
MinLines="4"
Style="{StaticResource MyOutlinedTextBox}"
TextWrapping="Wrap" />
</StackPanel>
</materialDesign:PopupBox>
<TextBlock
Grid.Row="3"
Grid.Column="0"

View File

@@ -20,6 +20,7 @@ namespace v2rayN.Views
{
this.Bind(ViewModel, vm => vm.SelectedSource.remarks, v => v.txtRemarks.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.url, v => v.txtUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.moreUrl, v => v.txtMoreUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.enabled, v => v.togEnable.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.userAgent, v => v.txtUserAgent.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.sort, v => v.txtSort.Text).DisposeWith(disposables);

View File

@@ -108,7 +108,7 @@
Binding="{Binding url}"
Header="{x:Static resx:ResUI.LvUrl}" />
<DataGridTextColumn
Width="80"
Width="100"
Binding="{Binding enabled}"
Header="{x:Static resx:ResUI.LvEnabled}" />
<DataGridTextColumn

View File

@@ -3,6 +3,7 @@ using System.ComponentModel;
using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Input;
using v2rayN.Mode;
using v2rayN.ViewModels;
namespace v2rayN.Views
@@ -17,6 +18,7 @@ namespace v2rayN.Views
ViewModel = new SubSettingViewModel(this);
this.Closing += SubSettingWindow_Closing;
lstSubscription.MouseDoubleClick += LstSubscription_MouseDoubleClick;
lstSubscription.SelectionChanged += LstSubscription_SelectionChanged;
this.WhenActivated(disposables =>
{
@@ -43,6 +45,10 @@ namespace v2rayN.Views
{
ViewModel?.EditSub(false);
}
private void LstSubscription_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
}
private void menuClose_Click(object sender, System.Windows.RoutedEventArgs e)
{

View File

@@ -10,13 +10,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
<FileVersion>6.20</FileVersion>
<FileVersion>6.21</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.4" />
<PackageReference Include="MaterialDesignThemes" Version="4.7.1" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.108" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />