Skip to content

Commit

Permalink
新增 Steam 云存档管理功能
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Jun 9, 2022
1 parent 9848fa5 commit 6a8cd68
Show file tree
Hide file tree
Showing 31 changed files with 1,099 additions and 51 deletions.
2 changes: 1 addition & 1 deletion references/Steam4NET
2 changes: 1 addition & 1 deletion references/SteamAchievementManager
6 changes: 6 additions & 0 deletions release-template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### 版本亮点
1. ASF 升级至 V5.2.5.5
2. 新增 Steam 云存档管理功能,可自行上传或删除 Steam 云存档
3. 库存游戏支持筛选支持 Steam 云存档的游戏
4. 更新 Avalonia 至 0.10.15

<!--
1. Android 支持 VPN 模式(推荐) 进行本地加速
Expand All @@ -16,6 +19,9 @@

### 修复问题
1. 修复 判断 Administrator 或 Root 权限函数错误,例如导致 Windows 上开机自启失效等其他问题
2. 修复 窗口在某些情况下最大化或最小化恢复时窗口大小会变化的问题
3. 修复 库存游戏 编辑 Steam 游戏封面时选择自定义图片失败的问题
4. 修复 某些图片显示会错乱的问题

<!--
1. 修复 库存游戏中挂时长失效
Expand Down
2 changes: 2 additions & 0 deletions src/Common.Essentials/Essentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ public class PickOptions

public string? PickerTitle { get; set; }

public bool Multiselect { get; set; }

public IFilePickerFileType? FileTypes { get; set; }
}

Expand Down
22 changes: 15 additions & 7 deletions src/ST.Client.CommandLine/CommandLineHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,23 @@ void MainHandlerByCLT_(Action? onInitStartuped)
rootCommand.AddCommand(steamuser);

