Compare commits

...

4 commits

Author SHA1 Message Date
2dust
6653ea12b7 Add Language: Hungarian
Some checks are pending
release macos / build (Release) (push) Waiting to run
release / build (Release) (push) Waiting to run
https://github.com/2dust/v2rayN/issues/6252
2024-12-07 21:25:53 +08:00
2dust
a28cef5b98 Fixed the issue of save window size when exit
https://github.com/2dust/v2rayN/issues/6251
2024-12-07 21:13:57 +08:00
2dust
78a28fbdb3 up 7.3.1 2024-12-07 16:30:32 +08:00
2dust
bf8bbbdcb0 Code clean 2024-12-07 16:29:58 +08:00
14 changed files with 1427 additions and 49 deletions

View file

@ -6,6 +6,7 @@
SendMsgView,
SendSnackMsg,
RefreshProfiles,
StopSpeedtest
StopSpeedtest,
AppExit
}
}

View file

@ -196,7 +196,7 @@
public static readonly List<string> SingboxDomainStrategy4Out = new() { "ipv4_only", "prefer_ipv4", "prefer_ipv6", "ipv6_only", "" };
public static readonly List<string> DomainDNSAddress = ["223.5.5.5", "223.6.6.6", "localhost"];
public static readonly List<string> SingboxDomainDNSAddress = ["223.5.5.5", "223.6.6.6", "dhcp://auto"];
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru", "hu" };
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2", "h2,http/1.1", "h3,h2,http/1.1", "" };
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
public static readonly List<string> InboundTags = new() { "socks", "socks2" };

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>7.3.0</Version>
<Version>7.3.1</Version>
</PropertyGroup>
<ItemGroup>
@ -60,6 +60,9 @@
<SubType>Designer</SubType>
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Resx\ResUI.hu.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Resx\ResUI.resx">
<SubType>Designer</SubType>
<LastGenOutput>ResUI.Designer.cs</LastGenOutput>

View file

@ -10,7 +10,7 @@ namespace ServiceLib.Services.Statistics
private ClientWebSocket? webSocket;
private Action<ServerSpeedItem>? _updateFunc;
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
{
_config = config;

View file

@ -160,9 +160,9 @@ namespace ServiceLib.ViewModels
var configDirZipTemp = Utils.GetTempPath($"v2rayN_{DateTime.Now:yyyyMMddHHmmss}");
var configDirTemp = Path.Combine(configDirZipTemp, _guiConfigs);
await Task.Run(() => FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db"));
var ret = await Task.Run(() => FileManager.CreateFromDirectory(configDirZipTemp, fileName));
await Task.Run(() => Directory.Delete(configDirZipTemp, true));
FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db");
var ret = FileManager.CreateFromDirectory(configDirZipTemp, fileName);
Directory.Delete(configDirZipTemp, true);
return ret;
}
}

View file

@ -283,6 +283,7 @@ namespace ServiceLib.ViewModels
try
{
Logging.SaveLog("MyAppExitAsync Begin");
MessageBus.Current.SendMessage("", EMsgCommand.AppExit.ToString());
await ConfigHandler.SaveConfig(_config);
await SysProxyHandler.UpdateSysProxy(_config, true);

View file

@ -459,7 +459,7 @@ namespace ServiceLib.ViewModels
if (_config.Inbound.First().NewPort4LAN)
{
StringBuilder sb2 = new();
sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}]");
sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}]");
InboundLanDisplay = $"{ResUI.LabLAN}:{sb2}";
}
else

View file

@ -152,10 +152,11 @@ namespace v2rayN.Desktop.Views
menuGlobalHotkeySetting.IsVisible = false;
}
menuAddServerViaScan.IsVisible = false;
RestoreUI();
AddHelpMenuItem();
//WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
}
#region Event
@ -441,7 +442,7 @@ namespace v2rayN.Desktop.Views
}
}
private void StorageUI()
private void StorageUI(string? n = null)
{
_config.UiItem.MainWidth = Utils.ToInt(this.Width);
_config.UiItem.MainHeight = Utils.ToInt(this.Height);
@ -456,7 +457,6 @@ namespace v2rayN.Desktop.Views
_config.UiItem.MainGirdHeight1 = Math.Ceiling(gridMain1.RowDefinitions[0].ActualHeight + 0.1);
_config.UiItem.MainGirdHeight2 = Math.Ceiling(gridMain1.RowDefinitions[2].ActualHeight + 0.1);
}
ConfigHandler.SaveConfig(_config);
}
private void AddHelpMenuItem()

View file

