Compare commits

..

No commits in common. "c9f79e4b4705f6fb176fa6bec9320342e86e014f" and "42324a2c9e7ae1e6421bbc68be3f260bdf67ff6c" have entirely different histories.

5 changed files with 26 additions and 53 deletions

View file

@ -507,13 +507,6 @@ namespace ServiceLib
{ ECoreType.v2rayN, "2dust/v2rayN" },
};
public static readonly List<string> OtherGeoUrls =
[
@"https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat",
@"https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb",
@"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb"
];
#endregion const
}
}

View file

@ -261,17 +261,10 @@ namespace ServiceLib.Services
if (pid > 0)
{
await Task.Delay(500);
var delay = await DoRealPing(downloadHandle, it);
await DoRealPing(downloadHandle, it);
if (blSpeedTest)
{
if (delay > 0)
{
await DoSpeedTest(downloadHandle, it);
}
else
{
UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
}
await DoSpeedTest(downloadHandle, it);
}
}
else
@ -296,14 +289,13 @@ namespace ServiceLib.Services
Task.WaitAll(tasks.ToArray());
}
private async Task<int> DoRealPing(DownloadService downloadHandle, ServerTestItem it)
private async Task DoRealPing(DownloadService downloadHandle, ServerTestItem it)
{
var webProxy = new WebProxy($"socks5://{Global.Loopback}:{it.Port}");
var responseTime = await downloadHandle.GetRealPingTime(_config.SpeedTestItem.SpeedPingTestUrl, webProxy, 10);
ProfileExHandler.Instance.SetTestDelay(it.IndexId, responseTime);
UpdateFunc(it.IndexId, responseTime.ToString());
return responseTime;
}
private async Task DoSpeedTest(DownloadService downloadHandle, ServerTestItem it)

View file

@ -237,8 +237,8 @@ namespace ServiceLib.Services
public async Task UpdateGeoFileAll(Config config, Action<bool, string> updateFunc)
{
await UpdateGeoFiles(config, updateFunc);
await UpdateOtherFiles(config, updateFunc);
await UpdateGeoFile("geosite", config, updateFunc);
await UpdateGeoFile("geoip", config, updateFunc);
await UpdateSrsFileAll(config, updateFunc);
_updateFunc?.Invoke(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
}
@ -479,7 +479,7 @@ namespace ServiceLib.Services
#region Geo private
private async Task UpdateGeoFiles(Config config, Action<bool, string> updateFunc)
private async Task UpdateGeoFile(string geoName, Config config, Action<bool, string> updateFunc)
{
_updateFunc = updateFunc;
@ -487,28 +487,11 @@ namespace ServiceLib.Services
? Global.GeoUrl
: config.ConstItem.GeoSourceUrl;
List<string> files = ["geosite", "geoip"];
foreach (var geoName in files)
{
var fileName = $"{geoName}.dat";
var targetPath = Utils.GetBinPath($"{fileName}");
var url = string.Format(geoUrl, geoName);
var fileName = $"{geoName}.dat";
var targetPath = Utils.GetBinPath($"{fileName}");
var url = string.Format(geoUrl, geoName);
await DownloadGeoFile(url, fileName, targetPath, updateFunc);
}
}
private async Task UpdateOtherFiles(Config config, Action<bool, string> updateFunc)
{
_updateFunc = updateFunc;
foreach (var url in Global.OtherGeoUrls)
{
var fileName = Path.GetFileName(url);
var targetPath = Utils.GetBinPath($"{fileName}");
await DownloadGeoFile(url, fileName, targetPath, updateFunc);
}
await DownloadGeoFile(url, fileName, targetPath, updateFunc);
}
private async Task UpdateSrsFileAll(Config config, Action<bool, string> updateFunc)

View file

@ -49,7 +49,8 @@
<ListBox
x:Name="lstCheckUpdates"
BorderThickness="1"
ItemsSource="{Binding CheckUpdateModels}">
ItemsSource="{Binding CheckUpdateModels}"
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />

View file

@ -87,7 +87,8 @@
<ListBox
x:Name="lstProxyGroups"
DockPanel.Dock="Left"
ItemsSource="{Binding ProxyGroups}">
ItemsSource="{Binding ProxyGroups}"
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
@ -95,11 +96,11 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Label
<Border
Width="160"
Margin="-4,-6"
Margin="-8,-4"
Padding="0"
Theme="{DynamicResource TagLabel}">
Theme="{StaticResource CardBorder}">
<Grid Margin="{StaticResource Margin4}" RowDefinitions="1*,8,1*">
<DockPanel Grid.Row="0">
<TextBlock DockPanel.Dock="Right" Text="{Binding Type}" />
@ -107,12 +108,15 @@
</DockPanel>
<TextBlock Grid.Row="2" Text="{Binding Now}" />
</Grid>
</Label>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
<ListBox x:Name="lstProxyDetails" ItemsSource="{Binding ProxyDetails}">
<ListBox
x:Name="lstProxyDetails"
ItemsSource="{Binding ProxyDetails}"
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ContextMenu>
<ContextMenu>
<MenuItem x:Name="menuProxiesDelaytestPart" Header="{x:Static resx:ResUI.menuProxiesDelaytestPart}" />
@ -126,11 +130,11 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Label
<Border
Width="160"
Margin="-10,-6"
Margin="-12,-4"
Padding="0"
Theme="{DynamicResource TagLabel}">
Theme="{StaticResource CardBorder}">
<DockPanel>
<Border
Width="5"
@ -150,7 +154,7 @@
</DockPanel>
</Grid>
</DockPanel>
</Label>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>