// -clt app -id 632360
var unlock_achievement = new Command("app", "打开成就解锁窗口");
unlock_achievement.AddOption(new Option<int>("-id", "指定一个 Steam 游戏 Id"));
unlock_achievement.AddOption(new Option<bool>("-silence", "挂运行服务,不加载窗口,内存占用更小"));
unlock_achievement.Handler = CommandHandler.Create(async (int id, bool silence) =>
var run_SteamApp = new Command("app", "运行 Steam 应用");
run_SteamApp.AddOption(new Option<int>("-id", "指定一个 Steam 游戏 Id"));
run_SteamApp.AddOption(new Option<bool>("-achievement", "打开成就解锁窗口"));
run_SteamApp.AddOption(new Option<bool>("-cloudmanager", "打开云存档管理窗口"));
//run_SteamApp.AddOption(new Option<bool>("-silence", "挂运行服务,不加载窗口,内存占用更小"));
run_SteamApp.Handler = CommandHandler.Create(async (int id, bool achievement, bool cloudmanager) =>
{
try
{
if (id <= 0) return;
if (!silence)
if (cloudmanager)
{
ConfigureServices(DILevel.GUI | DILevel.Steam | DILevel.HttpClientFactory);
IViewModelManager.Instance.InitCloudManageMain(id);
StartApplication(args);
}
else if (achievement)
{
ConfigureServices(DILevel.GUI | DILevel.Steam | DILevel.HttpClientFactory);
IViewModelManager.Instance.InitUnlockAchievement(id);
Expand All @@ -213,10 +221,10 @@ void MainHandlerByCLT_(Action? onInitStartuped)
}
catch (Exception ex)
{
Log.Error(nameof(unlock_achievement), ex, "Start");
Log.Error(nameof(run_SteamApp), ex, "Start");
}
});
rootCommand.AddCommand(unlock_achievement);
rootCommand.AddCommand(run_SteamApp);

var r = rootCommand.InvokeAsync(args).GetAwaiter().GetResult();
return r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ async Task<IEnumerable<IFileResult>> IOpenFileDialogService.PlatformPickAsync(Pi
};
if (options != default)
{
fileDialog.AllowMultiple = options.Multiselect;
if (options.PickerTitle != default)
{
fileDialog.Title = options.PickerTitle;
Expand Down
5 changes: 5 additions & 0 deletions src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public override void Initialize()
{
switch (vmService.MainWindow)
{
case CloudArchiveWindowViewModel:
ProgramHost.IsMinimize = false;
MainWindow = new CloudArchiveWindow();
break;
case AchievementWindowViewModel:
ProgramHost.IsMinimize = false;
MainWindow = new AchievementWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
Width="150"
Classes="notransitions"
Value="50" />

<TextBlock Text="Material Progress" />
<ProgressBar
Width="150"
Height="30"
Classes="Material"
IsIndeterminate="True" />
<ProgressBar
Width="150"
Height="30"
Classes="Material notransitions"
Value="50" />
</StackPanel>
</Border>
</Design.PreviewWith>
Expand Down Expand Up @@ -173,4 +185,212 @@
</Animation>
</Style.Animations>
</Style>

<Style Selector="ProgressBar.Material">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarForeground}" />
<Setter Property="Background" Value="{DynamicResource ProgressBarBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ProgressBarBorderBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border
Name="PART_RootBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ClipToBounds="True"
CornerRadius="{DynamicResource ControlCornerRadius}">
<Panel Name="PART_RootPanel" ClipToBounds="True">
<Panel.RenderTransform>
<ScaleTransform />
</Panel.RenderTransform>

<Viewbox Name="PART_IndeterminateView" Stretch="Fill">
<Canvas Name="PART_Container" HorizontalAlignment="Stretch">
<Rectangle Name="PART_First" Fill="{TemplateBinding Foreground}" />
<Rectangle Name="PART_Second" Fill="{TemplateBinding Foreground}" />
</Canvas>
</Viewbox>

<Border
Name="PART_Indicator"
Background="{TemplateBinding Foreground}"
ClipToBounds="False" />
</Panel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="ProgressBar /template/ Panel#PART_RootPanel">
<Setter Property="Opacity" Value="1" />
<Setter Property="ScaleTransform.ScaleX" Value="1" />
<Setter Property="ScaleTransform.ScaleY" Value="1" />
</Style>

<Style Selector="ProgressBar:not(.Circle):horizontal">
<Setter Property="Height" Value="4" />
</Style>

<Style Selector="ProgressBar:not(.Circle):horizontal /template/ Panel#PART_RootPanel">
<Setter Property="RenderTransformOrigin" Value="0.0, 0.5" />
</Style>

<Style Selector="ProgressBar:not(.Circle):vertical">
<Setter Property="Width" Value="4" />
</Style>

<Style Selector="ProgressBar:not(.Circle):vertical /template/ Panel#PART_RootPanel">
<Setter Property="RenderTransformOrigin" Value="0.5, 0.0" />
</Style>

<Style Selector="ProgressBar:not(.Circle) /template/ Rectangle#PART_First, ProgressBar:not(.Circle) /template/ Rectangle#PART_Second">
<Setter Property="IsVisible" Value="False" />
</Style>

<!-- Horizontal animations indeterminate progress -->

<Style Selector="ProgressBar:indeterminate:horizontal /template/ Canvas#PART_Container">
<Setter Property="Width" Value="100" />
<Setter Property="Height" Value="20" />
</Style>

<Style Selector="ProgressBar:indeterminate:horizontal /template/ Rectangle#PART_First">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Height" Value="20" />
<Style.Animations>
<Animation IterationCount="INFINITE" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Canvas.Left" Value="-10" />
<Setter Property="Width" Value="10" />
</KeyFrame>
<KeyFrame Cue="35%">
<Setter Property="Canvas.Left" Value="45" />
<Setter Property="Width" Value="60" />
</KeyFrame>
<KeyFrame Cue="60%">
<Setter Property="Canvas.Left" Value="100" />
<Setter Property="Width" Value="100" />
</KeyFrame>
<KeyFrame Cue="90%">
<Setter Property="Canvas.Left" Value="100" />
<Setter Property="Width" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Canvas.Left" Value="100" />
<Setter Property="Width" Value="0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="ProgressBar:indeterminate:horizontal /template/ Rectangle#PART_Second">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Height" Value="20" />
<Style.Animations>
<Animation IterationCount="INFINITE" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Canvas.Left" Value="0" />
<Setter Property="Width" Value="0" />
</KeyFrame>
<KeyFrame Cue="50%">
<Setter Property="Canvas.Left" Value="0" />
<Setter Property="Width" Value="0" />
</KeyFrame>
<KeyFrame Cue="70%">
<Setter Property="Canvas.Left" Value="0" />
<Setter Property="Width" Value="70" />
</KeyFrame>
<KeyFrame Cue="90%">
<Setter Property="Canvas.Left" Value="95" />
<Setter Property="Width" Value="20" />
</KeyFrame>
<KeyFrame Cue="95%">
<Setter Property="Canvas.Left" Value="100" />
<Setter Property="Width" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Canvas.Left" Value="100" />
<Setter Property="Width" Value="0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>

<!-- Vertical animations indeterminate progress -->

<Style Selector="ProgressBar:indeterminate:vertical /template/ Canvas#PART_Container">
<Setter Property="Width" Value="20" />
<Setter Property="Height" Value="100" />
</Style>

<Style Selector="ProgressBar:indeterminate:vertical /template/ Rectangle#PART_First">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Width" Value="20" />
<Style.Animations>
<Animation IterationCount="INFINITE" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Canvas.Bottom" Value="-10" />
<Setter Property="Height" Value="10" />
</KeyFrame>
<KeyFrame Cue="35%">
<Setter Property="Canvas.Bottom" Value="45" />
<Setter Property="Height" Value="60" />
</KeyFrame>
<KeyFrame Cue="60%">
<Setter Property="Canvas.Bottom" Value="100" />
<Setter Property="Height" Value="100" />
</KeyFrame>
<KeyFrame Cue="90%">
<Setter Property="Canvas.Bottom" Value="100" />
<Setter Property="Height" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Canvas.Bottom" Value="100" />
<Setter Property="Height" Value="0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="ProgressBar:indeterminate:vertical /template/ Rectangle#PART_Second">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Width" Value="20" />
<Style.Animations>
<Animation IterationCount="INFINITE" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Canvas.Bottom" Value="0" />
<Setter Property="Height" Value="0" />
</KeyFrame>
<KeyFrame Cue="50%">
<Setter Property="Canvas.Bottom" Value="0" />
<Setter Property="Height" Value="0" />
</KeyFrame>
<KeyFrame Cue="70%">
<Setter Property="Canvas.Bottom" Value="0" />
<Setter Property="Height" Value="70" />
</KeyFrame>
<KeyFrame Cue="90%">
<Setter Property="Canvas.Bottom" Value="95" />
<Setter Property="Height" Value="20" />
</KeyFrame>
<KeyFrame Cue="95%">
<Setter Property="Canvas.Bottom" Value="100" />
<Setter Property="Height" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Canvas.Bottom" Value="100" />
<Setter Property="Height" Value="0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>

<Style Selector="ProgressBar:horizontal /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Stretch" />
</Style>
<Style Selector="ProgressBar:vertical /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
</Styles>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.Metadata;
using System.Application.UI.Resx;
using System.Collections;
using System.IO;
using static System.Application.FilePicker2;
Expand Down Expand Up @@ -75,8 +76,6 @@ void Drop(object? sender, DragEventArgs e)

private async void CustomFilePicker_Tapped(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
FilePickerFileType fileTypes = new ValueTuple<string, string[]>[] { ("Image Files", FileEx.ImageFileExtensions) };

//if (string.IsNullOrEmpty(FileExtensions) || FileExtensions == "*")
//{
// fileTypes = new ValueTuple<string, string[]>[] { ("All Files", new[] { "*" }) };
Expand All @@ -89,10 +88,15 @@ private async void CustomFilePicker_Tapped(object? sender, Avalonia.Interactivit
// };
//}

await PickAsync((file) =>
var result = await PickAsync(PickOptions.Images);
if (result != null)
{
FileName = result.FullPath;
}
else
{
FileName = file;
}, fileTypes);
Toast.Show(AppResources.PleaseSelect);
}
}
}
}
Loading

0 comments on commit 6a8cd68

Please sign in to comment.