Skip to content

Commit

Permalink
准备更新挂卡功能,修复托盘启动多个窗口问题
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Dec 27, 2020
1 parent b3d203f commit f805911
Show file tree
Hide file tree
Showing 19 changed files with 203 additions and 86 deletions.
2 changes: 1 addition & 1 deletion SteamTool.Core/HttpServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HttpServices
{
private readonly HttpClient _client = new HttpClient();

public string UserAgent { get; set; } = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36";
public string UserAgent { get; set; } = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";

public string Accept { get; set; } = "application/json";

Expand Down
2 changes: 1 addition & 1 deletion SteamTools/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ protected override void OnExit(ExitEventArgs e)
//TaskbarService.Current.Taskbar.Icon = null; //避免托盘图标没有自动消失
TaskbarService.Current.Taskbar.Icon.Dispose();
}
base.OnExit(e);
this.compositeDisposable.Dispose();
base.OnExit(e);
}

private void ProcessCommandLineParameter(string[] args)
Expand Down
3 changes: 3 additions & 0 deletions SteamTools/SteamTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Pages\SteamIdleCardPage.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="Views\Pages\SteamAppPage.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
Expand Down
3 changes: 0 additions & 3 deletions SteamTools/ViewModels/Control/TaskBarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public ICommand ShowWindowCommand
CanExecuteFunc = () => true,
CommandAction = () =>
{
App.Current.MainWindow = WindowService.Current.GetMainWindow();
//if (!App.Current.MainWindow.IsVisible)
// App.Current.MainWindow.Show();
var mainWindow = (WindowService.Current.MainWindow as MainWindowViewModel);
mainWindow.IsVisible = true;
}
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Content/CommonGame/GameCommon.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
</Button>
</StackPanel>
<TextBlock Style="{StaticResource DetailTextStyleKey}" Margin="20,6,0,0">
<Run Text="*置于壁纸层的游戏可能会无法操控,这个问题可以解决但是目前发开精力不在这,目前这个功能就这样了。游戏结束后桌面会依然留下冻结的画面,这时可以点击刷新壁纸来恢复默认壁纸。"/>
<Run Text="*置于壁纸层的游戏可能会无法操控,这个问题可以解决但是目前开发精力不在这,目前这个功能就这样了。游戏结束后桌面会依然留下冻结的画面,这时可以点击刷新壁纸来恢复默认壁纸。"/>
<Run Text="并且将窗口放置于桌面壁纸层功能与Wallpaper Engine和其它动态桌面软件不兼容,使用时注意关掉Wallpaper Engine等软件。"/>
</TextBlock>
<Rectangle Style="{DynamicResource SeparatorStyleKey}" />
Expand Down
3 changes: 3 additions & 0 deletions SteamTools/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
<DataTemplate DataType="{x:Type vm:SteamAccountPageViewModel}">
<pages:SwitchSteamAccountPage />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:SteamIdlePageViewModel}">
<pages:SteamIdleCardPage />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:CommunityProxyPageViewModel}">
<pages:CommunityProxyPage />
</DataTemplate>
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchTheme.xaml 的交互逻辑
/// AboutPage.xaml 的交互逻辑
/// </summary>
public partial class AboutPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/ArchiSteamFarmPlusPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchSteamAccount.xaml 的交互逻辑
/// ArchiSteamFarmPlusPage.xaml 的交互逻辑
/// </summary>
public partial class ArchiSteamFarmPlusPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/GameRelatedPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchTheme.xaml 的交互逻辑
/// GameRelatedPage.xaml 的交互逻辑
/// </summary>
public partial class GameRelatedPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/LocalAuthPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchSteamAccount.xaml 的交互逻辑
/// LocalAuthPage.xaml 的交互逻辑
/// </summary>
public partial class LocalAuthPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/OtherPlatformPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchTheme.xaml 的交互逻辑
/// OtherPlatformPage.xaml 的交互逻辑
/// </summary>
public partial class OtherPlatformPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
VerticalScrollBarVisibility="Auto" Background="{DynamicResource ThemeBrushKey}">
<StackPanel Margin="8,0,8,8">
<Panel.Resources>
<Style TargetType="{x:Type WrapPanel}">
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchTheme.xaml 的交互逻辑
/// SettingsPage.xaml 的交互逻辑
/// </summary>
public partial class SettingsPage : UserControl
{
Expand Down
2 changes: 1 addition & 1 deletion SteamTools/Views/Pages/SteamAppPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace SteamTools.Views.Pages
{
/// <summary>
/// SwitchSteamAccount.xaml 的交互逻辑
/// SteamAppPage.xaml 的交互逻辑
/// </summary>
public partial class SteamAppPage : UserControl
{
Expand Down
65 changes: 65 additions & 0 deletions SteamTools/Views/Pages/SteamIdleCardPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<UserControl x:Class="SteamTools.Views.Pages.SteamIdleCardPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:control="clr-namespace:SteamTools.Views.Pages"
xmlns:services="clr-namespace:SteamTools.Services"
mc:Ignorable="d"
d:DesignWidth="600"
d:DesignHeight="400">

<TabControl Grid.Row="1" Style="{StaticResource VerticalTabControlStyleKey}"
FontFamily="{DynamicResource DefaultFontFamilyKey}" FontSize="14">
<TabControl.Resources>
<Style x:Key="TabHeaderTextStyleKey"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground"
Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=Foreground}" />
<Setter Property="Margin"
Value="14,0" />
<Setter Property="VerticalAlignment"
Value="Center" />
</Style>
</TabControl.Resources>

<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding Resources.Origin,Source={x:Static services:ResourceService.Current}, Mode=OneWay}"
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>
</TabItem>

<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding Resources.Uplay,Source={x:Static services:ResourceService.Current}, Mode=OneWay}"
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>

