Compare commits

...

6 Commits
6.19 ... 6.20

Author SHA1 Message Date
2dust
790209efbc up 6.20 2023-04-01 18:57:24 +08:00
2dust
f1679e444c Add skip subscription tips 2023-03-31 20:07:39 +08:00
2dust
9dc6ba182a Fix delete duplicate server 2023-03-30 14:09:14 +08:00
2dust
785a30e623 Update CoreConfigHandler.cs 2023-03-26 20:05:51 +08:00
2dust
f09efdad66 Add tip for custom log 2023-03-25 18:05:01 +08:00
2dust
4e73b3ae28 Adjust some style 2023-03-25 17:50:32 +08:00
18 changed files with 74 additions and 42 deletions

View File

@@ -800,16 +800,15 @@ namespace v2rayN.Handler
return 0;
}
public static int DedupServerList(ref Config config, ref List<ProfileItem> lstProfile)
public static Tuple<int, int> DedupServerList(Config config, string subId)
{
List<ProfileItem> source = lstProfile;
bool keepOlder = config.guiItem.keepOlderDedupl;
var lstProfile = LazyConfig.Instance.ProfileItems(subId);
List<ProfileItem> lstKeep = new();
List<ProfileItem> lstRemove = new();
if (!keepOlder) source.Reverse(); // Remove the early items first
if (config.guiItem.keepOlderDedupl) lstProfile.Reverse();
foreach (ProfileItem item in source)
foreach (ProfileItem item in lstProfile)
{
if (!lstKeep.Exists(i => CompareProfileItem(i, item, false)))
{
@@ -822,7 +821,7 @@ namespace v2rayN.Handler
}
RemoveServer(config, lstRemove);
return lstKeep.Count;
return new Tuple<int, int>(lstProfile.Count, lstKeep.Count);
}
public static int AddServerCommon(ref Config config, ProfileItem profileItem, bool toFile = true)

View File

@@ -1390,7 +1390,7 @@ namespace v2rayN.Handler
Utils.SaveLog(ex.Message, ex);
}
log(configCopy, ref v2rayConfig, false);
log(configCopy, ref v2rayConfig, true);
//routing(config, ref v2rayConfig);
//dns(configCopy, ref v2rayConfig);

View File

@@ -175,24 +175,20 @@ namespace v2rayN.Handler
foreach (var item in subItem)
{
if (item.enabled == false)
{
continue;
}
if (!Utils.IsNullOrEmpty(subId) && item.id != subId)
{
continue;
}
string id = item.id.TrimEx();
string url = item.url.TrimEx();
string userAgent = item.userAgent.TrimEx();
string hashCode = $"{item.remarks}->";
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url))
if (Utils.IsNullOrEmpty(id) || Utils.IsNullOrEmpty(url) || (!Utils.IsNullOrEmpty(subId) && item.id != subId))
{
//_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
continue;
}
if (item.enabled == false)
{
_updateFunc(false, $"{hashCode}{ResUI.MsgSkipSubscriptionUpdate}");
continue;
}
var downloadHandle = new DownloadHandle();
downloadHandle.Error += (sender2, args) =>

View File

@@ -1446,6 +1446,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Updates are not enabled, skip this subscription 的本地化字符串。
/// </summary>
public static string MsgSkipSubscriptionUpdate {
get {
return ResourceManager.GetString("MsgSkipSubscriptionUpdate", resourceCulture);
}
}
/// <summary>
/// 查找类似 Start getting subscriptions 的本地化字符串。
/// </summary>
@@ -2995,6 +3004,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Please turn off when there is an abnormal disconnection 的本地化字符串。
/// </summary>
public static string TipDisplayLog {
get {
return ResourceManager.GetString("TipDisplayLog", resourceCulture);
}
}
/// <summary>
/// 查找类似 *Default value tcp 的本地化字符串。
/// </summary>

View File

@@ -1147,4 +1147,10 @@
<data name="SpeedtestingWait" xml:space="preserve">
<value>Waiting for testing</value>
</data>
<data name="TipDisplayLog" xml:space="preserve">
<value>Please turn off when there is an abnormal disconnection</value>
</data>
<data name="MsgSkipSubscriptionUpdate" xml:space="preserve">
<value>Updates are not enabled, skip this subscription</value>
</data>
</root>

View File