@ -56,28 +56,23 @@
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Button.Content>
</Button>
<SplitButton
<Button
x:Name="btnAutofitColumnWidth"
Width="54"
Width="30"
Height="30"
Margin="20,0"
Padding="2"
Classes="Tertiary"
Theme="{DynamicResource BorderlessSplitButton}"
Margin="4,0"
Classes="Success"
Theme="{DynamicResource BorderlessButton}"
ToolTip.Tip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}">
<SplitButton.Content>
<Button.Content>
<PathIcon
Width="24"
Height="24"
Data="{StaticResource building_fit}"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</SplitButton.Content>
<SplitButton.Flyout>
<MenuFlyout>
<MenuItem Name="menuStorageUI" Header="{x:Static resx:ResUI.menuStorageUI}" />
</MenuFlyout>
</SplitButton.Flyout>
</SplitButton>
</Button.Content>
</Button>
<TextBox
x:Name="txtServerFilter"

View file

@ -27,7 +27,6 @@ namespace v2rayN.Desktop.Views
menuSelectAll.Click += menuSelectAll_Click;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
txtServerFilter.KeyDown += TxtServerFilter_KeyDown;
menuStorageUI.Click += MenuStorageUI_Click;
lstProfiles.KeyDown += LstProfiles_KeyDown;
lstProfiles.SelectionChanged += lstProfiles_SelectionChanged;
lstProfiles.DoubleTapped += LstProfiles_DoubleTapped;
@ -91,6 +90,7 @@ namespace v2rayN.Desktop.Views
RestoreUI();
ViewModel?.RefreshServers();
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
}
private async void LstProfiles_Sorting(object? sender, DataGridColumnEventArgs e)
@ -323,12 +323,7 @@ namespace v2rayN.Desktop.Views
ViewModel?.RefreshServers();
}
}
private void MenuStorageUI_Click(object? sender, RoutedEventArgs e)
{
StorageUI();
}
//#endregion Event
//#region UI
@ -368,7 +363,7 @@ namespace v2rayN.Desktop.Views
}
}
private void StorageUI()
private void StorageUI(string? n = null)
{
List<ColumnItem> lvColumnItem = new();
for (int k = 0; k < lstProfiles.Columns.Count; k++)
@ -386,7 +381,6 @@ namespace v2rayN.Desktop.Views
});
}
_config.UiItem.MainColumnItem = lvColumnItem;
ConfigHandler.SaveConfig(_config);
}
//#endregion UI

View file

@ -51,6 +51,7 @@ namespace v2rayN.Views
{
AutofitColumnWidth();
}
private void AutofitColumnWidth()
{
foreach (var it in lstConnections.Columns)

View file

@ -26,7 +26,6 @@ namespace v2rayN.Views
_config = AppHandler.Instance.Config;
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
Application.Current.Exit += Current_Exit;
App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
@ -142,6 +141,7 @@ namespace v2rayN.Views
RestoreUI();
AddHelpMenuItem();
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
}
#region Event
@ -265,11 +265,6 @@ namespace v2rayN.Views
ShowHideWindow(false);
}
private void Current_Exit(object sender, ExitEventArgs e)
{
StorageUI();
}
private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
{
Logging.SaveLog("Current_SessionEnding");
@ -402,7 +397,7 @@ namespace v2rayN.Views
}
}
private void StorageUI()
private void StorageUI(string? n = null)
{
_config.UiItem.MainWidth = Utils.ToInt(this.Width);
_config.UiItem.MainHeight = Utils.ToInt(this.Height);

View file

@ -1,6 +1,7 @@
using MaterialDesignThemes.Wpf;
using ReactiveUI;
using Splat;
using System;
using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Controls;
@ -24,7 +25,6 @@ namespace v2rayN.Views
_config = AppHandler.Instance.Config;
Application.Current.Exit += Current_Exit;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown;
@ -90,15 +90,11 @@ namespace v2rayN.Views
RestoreUI();
ViewModel?.RefreshServers();
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
}
#region Event
private void Current_Exit(object sender, ExitEventArgs e)
{
StorageUI();
}
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
{
switch (action)
@ -356,7 +352,7 @@ namespace v2rayN.Views
}
}
private void StorageUI()
private void StorageUI(string? n = null)
{
List<ColumnItem> lvColumnItem = new();
for (int k = 0; k < lstProfiles.Columns.Count; k++)
@ -370,7 +366,6 @@ namespace v2rayN.Views
});
}
_config.UiItem.MainColumnItem = lvColumnItem;
ConfigHandler.SaveConfig(_config);
}
#endregion UI