</TabItem>

<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding Resources.WinStore,Source={x:Static services:ResourceService.Current}, Mode=OneWay}"
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>

</TabItem>

<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding Resources.GOG,Source={x:Static services:ResourceService.Current}, Mode=OneWay}"
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>

</TabItem>

<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding Resources.Epic,Source={x:Static services:ResourceService.Current}, Mode=OneWay}"
Style="{StaticResource TabHeaderTextStyleKey}" />
</TabItem.Header>

</TabItem>
</TabControl>
</UserControl>
30 changes: 30 additions & 0 deletions SteamTools/Views/Pages/SteamIdleCardPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MetroRadiance.UI;

namespace SteamTools.Views.Pages
{
/// <summary>
/// SteamIdleCardPage.xaml 的交互逻辑
/// </summary>
public partial class SteamIdleCardPage : UserControl
{
public SteamIdleCardPage()
{
InitializeComponent();
}
}

}
2 changes: 1 addition & 1 deletion SteamTools/Views/Window/AddAuthWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
Prompt="" />

<TextBlock Grid.Row="1" Grid.Column="0">
<Run Text="从文件文件夹中,粘贴'SteamGuard-NNNNNNNN'的全部内容" />
<Run Text="从files文件夹中,粘贴'SteamGuard-NNNNNNNN'的全部内容" />
</TextBlock>
<metro:PromptTextBox Grid.Row="1"
Grid.Column="1"
Expand Down
144 changes: 80 additions & 64 deletions SteamTools/Win32/WinInet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,94 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;

namespace SteamTools.Win32
{
internal class WinInet
{
// For PInvoke: Initiates the enumeration of the cache groups in the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindFirstUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr FindFirstUrlCacheGroup(
int dwFlags,
int dwFilter,
IntPtr lpSearchCondition,
int dwSearchCondition,
ref long lpGroupId,
IntPtr lpReserved);
internal class WinInet
{
// For PInvoke: Initiates the enumeration of the cache groups in the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindFirstUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr FindFirstUrlCacheGroup(
int dwFlags,
int dwFilter,
IntPtr lpSearchCondition,
int dwSearchCondition,
ref long lpGroupId,
IntPtr lpReserved);

// For PInvoke: Retrieves the next cache group in a cache group enumeration
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindNextUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern bool FindNextUrlCacheGroup(
IntPtr hFind,
ref long lpGroupId,
IntPtr lpReserved);
// For PInvoke: Retrieves the next cache group in a cache group enumeration
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindNextUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern bool FindNextUrlCacheGroup(
IntPtr hFind,
ref long lpGroupId,
IntPtr lpReserved);

// For PInvoke: Releases the specified GROUPID and any associated state in the cache index file
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "DeleteUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern bool DeleteUrlCacheGroup(
long groupId,
int dwFlags,
IntPtr lpReserved);
// For PInvoke: Releases the specified GROUPID and any associated state in the cache index file
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "DeleteUrlCacheGroup",
CallingConvention = CallingConvention.StdCall)]
public static extern bool DeleteUrlCacheGroup(
long groupId,
int dwFlags,
IntPtr lpReserved);

// For PInvoke: Begins the enumeration of the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindFirstUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr FindFirstUrlCacheEntry(
[MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern,
IntPtr lpFirstCacheEntryInfo,
ref int lpdwFirstCacheEntryInfoBufferSize);
// For PInvoke: Begins the enumeration of the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindFirstUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr FindFirstUrlCacheEntry(
[MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern,
IntPtr lpFirstCacheEntryInfo,
ref int lpdwFirstCacheEntryInfoBufferSize);

// For PInvoke: Retrieves the next entry in the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindNextUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern bool FindNextUrlCacheEntry(
IntPtr hFind,
IntPtr lpNextCacheEntryInfo,
ref int lpdwNextCacheEntryInfoBufferSize);
// For PInvoke: Retrieves the next entry in the Internet cache
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "FindNextUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern bool FindNextUrlCacheEntry(
IntPtr hFind,
IntPtr lpNextCacheEntryInfo,
ref int lpdwNextCacheEntryInfoBufferSize);

// For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "DeleteUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern bool DeleteUrlCacheEntry(
IntPtr lpszUrlName);
}
// For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists
[DllImport(@"wininet",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "DeleteUrlCacheEntryA",
CallingConvention = CallingConvention.StdCall)]
public static extern bool DeleteUrlCacheEntry(
IntPtr lpszUrlName);


[DllImport("wininet.dll",
SetLastError = true,
CharSet = CharSet.Auto,
EntryPoint = "InternetGetCookieEx",
CallingConvention = CallingConvention.StdCall)]
public static extern bool InternetGetCookieEx(
string url,
string cookieName,
StringBuilder cookieData,
ref int size,
int dwFlags,
IntPtr lpReserved);

}
}
Loading

0 comments on commit f805911

Please sign in to comment.