@@ -1147,4 +1147,10 @@
<data name="SpeedtestingWait" xml:space="preserve">
<value>等待测试中...</value>
</data>
<data name="TipDisplayLog" xml:space="preserve">
<value>当有异常断流时请关闭</value>
</data>
<data name="MsgSkipSubscriptionUpdate" xml:space="preserve">
<value>未启用更新,跳过此订阅</value>
</data>
</root>

View File

@@ -867,7 +867,7 @@ namespace v2rayN
string location = GetExePath();
if (blFull)
{
return string.Format("v2rayN - V{0} - {1}-Test",
return string.Format("v2rayN - V{0} - {1}",
FileVersionInfo.GetVersionInfo(location).FileVersion.ToString(),
File.GetLastWriteTime(location).ToString("yyyy/MM/dd"));
}

View File

@@ -971,11 +971,10 @@ namespace v2rayN.ViewModels
private void RemoveDuplicateServer()
{
int oldCount = _lstProfile.Count;
int newCount = ConfigHandler.DedupServerList(ref _config, ref _lstProfile);
var tuple = ConfigHandler.DedupServerList(_config, _subId);
RefreshServers();
Reload();
_noticeHandler?.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, oldCount, newCount));
_noticeHandler?.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
}
private void CopyServer()
{

View File

@@ -137,12 +137,19 @@
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbDisplayLog}" />
<ToggleButton
x:Name="togDisplayLog"
<StackPanel
Grid.Row="4"
Grid.Column="1"
Margin="4"
HorizontalAlignment="Left" />
Orientation="Horizontal">
<ToggleButton x:Name="togDisplayLog" HorizontalAlignment="Left" />
<TextBlock
Margin="8,0"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TipDisplayLog}" />
</StackPanel>
<TextBlock
Grid.Row="5"
@@ -176,7 +183,7 @@
<Grid
Grid.Row="1"
Margin="16"
Margin="8"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />

View File

@@ -10,8 +10,8 @@
xmlns:resx="clr-namespace:v2rayN.Resx"
xmlns:vms="clr-namespace:v2rayN.ViewModels"
Title="{x:Static resx:ResUI.menuServers}"
Width="800"
Height="830"
Width="820"
Height="820"
x:TypeArguments="vms:AddServerViewModel"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
@@ -742,7 +742,7 @@
<Grid
Grid.Row="9"
Margin="16"
Margin="8"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />

View File

@@ -150,7 +150,7 @@
<Grid
Grid.Row="2"
Margin="16"
Margin="8"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />

View File

@@ -15,8 +15,8 @@
Title="v2rayN"
Width="900"
Height="700"
MinWidth="800"
MinHeight="600"
MinWidth="900"
MinHeight="700"
x:TypeArguments="vms:MainWindowViewModel"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
@@ -837,9 +837,10 @@
Height="Auto"
Background="{DynamicResource MaterialDesignLightBackground}"
BorderBrush="{DynamicResource MaterialDesignDarkBackground}"
BorderThickness="1">
BorderThickness="0"
CornerRadius="4">
<TextBlock
Margin="2"
Margin="8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource MaterialDesignDarkBackground}"

View File

@@ -23,7 +23,7 @@
TextOptions.TextRenderingMode="Auto"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="16">
<DockPanel Margin="8">
<Grid HorizontalAlignment="Center" DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
@@ -753,14 +753,14 @@
Width="300"
Margin="{StaticResource SettingItemMargin}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="18"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableHWA}"/>
Text="{x:Static resx:ResUI.TbSettingsEnableHWA}" />
<ToggleButton
x:Name="togEnableHWA"
Grid.Row="18"

View File

@@ -134,7 +134,7 @@
</Grid>
<Grid
Margin="16"
Margin="8"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>

View File

@@ -73,7 +73,7 @@
</ToolBarTray>
<Grid
Margin="16"
Margin="8"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>

View File

@@ -114,7 +114,7 @@
</ToolBarTray>
<Grid
Margin="16"
Margin="8"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>

View File

@@ -162,7 +162,7 @@
</Grid>
<Grid
Grid.Row="1"
Margin="16"
Margin="8"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />

View File

@@ -10,11 +10,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
<FileVersion>6.19</FileVersion>
<FileVersion>6.20</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.3" />
<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="Newtonsoft.Json" Version="13.0.3" />