Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
112c4c1595 | ||
|
|
7b9ba5e8a0 | ||
|
|
f27d3c9111 | ||
|
|
6ab74d449e | ||
|
|
ceed57c0f2 | ||
|
|
8ca203f34b | ||
|
|
d4de20aa96 | ||
|
|
c94dec40a1 | ||
|
|
b829114c4f | ||
|
|
a3a32bf5fa | ||
|
|
faa7cc5b13 | ||
|
|
1e506f9930 | ||
|
|
217449ba54 | ||
|
|
55b79c4d4e | ||
|
|
a6c5fed203 | ||
|
|
b7e31d1c9c |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 867 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 929 KiB After Width: | Height: | Size: 924 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1000" height="1000" viewBox="0 0 1000 1000" fill="none"><g opacity="1" transform="translate(0 0) rotate(0)"><mask id="bg-mask-0" fill="white"><use transform="translate(0 0) rotate(0)" xlink:href="#path_0"></use></mask><g mask="url(#bg-mask-0)" ><path id="路径 1" fill-rule="evenodd" style="fill:#8B44AC" opacity="1" d="M458.004,207.814c23.05,-3.91 80.67,-2.15 104.11,2.93c56.64,12.11 104.49,37.3 145.31,76.17c51.17,48.63 82.62,111.33 91.4,181.84c1.18,10.15 1.96,76.95 1.96,174.21v157.82h-154.3v-17.58c0,-9.77 -0.39,-17.58 -0.98,-17.58c-0.58,0 -7.03,2.93 -14.25,6.64c-23.83,11.92 -49.03,19.92 -81.45,25.59c-20.7,3.71 -67.38,4.1 -88.87,0.97c-97.85,-14.06 -181.83,-74.8 -226.17,-163.08c-7.42,-15.04 -19.92,-47.66 -19.92,-52.35c0,-1.36 5.47,-4.88 12.11,-8c31.25,-14.46 50.39,-50.98 44.53,-84.77c-4.49,-25.98 -21.48,-48.83 -44.73,-59.96c-6.64,-3.12 -11.91,-6.84 -11.91,-8.2c0,-4.3 13.48,-39.46 20.7,-53.52c19.34,-38.87 57.42,-83.4 92,-107.81c38.67,-27.34 82.81,-45.51 130.46,-53.32zM474.614,362.114c-53.13,11.32 -94.54,49.41 -110.55,101.75c-5.08,16.6 -5.27,61.53 -0.2,77.93c33.6,108.99 167.58,140.43 244.53,57.42c14.26,-15.42 28.13,-41.01 33.21,-61.13c4.69,-18.75 4.29,-53.51 -0.78,-72.26c-13.48,-48.64 -49.22,-85.16 -98.83,-100.39c-17.58,-5.47 -49.61,-7.04 -67.38,-3.32z"></path><path id="路径 2" fill-rule="evenodd" style="fill:#8B44AC" opacity="1" d="M153.907 541.604C187.107 573.824 242.387 553.514 245.707 508.004C246.877 489.644 242.577 477.344 230.667 465.034C216.407 450.394 192.777 445.114 173.247 451.954C136.917 465.034 126.167 514.454 153.907 541.604Z"></path></g></g><defs><rect id="path_0" x="0" y="0" width="1000.0000000000001" height="1000" /></defs></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1000" height="1000" fill="none" viewBox="0 0 1000 1000"><g opacity="1" transform="translate(0 0) rotate(0)"><mask id="bg-mask-0" fill="#fff"><use transform="translate(0 0) rotate(0)" xlink:href="#path_0"/></mask><g mask="url(#bg-mask-0)"><path id="路径 1" fill-rule="evenodd" style="fill:#8b44ac" d="M458.004,207.814c23.05,-3.91 80.67,-2.15 104.11,2.93c56.64,12.11 104.49,37.3 145.31,76.17c51.17,48.63 82.62,111.33 91.4,181.84c1.18,10.15 1.96,76.95 1.96,174.21v157.82h-154.3v-17.58c0,-9.77 -0.39,-17.58 -0.98,-17.58c-0.58,0 -7.03,2.93 -14.25,6.64c-23.83,11.92 -49.03,19.92 -81.45,25.59c-20.7,3.71 -67.38,4.1 -88.87,0.97c-97.85,-14.06 -181.83,-74.8 -226.17,-163.08c-7.42,-15.04 -19.92,-47.66 -19.92,-52.35c0,-1.36 5.47,-4.88 12.11,-8c31.25,-14.46 50.39,-50.98 44.53,-84.77c-4.49,-25.98 -21.48,-48.83 -44.73,-59.96c-6.64,-3.12 -11.91,-6.84 -11.91,-8.2c0,-4.3 13.48,-39.46 20.7,-53.52c19.34,-38.87 57.42,-83.4 92,-107.81c38.67,-27.34 82.81,-45.51 130.46,-53.32zM474.614,362.114c-53.13,11.32 -94.54,49.41 -110.55,101.75c-5.08,16.6 -5.27,61.53 -0.2,77.93c33.6,108.99 167.58,140.43 244.53,57.42c14.26,-15.42 28.13,-41.01 33.21,-61.13c4.69,-18.75 4.29,-53.51 -0.78,-72.26c-13.48,-48.64 -49.22,-85.16 -98.83,-100.39c-17.58,-5.47 -49.61,-7.04 -67.38,-3.32z" opacity="1"/><path id="路径 2" fill-rule="evenodd" style="fill:#8b44ac" d="M153.907 541.604C187.107 573.824 242.387 553.514 245.707 508.004C246.877 489.644 242.577 477.344 230.667 465.034C216.407 450.394 192.777 445.114 173.247 451.954C136.917 465.034 126.167 514.454 153.907 541.604Z" opacity="1"/></g></g><defs><rect id="path_0" width="1000" height="1000" x="0" y="0"/></defs></svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
@@ -21,7 +21,7 @@ public static partial class AssemblyInfo
|
||||
/// <summary>
|
||||
/// RC 版本号,范围 0~9,只增不减
|
||||
/// </summary>
|
||||
const string ver_for_rc = "9";
|
||||
const string ver_for_rc = "10";
|
||||
|
||||
public const string FileVersion = $"{Version2}.{ver_for_rc}1{ver_for_preview}.0";
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 124 KiB |
@@ -65,7 +65,7 @@
|
||||
</spp:AppItem>
|
||||
|
||||
<spp:AppItem
|
||||
Title="Wo Long: Fallen Dynasty (卧龙:苍天陨落)"
|
||||
Title="Wo Long: Fallen Dynasty (卧龙:苍天陨落)(卧龙:苍天陨落)(卧龙:苍天陨落)(卧龙:苍天陨落)"
|
||||
MaxHeight="120"
|
||||
Description="This is a description of whatver this does"
|
||||
Tags="111">
|
||||
@@ -181,7 +181,7 @@
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,5"
|
||||
Margin="0,5,12,5"
|
||||
VerticalAlignment="Top"
|
||||
Classes="CaptionTextBlockStyle"
|
||||
FontSize="12"
|
||||
|
||||
@@ -63,6 +63,12 @@ sealed class DnsDohAnalysisService : GeneralHttpClientFactory
|
||||
var client = new HttpClient(handler);
|
||||
client.BaseAddress = dohAddresUri;
|
||||
var dnsClient = new DnsHttpClient(client);
|
||||
//暂未考虑释放问题 注意!
|
||||
//foreach (var dc in dnsClients.Values)
|
||||
//{
|
||||
// dc.Dispose();
|
||||
//}
|
||||
//dnsClients.Clear();
|
||||
dnsClients.TryAdd(dohAddresUri, dnsClient);
|
||||
return dnsClient;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,10 @@ static class WinDivertInitHelper
|
||||
|
||||
void GetData()
|
||||
{
|
||||
if (data != default)
|
||||
if (data == default)
|
||||
{
|
||||
data = GetWinDivertBinRes();
|
||||
}
|
||||
}
|
||||
|
||||
if (libraryPath != null && libraryDirPath != null)
|
||||
|
||||
@@ -375,7 +375,13 @@ internal partial class NetworkTestService : INetworkTestService
|
||||
DnsQueryAnswerRecord.DnsRecordType dnsRecordType = DnsQueryAnswerRecord.DnsRecordType.A,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
UseCookies = false,
|
||||
UseProxy = false,
|
||||
Proxy = HttpNoProxy.Instance,
|
||||
};
|
||||
using HttpClient client = new HttpClient(handler);
|
||||
|
||||
string queryUrl = $"{dohServer}?name={testDomain}&type={dnsRecordType}";
|
||||
|
||||
|
||||
@@ -770,6 +770,11 @@ public sealed partial class GameAcceleratorService
|
||||
|
||||
public async Task ShowXunYouWindow(bool showHide)
|
||||
{
|
||||
//if (UserService.Current.User?.WattOpenId != null)
|
||||
// await Ioc.Get<IAcceleratorService>().XY_StartEx2(
|
||||
// UserService.Current.User.WattOpenId,
|
||||
// UserService.Current.User.NickName, 0, 0, 0);
|
||||
|
||||
var result = await Ioc.Get<IAcceleratorService>().XY_ShowWinodw(showHide);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 872 KiB |
@@ -95,14 +95,14 @@ public sealed partial class AcceleratorPageViewModel
|
||||
|
||||
DNSCheckCommand = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
var testDomain = DomainPendingTest == string.Empty ? "steamcommunity.com" : DomainPendingTest;
|
||||
var testDomain = DomainPendingTest == string.Empty ? "store.steampowered.com" : DomainPendingTest;
|
||||
try
|
||||
{
|
||||
long delayMs;
|
||||
IPAddress[] address;
|
||||
if (ProxySettings.UseDoh)
|
||||
{
|
||||
var configDoh = ProxySettings.CustomDohAddres.Value ?? string.Empty;
|
||||
var configDoh = ProxySettings.CustomDohAddres.Value ?? ProxySettingsWindowViewModel.DohAddress.FirstOrDefault() ?? string.Empty;
|
||||
(delayMs, address) = await networkTestService.TestDNSOverHttpsAsync(testDomain, configDoh);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Media;
|
||||
using System.Reactive;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class ProxyDomainViewModel : ReactiveObject
|
||||
<= DelayMiddle => Brushes.Green,
|
||||
> DelayMiddle => Brushes.Orange,
|
||||
},
|
||||
_ => (IBrush?)App.Instance.FindResource("TextFillColorPrimaryBrush"),
|
||||
_ => Brushes.Gray,
|
||||
})
|
||||
.ToPropertyEx(this, x => x.DelayColor);
|
||||
}
|
||||
@@ -104,7 +105,7 @@ public sealed partial class AcceleratorPageViewModel : TabItemViewModel
|
||||
[Reactive]
|
||||
public string SelectedSTUNAddress { get; set; }
|
||||
|
||||
public List<string> STUNAddress { get; } =
|
||||
public string[] STUNAddress { get; } =
|
||||
[
|
||||
"stun.syncthing.net",
|
||||
"stun.hot-chilli.net",
|
||||
|
||||
@@ -49,11 +49,6 @@
|
||||
</ui:SettingsExpander.Footer>
|
||||
<ui:SettingsExpanderItem Theme="{StaticResource SettingsExpanderItem2}">
|
||||
<TreeView ItemsSource="{Binding EnableProxyDomainVMs}" SelectionMode="Single">
|
||||
<TreeView.ItemContainerTheme>
|
||||
<ControlTheme BasedOn="{StaticResource {x:Type TreeViewItem}}" TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="True" />
|
||||
</ControlTheme>
|
||||
</TreeView.ItemContainerTheme>
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}">
|
||||
<DockPanel Margin="8,0">
|
||||
|
||||
@@ -34,13 +34,11 @@
|
||||
<ui:SettingsExpander.Footer>
|
||||
<WrapPanel>
|
||||
<ui:FAComboBox
|
||||
x:Name="STUNServer"
|
||||
Margin="4"
|
||||
x:FieldModifier="public"
|
||||
IsEditable="False"
|
||||
IsEnabled="{Binding !IsNATChecking}"
|
||||
ItemsSource="{Binding STUNAddress}"
|
||||
SelectedItem="{Binding SelectedSTUNAddress}"
|
||||
SelectedItem="{Binding SelectedSTUNAddress, Mode=TwoWay}"
|
||||
ToolTip.Tip="STUN 服务器地址">
|
||||
<ui:FAComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="sys:String">
|
||||
@@ -53,6 +51,7 @@
|
||||
Width="100"
|
||||
Margin="4"
|
||||
x:FieldModifier="public"
|
||||
Command="{Binding NATCheckCommand}"
|
||||
Content="检测"
|
||||
IsEnabled="True" />
|
||||
</WrapPanel>
|
||||
@@ -102,9 +101,9 @@
|
||||
HorizontalAlignment="Right"
|
||||
IsVisible="{Binding IsNATChecking}" />
|
||||
<SelectableTextBlock
|
||||
x:Name="LocalIPAddress"
|
||||
Foreground="Gray"
|
||||
IsVisible="{Binding !IsNATChecking}" />
|
||||
IsVisible="{Binding !IsNATChecking}"
|
||||
Text="{Binding LocalEndPoint}" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem.Footer>
|
||||
</ui:SettingsExpanderItem>
|
||||
@@ -174,16 +173,43 @@
|
||||
<Separator Margin="-64,0" Classes="Horizontal" />
|
||||
|
||||
<ui:SettingsExpanderItem Margin="-28,0,0,-4" Background="Transparent">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="相关链接" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="相关链接" />
|
||||
</ui:SettingsExpanderItem>
|
||||
|
||||
<ui:SettingsExpanderItem Margin="-28,-24,0,-4" Background="Transparent">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="解决NAT错误"
|
||||
Content="XBOX 关于 NAT 文档"
|
||||
NavigateUri="https://support.xbox.com/zh-CN/help/hardware-network/connect-network/xbox-one-nat-error" />
|
||||
</StackPanel>
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="PlayStation 关于 NAT 文档"
|
||||
NavigateUri="https://manuals.playstation.net/document/ct/ps4/settings/nw_test.html" />
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="Nintendo Switch 关于 NAT 文档"
|
||||
NavigateUri="https://www.nintendoswitch.com.cn/support/faq/373.html" />
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="Bungie 关于 NAT 文档"
|
||||
NavigateUri="https://help.bungie.net/hc/zh-cn/articles/360049496751-%E9%AB%98%E7%BA%A7%E7%96%91%E9%9A%BE%E6%8E%92%E8%A7%A3-%E9%80%9A%E7%94%A8%E5%8D%B3%E6%8F%92%E5%8D%B3%E7%94%A8-%E7%AB%AF%E5%8F%A3%E8%BD%AC%E9%80%81%E4%B8%8E%E7%BD%91%E7%BB%9C%E5%9C%B0%E5%9D%80%E8%BD%AC%E6%8D%A2%E7%B1%BB%E5%9E%8B" />
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="Activision 关于 NAT 文档"
|
||||
NavigateUri="https://support.activision.com/tw/zh/articles/port-forward-and-nat-faq" />
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="RockStar Games 关于 NAT 文档"
|
||||
NavigateUri="https://support.rockstargames.com/tw/articles/206210548/%E5%A6%82%E4%BD%95%E8%A7%A3%E6%B1%BA-GTA-%E7%B7%9A%E4%B8%8A%E6%A8%A1%E5%BC%8F%E4%B8%AD%E8%88%87%E5%9A%B4%E6%A0%BC-Strict-NAT-%E9%A1%9E%E5%9E%8B%E7%9B%B8%E9%97%9C%E7%9A%84%E9%8C%AF%E8%AA%A4" />
|
||||
<HyperlinkButton
|
||||
VerticalAlignment="Center"
|
||||
Content="迅游关于 NAT 文档"
|
||||
NavigateUri="https://cs.xunyou.com/html/282/15271.shtml" />
|
||||
</WrapPanel>
|
||||
</ui:SettingsExpanderItem>
|
||||
</StackPanel>
|
||||
</ui:SettingsExpander>
|
||||
@@ -204,8 +230,8 @@
|
||||
</ui:SettingsExpander.Header>
|
||||
<ui:SettingsExpander.Footer>
|
||||
<Button
|
||||
x:Name="DNSCheckButton"
|
||||
Width="100"
|
||||
Command="{Binding DNSCheckCommand}"
|
||||
Content="检测"
|
||||
IsEnabled="True" />
|
||||
</ui:SettingsExpander.Footer>
|
||||
@@ -225,9 +251,9 @@
|
||||
<TextBlock Text="待检测的域名" />
|
||||
<ui:SettingsExpanderItem.Footer>
|
||||
<TextBox
|
||||
x:Name="DomainTextBox"
|
||||
Width="200"
|
||||
Watermark="steamcommunity.com" />
|
||||
Text="{Binding DomainPendingTest, Mode=TwoWay}"
|
||||
Watermark="store.steampowered.com" />
|
||||
</ui:SettingsExpanderItem.Footer>
|
||||
</ui:SettingsExpanderItem>
|
||||
|
||||
@@ -235,9 +261,8 @@
|
||||
<TextBlock Text="{Binding Path=Res.Settings_Proxy_CustomDNS, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
<ui:SettingsExpanderItem.Footer>
|
||||
<ui:FAComboBox
|
||||
x:Name="dummy"
|
||||
Width="200"
|
||||
IsEditable="False"
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={x:Static ms:ProxySettings.UseDoh}, Path=!Value}"
|
||||
ItemsSource="{Binding Source={x:Static spp:ProxySettingsWindowViewModel.ProxyDNSs}}"
|
||||
Text="{Binding Source={x:Static ms:ProxySettings.ProxyMasterDns}, Path=Value, Mode=TwoWay}" />
|
||||
@@ -256,7 +281,7 @@
|
||||
<ui:SettingsExpanderItem.Footer>
|
||||
<ui:FAComboBox
|
||||
Width="200"
|
||||
IsEditable="False"
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={x:Static ms:ProxySettings.UseDoh}, Path=Value}"
|
||||
ItemsSource="{Binding Source={x:Static spp:ProxySettingsWindowViewModel.DohAddress}}"
|
||||
PlaceholderText="{Binding Source={x:Static s:IDnsAnalysisService.Dnspod_DohAddres}, Mode=OneWay}"
|
||||
|
||||
@@ -10,8 +10,5 @@ public partial class NetworkCheck : UserControl
|
||||
public NetworkCheck()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.dummy.SelectedItem = ProxySettings.ProxyMasterDns.Value;
|
||||
this.dummy.Text = ProxySettings.ProxyMasterDns.Value;
|
||||
}
|
||||
}
|
||||
@@ -671,6 +671,7 @@
|
||||
<!-- 网络检测 -->
|
||||
<spp:NetworkCheck x:Name="NetworkCheckControl" />
|
||||
|
||||
<TabItem Content="dummy_tab_for_transisit_animation" />
|
||||
</Carousel>
|
||||
|
||||
<!-- Side tab of paid game spped up -->
|
||||
|
||||
@@ -74,12 +74,6 @@ public partial class AcceleratorPage2 : PageBase<AcceleratorPageViewModel>
|
||||
AcceleratorTabs.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedSTUNAddress, v => v.NetworkCheckControl.STUNServer.SelectedItem).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.NATCheckCommand, v => v.NetworkCheckControl.NATCheckButton).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.LocalEndPoint, v => v.NetworkCheckControl.LocalIPAddress.Text).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.DNSCheckCommand, v => v.NetworkCheckControl.DNSCheckButton).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.DomainPendingTest, v => v.NetworkCheckControl.DomainTextBox.Text).DisposeWith(disposables);
|
||||
|
||||
NetworkCheckControl.PingOK.IsVisible = false;
|
||||
NetworkCheckControl.PingError.IsVisible = false;
|
||||
NetworkCheckControl.NATCheckButton.Click += (_, _) => NetworkCheckControl.PingError.IsVisible = NetworkCheckControl.PingOK.IsVisible = false;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<ui:SettingsExpanderItem.Footer>
|
||||
<ui:FAComboBox
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={x:Static ms:ProxySettings.UseDoh}, Path=!Value}"
|
||||
ItemsSource="{Binding ProxyDNSs}"
|
||||
Text="{Binding Source={x:Static ms:ProxySettings.ProxyMasterDns}, Path=Value, Mode=TwoWay}" />
|
||||
</ui:SettingsExpanderItem.Footer>
|
||||
@@ -78,6 +79,7 @@
|
||||
<ui:SettingsExpanderItem.Footer>
|
||||
<ui:FAComboBox
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={x:Static ms:ProxySettings.UseDoh}, Path=Value}"
|
||||
ItemsSource="{Binding DohAddress}"
|
||||
PlaceholderText="{Binding Source={x:Static s:IDnsAnalysisService.Dnspod_DohAddres}, Mode=OneWay}"
|
||||
Text="{Binding Source={x:Static ms:ProxySettings.CustomDohAddres}, Path=Value, Mode=TwoWay}" />
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
Description="{Binding Description, Source={x:Static s:Plugin.Instance}, Mode=OneWay}"
|
||||
Subtitle="{Binding Author, Source={x:Static s:Plugin.Instance}, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter=Plugin_Author}"
|
||||
mc:Ignorable="d">
|
||||
<spp:PageBase.Styles>
|
||||
<Style Selector="spp|AppItem /template/ TextBlock#HeaderText">
|
||||
<Setter Property="Grid.ColumnSpan" Value="0" />
|
||||
</Style>
|
||||
</spp:PageBase.Styles>
|
||||
<spp:PageBase.PreviewImage>
|
||||
<ui:ImageIconSource Source="avares://BD.WTTS.Client.Plugins.Accelerator/UI/Assets/script.ico" />
|
||||
</spp:PageBase.PreviewImage>
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
x:DataType="spp:AuthenticatorItemModel"
|
||||
Classes.IsActive="{Binding IsSelected}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="spp|AppItem /template/ TextBlock#HeaderText">
|
||||
<Setter Property="Grid.ColumnSpan" Value="0" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<spp:AppItem
|
||||
Title="{Binding AuthName}"
|
||||
Description="{Binding AuthData.Created, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\Cookies": "Cookies",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\Sessions": "Sessions",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\RiotClientPrivateSettings.yaml": "RiotClientPrivateSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\RiotGamesPrivateSettings.yaml": "RiotGamesPrivateSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Config\\RiotClientSettings.yaml": "RiotClientSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\WattToolkit.id": "WattToolkit.id"
|
||||
},
|
||||
@@ -177,8 +178,7 @@
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\webcache\\common\\Session Storage\\*.log": "ProgramData\\Session Storage\\",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\webcache\\common\\Session Storage\\*.ldb": "ProgramData\\Session Storage\\",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\webcache\\common\\Cookies": "ProgramData\\Cookies",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\storage\\etags.db": "ProgramData\\storage\\etags.db",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\storage\\galaxy-2.0.db*": "ProgramData\\storage\\",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\storage\\*": "ProgramData\\storage\\",
|
||||
"%ProgramData%\\GOG.com\\Galaxy\\config.json": "ProgramData\\config.json"
|
||||
},
|
||||
"ProfilePicPath": "%ProgramData%\\GOG.com\\Galaxy\\webcache\\%UniqueId%\\user\\%LARGEST%.jpg",
|
||||
|
||||
@@ -93,8 +93,14 @@ public sealed partial class GameAccountPageViewModel
|
||||
{
|
||||
GamePlatforms?[0].LoadUsers();
|
||||
|
||||
if (!OperatingSystem2.IsWindows())
|
||||
{
|
||||
AddGamePlatforms = [];
|
||||
return;
|
||||
}
|
||||
|
||||
var temp = GetSupportPlatforms();
|
||||
if (temp != null && OperatingSystem2.IsWindows())
|
||||
if (temp != null)
|
||||
{
|
||||
if (GameAccountSettings.EnablePlatforms.Any_Nullable())
|
||||
{
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
</DataTemplate>
|
||||
</MenuItem.DataTemplates>-->
|
||||
</MenuItem>
|
||||
<MenuItem Header="-" />
|
||||
<MenuItem Header="-" IsVisible="{Binding !!AddGamePlatforms.Count}" />
|
||||
<MenuItem Command="{Binding LoginNewCommand}" Header="{Binding Path=Res.UserChange_LoginNewAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
|
||||
<MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Add" />
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 894 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -122,7 +122,7 @@
|
||||
<PackageReference Include="Squid-Box.SevenZipSharp.Lite" />
|
||||
<PackageReference Include="SharpZipLib" />
|
||||
<PackageReference Include="ZstdNet" />
|
||||
<!--<PackageReference Include="BsDiff" />-->
|
||||
<PackageReference Include="BsDiff" />
|
||||
<PackageReference Include="7-Zip.NativeAssets.Win32" />
|
||||
<PackageReference Include="Portable.BouncyCastle" />
|
||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" />
|
||||
|
||||
@@ -1,492 +1,492 @@
|
||||
//using BsDiff;
|
||||
//using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
//using BD.WTTS.Models;
|
||||
using BsDiff;
|
||||
using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
using BD.WTTS.Models;
|
||||
|
||||
//namespace BD.WTTS.Client.Tools.Publish.Commands;
|
||||
namespace BD.WTTS.Client.Tools.Publish.Commands;
|
||||
|
||||
//interface IGenerateBsPatch : ICommand
|
||||
//{
|
||||
// const string commandName = "bs";
|
||||
// const string BaseUrl =
|
||||
//#if DEBUG
|
||||
// "https://localhost:9881";
|
||||
interface IGenerateBsPatch : ICommand
|
||||
{
|
||||
const string commandName = "bs";
|
||||
const string BaseUrl =
|
||||
#if DEBUG
|
||||
"https://localhost:9881";
|
||||
|
||||
//#else
|
||||
// "http://192.168.2.16:19001";
|
||||
//#endif
|
||||
#else
|
||||
"http://192.168.2.16:19001";
|
||||
#endif
|
||||
|
||||
// static Command ICommand.GetCommand()
|
||||
// {
|
||||
// var type = new Option<int>("--type", "type 0:Create 1:Apply 2:UploadFile 3:传入版本号生成补丁");
|
||||
// //旧文件
|
||||
// var oldFile = new Option<string>("--old", "old file");
|
||||
// //新文件
|
||||
// var newFile = new Option<string>("--new", "new file");
|
||||
// //保存路径
|
||||
// var patchFile = new Option<string>("--path", "new file");
|
||||
// //程序版本号
|
||||
// var clientPlatform = new Option<ClientPlatform>("--platform", "ClientPlatform");
|
||||
static Command ICommand.GetCommand()
|
||||
{
|
||||
var type = new Option<int>("--type", "type 0:Create 1:Apply 2:UploadFile 3:传入版本号生成补丁");
|
||||
//旧文件
|
||||
var oldFile = new Option<string>("--old", "old file");
|
||||
//新文件
|
||||
var newFile = new Option<string>("--new", "new file");
|
||||
//保存路径
|
||||
var patchFile = new Option<string>("--path", "new file");
|
||||
//程序版本号
|
||||
var clientPlatform = new Option<ClientPlatform>("--platform", "ClientPlatform");
|
||||
|
||||
// var command = new Command(commandName, "Bridge csproj xml generate")
|
||||
// {
|
||||
// type, oldFile, newFile, patchFile, clientPlatform
|
||||
// };
|
||||
// command.SetHandler(Handler, type, oldFile, newFile, patchFile, clientPlatform);
|
||||
// return command;
|
||||
// }
|
||||
var command = new Command(commandName, "Bridge csproj xml generate")
|
||||
{
|
||||
type, oldFile, newFile, patchFile, clientPlatform
|
||||
};
|
||||
command.SetHandler(Handler, type, oldFile, newFile, patchFile, clientPlatform);
|
||||
return command;
|
||||
}
|
||||
|
||||
// internal static void Handler(int type, string oldFile, string newFile, string patchFile, ClientPlatform platform = ClientPlatform.Win32X64)
|
||||
// {
|
||||
// if (type < 2)
|
||||
// {
|
||||
// if (!File.Exists(oldFile))
|
||||
// {
|
||||
// Console.WriteLine("old file not exists");
|
||||
// return;
|
||||
// }
|
||||
// if (!File.Exists(newFile))
|
||||
// {
|
||||
// Console.WriteLine("new file not exists");
|
||||
// return;
|
||||
// }
|
||||
// if (string.IsNullOrWhiteSpace(patchFile))
|
||||
// {
|
||||
// Console.WriteLine("The patch file path cannot be empty");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// switch (type)
|
||||
// {
|
||||
// case 0:
|
||||
// using (var output = new FileStream(patchFile, FileMode.Create))
|
||||
// GenerateBsPatch(File.ReadAllBytes(oldFile), File.ReadAllBytes(newFile), output);
|
||||
// break;
|
||||
// case 1:
|
||||
// using (var input = new FileStream(oldFile, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
// using (var output = new FileStream(newFile, FileMode.Create))
|
||||
// BinaryPatch.Apply(input, () => new FileStream(patchFile, FileMode.Open, FileAccess.Read, FileShare.Read), output);
|
||||
// break;
|
||||
// case 2:
|
||||
// UploadFiles(oldFile).Wait();
|
||||
// break;
|
||||
// case 3:
|
||||
// GenerateAppPublishPatchBundleInfo(oldFile, newFile, platform, patchFile).Wait();
|
||||
// break;
|
||||
// case 4:
|
||||
// UploadAppVer(oldFile, newFile, platform).Wait();
|
||||
// break;
|
||||
// case 5:
|
||||
// ApplyPatch(oldFile, newFile, patchFile).Wait();
|
||||
// break;
|
||||
internal static void Handler(int type, string oldFile, string newFile, string patchFile, ClientPlatform platform = ClientPlatform.Win32X64)
|
||||
{
|
||||
if (type < 2)
|
||||
{
|
||||
if (!File.Exists(oldFile))
|
||||
{
|
||||
Console.WriteLine("old file not exists");
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(newFile))
|
||||
{
|
||||
Console.WriteLine("new file not exists");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(patchFile))
|
||||
{
|
||||
Console.WriteLine("The patch file path cannot be empty");
|
||||
return;
|
||||
}
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
using (var output = new FileStream(patchFile, FileMode.Create))
|
||||
GenerateBsPatch(File.ReadAllBytes(oldFile), File.ReadAllBytes(newFile), output);
|
||||
break;
|
||||
case 1:
|
||||
using (var input = new FileStream(oldFile, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var output = new FileStream(newFile, FileMode.Create))
|
||||
BinaryPatch.Apply(input, () => new FileStream(patchFile, FileMode.Open, FileAccess.Read, FileShare.Read), output);
|
||||
break;
|
||||
case 2:
|
||||
UploadFiles(oldFile).Wait();
|
||||
break;
|
||||
case 3:
|
||||
GenerateAppPublishPatchBundleInfo(oldFile, newFile, platform, patchFile).Wait();
|
||||
break;
|
||||
case 4:
|
||||
UploadAppVer(oldFile, newFile, platform).Wait();
|
||||
break;
|
||||
case 5:
|
||||
ApplyPatch(oldFile, newFile, patchFile).Wait();
|
||||
break;
|
||||
|
||||
// }
|
||||
// Console.WriteLine("end");
|
||||
// }
|
||||
}
|
||||
Console.WriteLine("end");
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 应用补丁
|
||||
// /// </summary>
|
||||
// /// <param name="applyPath"></param>
|
||||
// /// <param name="saveFilePath"></param>
|
||||
// /// <param name="patchPath"></param>
|
||||
// /// <returns></returns>
|
||||
// internal static async ThreadTask ApplyPatch(string applyPath, string saveFilePath, string patchPath)
|
||||
// {
|
||||
// if (!File.Exists(patchPath))
|
||||
// {
|
||||
// Console.WriteLine("PatchPath not exists");
|
||||
// return;
|
||||
// }
|
||||
/// <summary>
|
||||
/// 应用补丁
|
||||
/// </summary>
|
||||
/// <param name="applyPath"></param>
|
||||
/// <param name="saveFilePath"></param>
|
||||
/// <param name="patchPath"></param>
|
||||
/// <returns></returns>
|
||||
internal static async ThreadTask ApplyPatch(string applyPath, string saveFilePath, string patchPath)
|
||||
{
|
||||
if (!File.Exists(patchPath))
|
||||
{
|
||||
Console.WriteLine("PatchPath not exists");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (!Directory.Exists(applyPath))
|
||||
// {
|
||||
// Console.WriteLine("ApplyPath not exists");
|
||||
// return;
|
||||
// }
|
||||
// var fileStream = File.OpenRead(patchPath);
|
||||
// var jsonData = new BrotliStream(fileStream, CompressionMode.Decompress);
|
||||
// var dic = await MemoryPackSerializer.DeserializeAsync<Dictionary<string, PatchBundleInfo?>>(jsonData);
|
||||
// if (dic is null)
|
||||
// {
|
||||
// Console.WriteLine("Patch Error");
|
||||
// return;
|
||||
// }
|
||||
// if (!Directory.Exists(saveFilePath))
|
||||
// {
|
||||
// Directory.CreateDirectory(saveFilePath);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Directory.Delete(saveFilePath);
|
||||
// }
|
||||
// CopyDirectory(applyPath, saveFilePath);
|
||||
// FileInfo? fileInfo = null;
|
||||
// foreach (var item in dic.Where(x => x.Value is not null))
|
||||
// {
|
||||
// PatchBundleInfo info = item.Value!;
|
||||
// if (info.PatchData is not null)
|
||||
// {
|
||||
// fileInfo = new FileInfo(Path.Combine(saveFilePath, item.Key));
|
||||
// if (!(fileInfo.Directory?.Exists ?? false))
|
||||
// fileInfo.Directory?.Create();
|
||||
// if (info.IsFullOrPatch)
|
||||
// {
|
||||
// File.WriteAllBytes(Path.Combine(saveFilePath, item.Key), info.PatchData);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// using var oldFile = File.OpenRead(Path.Combine(applyPath, item.Key));
|
||||
// var newFile = Path.Combine(saveFilePath, item.Key);
|
||||
// using var saveFile = File.Exists(newFile) ? File.Create(newFile) : File.OpenWrite(newFile);
|
||||
// BinaryPatch.Apply(oldFile, () => new MemoryStream(info.PatchData), saveFile);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Console.WriteLine("ApplyPatch OK");
|
||||
// }
|
||||
if (!Directory.Exists(applyPath))
|
||||
{
|
||||
Console.WriteLine("ApplyPath not exists");
|
||||
return;
|
||||
}
|
||||
var fileStream = File.OpenRead(patchPath);
|
||||
var jsonData = new BrotliStream(fileStream, CompressionMode.Decompress);
|
||||
var dic = await MemoryPackSerializer.DeserializeAsync<Dictionary<string, PatchBundleInfo?>>(jsonData);
|
||||
if (dic is null)
|
||||
{
|
||||
Console.WriteLine("Patch Error");
|
||||
return;
|
||||
}
|
||||
if (!Directory.Exists(saveFilePath))
|
||||
{
|
||||
Directory.CreateDirectory(saveFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.Delete(saveFilePath);
|
||||
}
|
||||
CopyDirectory(applyPath, saveFilePath);
|
||||
FileInfo? fileInfo = null;
|
||||
foreach (var item in dic.Where(x => x.Value is not null))
|
||||
{
|
||||
PatchBundleInfo info = item.Value!;
|
||||
if (info.PatchData is not null)
|
||||
{
|
||||
fileInfo = new FileInfo(Path.Combine(saveFilePath, item.Key));
|
||||
if (!(fileInfo.Directory?.Exists ?? false))
|
||||
fileInfo.Directory?.Create();
|
||||
if (info.IsFullOrPatch)
|
||||
{
|
||||
File.WriteAllBytes(Path.Combine(saveFilePath, item.Key), info.PatchData);
|
||||
}
|
||||
else
|
||||
{
|
||||
using var oldFile = File.OpenRead(Path.Combine(applyPath, item.Key));
|
||||
var newFile = Path.Combine(saveFilePath, item.Key);
|
||||
using var saveFile = File.Exists(newFile) ? File.Create(newFile) : File.OpenWrite(newFile);
|
||||
BinaryPatch.Apply(oldFile, () => new MemoryStream(info.PatchData), saveFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("ApplyPatch OK");
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 复制目录下的文件
|
||||
// /// </summary>
|
||||
// /// <param name="sourceDir"></param>
|
||||
// /// <param name="targetDir"></param>
|
||||
// /// <exception cref="DirectoryNotFoundException"></exception>
|
||||
// public static void CopyDirectory(string sourceDir, string targetDir)
|
||||
// {
|
||||
// DirectoryInfo dir = new DirectoryInfo(sourceDir);
|
||||
// DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
/// <summary>
|
||||
/// 复制目录下的文件
|
||||
/// </summary>
|
||||
/// <param name="sourceDir"></param>
|
||||
/// <param name="targetDir"></param>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
public static void CopyDirectory(string sourceDir, string targetDir)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(sourceDir);
|
||||
DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
|
||||
// // If the source directory does not exist, throw an exception.
|
||||
// if (!dir.Exists)
|
||||
// {
|
||||
// throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDir}");
|
||||
// }
|
||||
// If the source directory does not exist, throw an exception.
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDir}");
|
||||
}
|
||||
|
||||
// // If the destination directory does not exist, create it.
|
||||
// if (!Directory.Exists(targetDir))
|
||||
// {
|
||||
// Directory.CreateDirectory(targetDir);
|
||||
// }
|
||||
// If the destination directory does not exist, create it.
|
||||
if (!Directory.Exists(targetDir))
|
||||
{
|
||||
Directory.CreateDirectory(targetDir);
|
||||
}
|
||||
|
||||
// // Get the files in the directory and copy them to the new location.
|
||||
// FileInfo[] files = dir.GetFiles();
|
||||
// foreach (FileInfo file in files)
|
||||
// {
|
||||
// string tempPath = Path.Combine(targetDir, file.Name);
|
||||
// file.CopyTo(tempPath, false);
|
||||
// }
|
||||
// Get the files in the directory and copy them to the new location.
|
||||
FileInfo[] files = dir.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
string tempPath = Path.Combine(targetDir, file.Name);
|
||||
file.CopyTo(tempPath, false);
|
||||
}
|
||||
|
||||
// // If copying subdirectories, copy them and their contents to the new location.
|
||||
// foreach (DirectoryInfo subdir in dirs)
|
||||
// {
|
||||
// string tempPath = Path.Combine(targetDir, subdir.Name);
|
||||
// CopyDirectory(subdir.FullName, tempPath);
|
||||
// }
|
||||
// }
|
||||
// If copying subdirectories, copy them and their contents to the new location.
|
||||
foreach (DirectoryInfo subdir in dirs)
|
||||
{
|
||||
string tempPath = Path.Combine(targetDir, subdir.Name);
|
||||
CopyDirectory(subdir.FullName, tempPath);
|
||||
}
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 根据 2个 文件生成补丁
|
||||
// /// </summary>
|
||||
// /// <param name="oldByte"></param>
|
||||
// /// <param name="newByte"></param>
|
||||
// /// <param name="output"></param>
|
||||
// internal static void GenerateBsPatch(byte[] oldByte, byte[] newByte, Stream output)
|
||||
// {
|
||||
// BinaryPatch.Create(oldByte, newByte, output);
|
||||
// }
|
||||
/// <summary>
|
||||
/// 根据 2个 文件生成补丁
|
||||
/// </summary>
|
||||
/// <param name="oldByte"></param>
|
||||
/// <param name="newByte"></param>
|
||||
/// <param name="output"></param>
|
||||
internal static void GenerateBsPatch(byte[] oldByte, byte[] newByte, Stream output)
|
||||
{
|
||||
BinaryPatch.Create(oldByte, newByte, output);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 上传版本信息 加 FileList
|
||||
// /// </summary>
|
||||
// /// <param name="appVer"></param>
|
||||
// /// <param name="jsonPath">发布工具生成的 Json</param>
|
||||
// /// <param name="platform"></param>
|
||||
// /// <returns></returns>
|
||||
// internal static async ThreadTask UploadAppVer(string appVer, string jsonPath, ClientPlatform platform)
|
||||
// {
|
||||
// if (string.IsNullOrWhiteSpace(appVer))
|
||||
// {
|
||||
// Console.WriteLine("AppVer not exists");
|
||||
// return;
|
||||
// }
|
||||
// if (string.IsNullOrWhiteSpace(jsonPath))
|
||||
// {
|
||||
// Console.WriteLine("jsonPath not exists");
|
||||
// return;
|
||||
// }
|
||||
// if (!File.Exists(jsonPath))
|
||||
// {
|
||||
// Console.WriteLine("jsonPath not Find");
|
||||
// return;
|
||||
// }
|
||||
/// <summary>
|
||||
/// 上传版本信息 加 FileList
|
||||
/// </summary>
|
||||
/// <param name="appVer"></param>
|
||||
/// <param name="jsonPath">发布工具生成的 Json</param>
|
||||
/// <param name="platform"></param>
|
||||
/// <returns></returns>
|
||||
internal static async ThreadTask UploadAppVer(string appVer, string jsonPath, ClientPlatform platform)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(appVer))
|
||||
{
|
||||
Console.WriteLine("AppVer not exists");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(jsonPath))
|
||||
{
|
||||
Console.WriteLine("jsonPath not exists");
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(jsonPath))
|
||||
{
|
||||
Console.WriteLine("jsonPath not Find");
|
||||
return;
|
||||
}
|
||||
|
||||
// var fileListRaw = File.ReadAllBytes(jsonPath);
|
||||
// var appver = await GetAppVer(appVer);
|
||||
// if (appver is not null)
|
||||
// {
|
||||
// var thisFileList = appver.FileList?.FirstOrDefault(x => x.Platform == platform);
|
||||
// if (thisFileList is not null)
|
||||
// {
|
||||
// if (Hashs.String.SHA384(thisFileList.FileListRaw) != Hashs.String.SHA384(fileListRaw))
|
||||
// {
|
||||
// thisFileList.FileListRaw = fileListRaw;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (appver.FileList is null)
|
||||
// {
|
||||
// appver.FileList = new List<AppVerFileList>
|
||||
// {
|
||||
// new AppVerFileList
|
||||
// {
|
||||
// Platform = platform,
|
||||
// FileListRaw = fileListRaw
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// appver.FileList.Add(new AppVerFileList
|
||||
// {
|
||||
// Platform = platform,
|
||||
// FileListRaw = fileListRaw
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// await UploadAppVer(appver);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// appver = new AppVer
|
||||
// {
|
||||
// Platform = platform,
|
||||
// Ver = appVer,
|
||||
// Published = DateTimeOffset.Now,
|
||||
// FileList = new List<AppVerFileList>
|
||||
// {
|
||||
// new AppVerFileList
|
||||
// {
|
||||
// Platform = platform,
|
||||
// FileListRaw = fileListRaw
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// await UploadAppVer(appver);
|
||||
// }
|
||||
// }
|
||||
var fileListRaw = File.ReadAllBytes(jsonPath);
|
||||
var appver = await GetAppVer(appVer);
|
||||
if (appver is not null)
|
||||
{
|
||||
var thisFileList = appver.FileList?.FirstOrDefault(x => x.Platform == platform);
|
||||
if (thisFileList is not null)
|
||||
{
|
||||
if (Hashs.String.SHA384(thisFileList.FileListRaw) != Hashs.String.SHA384(fileListRaw))
|
||||
{
|
||||
thisFileList.FileListRaw = fileListRaw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (appver.FileList is null)
|
||||
{
|
||||
appver.FileList = new List<AppVerFileList>
|
||||
{
|
||||
new AppVerFileList
|
||||
{
|
||||
Platform = platform,
|
||||
FileListRaw = fileListRaw
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
appver.FileList.Add(new AppVerFileList
|
||||
{
|
||||
Platform = platform,
|
||||
FileListRaw = fileListRaw
|
||||
});
|
||||
}
|
||||
}
|
||||
await UploadAppVer(appver);
|
||||
}
|
||||
else
|
||||
{
|
||||
appver = new AppVer
|
||||
{
|
||||
Platform = platform,
|
||||
Ver = appVer,
|
||||
Published = DateTimeOffset.Now,
|
||||
FileList = new List<AppVerFileList>
|
||||
{
|
||||
new AppVerFileList
|
||||
{
|
||||
Platform = platform,
|
||||
FileListRaw = fileListRaw
|
||||
}
|
||||
}
|
||||
};
|
||||
await UploadAppVer(appver);
|
||||
}
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 上传版本信息
|
||||
// /// </summary>
|
||||
// /// <param name="appVer"></param>
|
||||
// /// <returns></returns>
|
||||
// internal static async ThreadTask UploadAppVer(AppVer appVer)
|
||||
// {
|
||||
// using var httpClient = new HttpClient();
|
||||
// var content = JsonContent.Create(appVer);
|
||||
// var response = await httpClient.PostAsync($"{BaseUrl}/appver/", content);
|
||||
// }
|
||||
/// <summary>
|
||||
/// 上传版本信息
|
||||
/// </summary>
|
||||
/// <param name="appVer"></param>
|
||||
/// <returns></returns>
|
||||
internal static async ThreadTask UploadAppVer(AppVer appVer)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var content = JsonContent.Create(appVer);
|
||||
var response = await httpClient.PostAsync($"{BaseUrl}/appver/", content);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 传入 2 个版本号生成补丁
|
||||
// /// </summary>
|
||||
// /// <param name="oldVer"></param>
|
||||
// /// <param name="newVer"></param>
|
||||
// /// <param name="platform"></param>
|
||||
// /// <param name="patchFilePath"></param>
|
||||
// /// <returns></returns>
|
||||
// internal static async ThreadTask GenerateAppPublishPatchBundleInfo(string oldVer, string newVer, ClientPlatform platform, string patchFilePath)
|
||||
// {
|
||||
// var oldAppVer = await GetAppVer(oldVer);
|
||||
// var newAppVer = await GetAppVer(newVer);
|
||||
// if (oldAppVer is null || newAppVer is null)
|
||||
// {
|
||||
// Console.WriteLine("AppVer not exists");
|
||||
// return;
|
||||
// }
|
||||
// var oldFileList = await GetAppPublishInfo(oldAppVer.Id, platform);
|
||||
// var newFileList = await GetAppPublishInfo(newAppVer.Id, platform);
|
||||
// if (oldFileList is null || newFileList is null)
|
||||
// {
|
||||
// Console.WriteLine("AppPublishInfo not exists");
|
||||
// return;
|
||||
// }
|
||||
// var oldAppVerFileList = JsonSerializer.Deserialize<AppPublishInfo>(oldFileList.FileListRaw);
|
||||
// var newAppVerFileList = JsonSerializer.Deserialize<AppPublishInfo>(newFileList.FileListRaw);
|
||||
// if (oldAppVerFileList is null || newAppVerFileList is null)
|
||||
// {
|
||||
// Console.WriteLine("AppPublishInfo not exists");
|
||||
// return;
|
||||
// }
|
||||
// var pathSavePath = Path.Combine(patchFilePath, oldVer, $"{newVer}.dat");
|
||||
// var pathFileInfo = new FileInfo(pathSavePath);
|
||||
// if (!(pathFileInfo.Directory?.Exists ?? false))
|
||||
// {
|
||||
// pathFileInfo.Directory?.Create();
|
||||
// }
|
||||
// Console.WriteLine($"开始生成: {oldVer} -> {newVer} platform:{platform}");
|
||||
// await ContrastVersion(oldAppVerFileList, newAppVerFileList, pathSavePath);
|
||||
/// <summary>
|
||||
/// 传入 2 个版本号生成补丁
|
||||
/// </summary>
|
||||
/// <param name="oldVer"></param>
|
||||
/// <param name="newVer"></param>
|
||||
/// <param name="platform"></param>
|
||||
/// <param name="patchFilePath"></param>
|
||||
/// <returns></returns>
|
||||
internal static async ThreadTask GenerateAppPublishPatchBundleInfo(string oldVer, string newVer, ClientPlatform platform, string patchFilePath)
|
||||
{
|
||||
var oldAppVer = await GetAppVer(oldVer);
|
||||
var newAppVer = await GetAppVer(newVer);
|
||||
if (oldAppVer is null || newAppVer is null)
|
||||
{
|
||||
Console.WriteLine("AppVer not exists");
|
||||
return;
|
||||
}
|
||||
var oldFileList = await GetAppPublishInfo(oldAppVer.Id, platform);
|
||||
var newFileList = await GetAppPublishInfo(newAppVer.Id, platform);
|
||||
if (oldFileList is null || newFileList is null)
|
||||
{
|
||||
Console.WriteLine("AppPublishInfo not exists");
|
||||
return;
|
||||
}
|
||||
var oldAppVerFileList = JsonSerializer.Deserialize<AppPublishInfo>(oldFileList.FileListRaw);
|
||||
var newAppVerFileList = JsonSerializer.Deserialize<AppPublishInfo>(newFileList.FileListRaw);
|
||||
if (oldAppVerFileList is null || newAppVerFileList is null)
|
||||
{
|
||||
Console.WriteLine("AppPublishInfo not exists");
|
||||
return;
|
||||
}
|
||||
var pathSavePath = Path.Combine(patchFilePath, oldVer, $"{newVer}.dat");
|
||||
var pathFileInfo = new FileInfo(pathSavePath);
|
||||
if (!(pathFileInfo.Directory?.Exists ?? false))
|
||||
{
|
||||
pathFileInfo.Directory?.Create();
|
||||
}
|
||||
Console.WriteLine($"开始生成: {oldVer} -> {newVer} platform:{platform}");
|
||||
await ContrastVersion(oldAppVerFileList, newAppVerFileList, pathSavePath);
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 获取版本号信息
|
||||
// /// </summary>
|
||||
// /// <param name="ver"></param>
|
||||
// /// <returns></returns>
|
||||
// public static async Task<AppVer?> GetAppVer(string ver)
|
||||
// {
|
||||
// using var httpClient = new HttpClient();
|
||||
// var response = await httpClient.GetAsync($"{BaseUrl}/appver/{ver}");
|
||||
// var data = JsonSerializer.Deserialize<ApiRsp<AppVer?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions
|
||||
// {
|
||||
// PropertyNameCaseInsensitive = true
|
||||
// });
|
||||
// return data?.Content;
|
||||
// }
|
||||
/// <summary>
|
||||
/// 获取版本号信息
|
||||
/// </summary>
|
||||
/// <param name="ver"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<AppVer?> GetAppVer(string ver)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var response = await httpClient.GetAsync($"{BaseUrl}/appver/{ver}");
|
||||
var data = JsonSerializer.Deserialize<ApiRsp<AppVer?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
return data?.Content;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 更具 APP 版本 ID 获取发布信息
|
||||
// /// </summary>
|
||||
// /// <param name="appVerId">版本号</param>
|
||||
// /// <param name="platform">平台</param>
|
||||
// /// <returns></returns>
|
||||
// public static async Task<AppVerFileList?> GetAppPublishInfo(Guid appVerId, ClientPlatform platform)
|
||||
// {
|
||||
// using var httpClient = new HttpClient();
|
||||
// var response = await httpClient.GetAsync($"{BaseUrl}/appver/file/{appVerId}/{platform}/list");
|
||||
// var data = JsonSerializer.Deserialize<ApiRsp<AppVerFileList?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions
|
||||
// {
|
||||
// PropertyNameCaseInsensitive = true
|
||||
// });
|
||||
// return data?.Content;
|
||||
// }
|
||||
/// <summary>
|
||||
/// 更具 APP 版本 ID 获取发布信息
|
||||
/// </summary>
|
||||
/// <param name="appVerId">版本号</param>
|
||||
/// <param name="platform">平台</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<AppVerFileList?> GetAppPublishInfo(Guid appVerId, ClientPlatform platform)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var response = await httpClient.GetAsync($"{BaseUrl}/appver/file/{appVerId}/{platform}/list");
|
||||
var data = JsonSerializer.Deserialize<ApiRsp<AppVerFileList?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
return data?.Content;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 根据 2 个版本的文件列表生成补丁
|
||||
// /// </summary>
|
||||
// /// <param name="oldFileList"></param>
|
||||
// /// <param name="newFileList"></param>
|
||||
// /// <param name="patchFilePath"></param>
|
||||
// /// <returns></returns>
|
||||
// public static async ThreadTask ContrastVersion(AppPublishInfo oldFileList, AppPublishInfo newFileList, string patchFilePath)
|
||||
// {
|
||||
// var oldFiles = oldFileList.Files.Where(x => !x.RelativePath.StartsWith("dotnet\\"));
|
||||
// var newFiles = newFileList.Files.Where(x => !x.RelativePath.StartsWith("dotnet\\"));
|
||||
// Console.WriteLine($"旧版本文件数:{oldFiles.Count()}");
|
||||
// Console.WriteLine($"新版本文件数:{newFiles.Count()}");
|
||||
// var changeList = new Dictionary<string, PatchBundleInfo?>();
|
||||
/// <summary>
|
||||
/// 根据 2 个版本的文件列表生成补丁
|
||||
/// </summary>
|
||||
/// <param name="oldFileList"></param>
|
||||
/// <param name="newFileList"></param>
|
||||
/// <param name="patchFilePath"></param>
|
||||
/// <returns></returns>
|
||||
public static async ThreadTask ContrastVersion(AppPublishInfo oldFileList, AppPublishInfo newFileList, string patchFilePath)
|
||||
{
|
||||
var oldFiles = oldFileList.Files.Where(x => !x.RelativePath.StartsWith("dotnet\\"));
|
||||
var newFiles = newFileList.Files.Where(x => !x.RelativePath.StartsWith("dotnet\\"));
|
||||
Console.WriteLine($"旧版本文件数:{oldFiles.Count()}");
|
||||
Console.WriteLine($"新版本文件数:{newFiles.Count()}");
|
||||
var changeList = new Dictionary<string, PatchBundleInfo?>();
|
||||
|
||||
// var removeFiles = oldFiles.Select(x => x.RelativePath).Except(newFiles.Select(x => x.RelativePath));
|
||||
// //文件删除
|
||||
// foreach (var item in removeFiles)
|
||||
// {
|
||||
// changeList.Add(item, null);
|
||||
// }
|
||||
// Console.WriteLine($"需要删除的文件数:{changeList.Count}");
|
||||
// foreach (var item in newFiles)
|
||||
// {
|
||||
// var oldFile = oldFiles.FirstOrDefault(x => x.RelativePath.Equals(item.RelativePath));
|
||||
// //文件新增
|
||||
// if (oldFile == null)
|
||||
// {
|
||||
// var newFileRaw = string.IsNullOrWhiteSpace(item.SignatureSHA384) ? await GetFileRaw(item.SHA384) : await GetFileRaw(item.SignatureSHA384);
|
||||
// if (newFileRaw is null)
|
||||
// {
|
||||
// Console.WriteLine("new file not exists");
|
||||
// return;
|
||||
// }
|
||||
// changeList.Add(item.RelativePath, new PatchBundleInfo
|
||||
// {
|
||||
// SHA384 = item.SHA384,
|
||||
// IsFullOrPatch = true,
|
||||
// PatchData = newFileRaw.DataRaw
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //文件修改
|
||||
// if (oldFile.SHA384 != item.SHA384)
|
||||
// {
|
||||
// var oldFileRaw = string.IsNullOrWhiteSpace(oldFile.SignatureSHA384) ? await GetFileRaw(oldFile.SHA384) : await GetFileRaw(oldFile.SignatureSHA384);
|
||||
// if (oldFileRaw is null)
|
||||
// {
|
||||
// Console.WriteLine("old file not exists");
|
||||
// return;
|
||||
// }
|
||||
// var newFileRaw = string.IsNullOrWhiteSpace(item.SignatureSHA384) ? await GetFileRaw(item.SHA384) : await GetFileRaw(item.SignatureSHA384); // await GetFileRaw(item.SignatureSHA384);
|
||||
// if (newFileRaw is null)
|
||||
// {
|
||||
// Console.WriteLine("new file not exists");
|
||||
// return;
|
||||
// }
|
||||
// using (var output = new MemoryStream())
|
||||
// {
|
||||
// //BinaryPatch.Create(oldFileRaw.DataRaw, File.ReadAllBytes(item.RelativePath), output);
|
||||
// BinaryPatch.Create(oldFileRaw.DataRaw, newFileRaw.DataRaw, output);
|
||||
// changeList.Add(item.RelativePath, new PatchBundleInfo
|
||||
// {
|
||||
// SHA384 = item.SHA384,
|
||||
// IsFullOrPatch = false,
|
||||
// PatchData = output.ToArray()
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (File.Exists(patchFilePath))
|
||||
// File.Delete(patchFilePath);
|
||||
var removeFiles = oldFiles.Select(x => x.RelativePath).Except(newFiles.Select(x => x.RelativePath));
|
||||
//文件删除
|
||||
foreach (var item in removeFiles)
|
||||
{
|
||||
changeList.Add(item, null);
|
||||
}
|
||||
Console.WriteLine($"需要删除的文件数:{changeList.Count}");
|
||||
foreach (var item in newFiles)
|
||||
{
|
||||
var oldFile = oldFiles.FirstOrDefault(x => x.RelativePath.Equals(item.RelativePath));
|
||||
//文件新增
|
||||
if (oldFile == null)
|
||||
{
|
||||
var newFileRaw = string.IsNullOrWhiteSpace(item.SignatureSHA384) ? await GetFileRaw(item.SHA384) : await GetFileRaw(item.SignatureSHA384);
|
||||
if (newFileRaw is null)
|
||||
{
|
||||
Console.WriteLine("new file not exists");
|
||||
return;
|
||||
}
|
||||
changeList.Add(item.RelativePath, new PatchBundleInfo
|
||||
{
|
||||
SHA384 = item.SHA384,
|
||||
IsFullOrPatch = true,
|
||||
PatchData = newFileRaw.DataRaw
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
//文件修改
|
||||
if (oldFile.SHA384 != item.SHA384)
|
||||
{
|
||||
var oldFileRaw = string.IsNullOrWhiteSpace(oldFile.SignatureSHA384) ? await GetFileRaw(oldFile.SHA384) : await GetFileRaw(oldFile.SignatureSHA384);
|
||||
if (oldFileRaw is null)
|
||||
{
|
||||
Console.WriteLine("old file not exists");
|
||||
return;
|
||||
}
|
||||
var newFileRaw = string.IsNullOrWhiteSpace(item.SignatureSHA384) ? await GetFileRaw(item.SHA384) : await GetFileRaw(item.SignatureSHA384); // await GetFileRaw(item.SignatureSHA384);
|
||||
if (newFileRaw is null)
|
||||
{
|
||||
Console.WriteLine("new file not exists");
|
||||
return;
|
||||
}
|
||||
using (var output = new MemoryStream())
|
||||
{
|
||||
//BinaryPatch.Create(oldFileRaw.DataRaw, File.ReadAllBytes(item.RelativePath), output);
|
||||
BinaryPatch.Create(oldFileRaw.DataRaw, newFileRaw.DataRaw, output);
|
||||
changeList.Add(item.RelativePath, new PatchBundleInfo
|
||||
{
|
||||
SHA384 = item.SHA384,
|
||||
IsFullOrPatch = false,
|
||||
PatchData = output.ToArray()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (File.Exists(patchFilePath))
|
||||
File.Delete(patchFilePath);
|
||||
|
||||
// Console.WriteLine($"变动文件数量:{changeList.Count}");
|
||||
// using var fileStream = File.OpenWrite(patchFilePath);
|
||||
// using var brSave = new BrotliStream(fileStream, CompressionLevel.SmallestSize);
|
||||
// Console.WriteLine($"开始压缩");
|
||||
// await MemoryPackSerializer.SerializeAsync(typeof(Dictionary<string, PatchBundleInfo?>), brSave, changeList);
|
||||
// //fileStream.Flush();
|
||||
// Console.WriteLine($"结束");
|
||||
// }
|
||||
Console.WriteLine($"变动文件数量:{changeList.Count}");
|
||||
using var fileStream = File.OpenWrite(patchFilePath);
|
||||
using var brSave = new BrotliStream(fileStream, CompressionLevel.SmallestSize);
|
||||
Console.WriteLine($"开始压缩");
|
||||
await MemoryPackSerializer.SerializeAsync(typeof(Dictionary<string, PatchBundleInfo?>), brSave, changeList);
|
||||
//fileStream.Flush();
|
||||
Console.WriteLine($"结束");
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Hash 384 获取源文件数据
|
||||
// /// </summary>
|
||||
// /// <param name="sha384"></param>
|
||||
// /// <returns></returns>
|
||||
// public static async Task<AppVerFile?> GetFileRaw(string sha384)
|
||||
// {
|
||||
// using var httpClient = new HttpClient();
|
||||
// var response = await httpClient.GetAsync($"{BaseUrl}/appver/file/{sha384}");
|
||||
// var data = JsonSerializer.Deserialize<ApiRsp<AppVerFile?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
// return data?.Content;
|
||||
// }
|
||||
/// <summary>
|
||||
/// Hash 384 获取源文件数据
|
||||
/// </summary>
|
||||
/// <param name="sha384"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<AppVerFile?> GetFileRaw(string sha384)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var response = await httpClient.GetAsync($"{BaseUrl}/appver/file/{sha384}");
|
||||
var data = JsonSerializer.Deserialize<ApiRsp<AppVerFile?>>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
return data?.Content;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 上传指定文件到服务器
|
||||
// /// </summary>
|
||||
// /// <param name="directoryPath">需要上传的目录</param>
|
||||
// internal static async ThreadTask UploadFiles(string directoryPath)
|
||||
// {
|
||||
// DirectoryInfo directoryInfo = new(directoryPath);
|
||||
// if (directoryInfo.Exists)
|
||||
// {
|
||||
// using var httpClient = new HttpClient();
|
||||
// var fileList = new List<AppPublishFileInfo>();
|
||||
// IScanPublicDirectoryCommand.ScanPathCore(directoryPath, fileList, null, null);
|
||||
// using var form = new MultipartFormDataContent();
|
||||
// fileList.ForEach(file =>
|
||||
// {
|
||||
// var fileStream = file.FileInfo!.OpenRead();
|
||||
// form.Add(new StreamContent(fileStream), file.FileInfo!.Name, file.FileInfo!.Name);
|
||||
// });
|
||||
// if (form.Count() > 0)
|
||||
// {
|
||||
// var response = await httpClient.PostAsync($"{BaseUrl}/appver/file/upload", form);
|
||||
// Console.WriteLine(response);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("文件夹不存在");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 上传指定文件到服务器
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">需要上传的目录</param>
|
||||
internal static async ThreadTask UploadFiles(string directoryPath)
|
||||
{
|
||||
DirectoryInfo directoryInfo = new(directoryPath);
|
||||
if (directoryInfo.Exists)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var fileList = new List<AppPublishFileInfo>();
|
||||
IScanPublicDirectoryCommand.ScanPathCore(directoryPath, fileList, null, null);
|
||||
using var form = new MultipartFormDataContent();
|
||||
fileList.ForEach(file =>
|
||||
{
|
||||
var fileStream = file.FileInfo!.OpenRead();
|
||||
form.Add(new StreamContent(fileStream), file.FileInfo!.Name, file.FileInfo!.Name);
|
||||
});
|
||||
if (form.Count() > 0)
|
||||
{
|
||||
var response = await httpClient.PostAsync($"{BaseUrl}/appver/file/upload", form);
|
||||
Console.WriteLine(response);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("文件夹不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed partial class SettingsPageViewModel : TabItemViewModel
|
||||
{
|
||||
if (string.IsNullOrEmpty(UISettings.StartDefaultPageName.Value))
|
||||
{
|
||||
return s.Id == "Welcome";
|
||||
return s.Id == "Watt Toolkit-Welcome";
|
||||
}
|
||||
return s.Id == UISettings.StartDefaultPageName.Value;
|
||||
});
|
||||
|
||||