Inform user of SteamGrid download on first run

pull/70/head
Brian Lima 3 years ago
parent 15d5a79619
commit d06903405e

1
.gitignore vendored

@ -268,3 +268,4 @@ __pycache__/
./Setup/UWPHook setup.exe
./Setup/Setup-cache
Setup/UWPHook.exe
*.exe

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -80,6 +80,17 @@
<setting name="SelectedSteamGridDB_Humor" serializeAs="String">
<value>0</value>
</setting>
<setting name="OfferedSteamGridDB" serializeAs="String">
<value>False</value>
</setting>
</UWPHook.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -11,7 +11,7 @@
TextElement.FontSize="14"
FontFamily="Segoe UI Light"
mc:Ignorable="d"
Title="UWPHook" Height="600" Width="800" Icon="/Resources/hook2.ico">
Title="UWPHook" Height="600" Width="800" Icon="/Resources/hook2.ico" Loaded="Window_Loaded">
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="28*"/>
@ -22,7 +22,7 @@
<Label x:Name="label1" Content="Welcome to UWPHook, the easier way to add UWP apps and XGP games and apps to Steam!" HorizontalAlignment="Left" Margin="172,-14,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>
<Button Click="HelpButton_Click" Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
<Button x:Name="settingsButton" Click="SettingsButton_Click" Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
Margin="0,6,10,0" HorizontalAlignment="Right"
ToolTip="Settings/About" VerticalAlignment="Top">
<materialDesign:PackIcon Kind="Settings" Height="24" Width="24" />

@ -13,6 +13,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using UWPHook.Properties;
using UWPHook.SteamGridDb;
using VDFParser;
using VDFParser.Models;
@ -25,7 +26,7 @@ namespace UWPHook
public partial class GamesWindow : Window
{
AppEntryModel Apps;
BackgroundWorker bwrLoad, bwrSave;
BackgroundWorker bwrLoad;
public GamesWindow()
{
@ -57,7 +58,7 @@ namespace UWPHook
{
FullScreenLauncher launcher = null;
//So, for some reason, Steam is now stopping in-home streaming if the launched app is minimized, so not hiding UWPHook's window is doing the trick for now
if (Properties.Settings.Default.StreamMode)
if (Settings.Default.StreamMode)
{
this.Hide();
launcher = new FullScreenLauncher();
@ -80,7 +81,7 @@ namespace UWPHook
{
//Some apps have their language locked to the UI language of the system, so overriding it might change the language of the game
//I my self couldn't get this to work on neither Forza Horizon 3 or Halo 5 Forge, @AbGedreht reported it works tho
if (Properties.Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Properties.Settings.Default.TargetLanguage))
if (Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Settings.Default.TargetLanguage))
{
ScriptManager.RunScript("Set-WinUILanguageOverride " + Properties.Settings.Default.TargetLanguage);
}
@ -91,7 +92,7 @@ namespace UWPHook
//While the current launched app is running, sleep for n seconds and then check again
while (AppManager.IsRunning())
{
Thread.Sleep(Properties.Settings.Default.Seconds * 1000);
Thread.Sleep(Settings.Default.Seconds * 1000);
}
}
catch (Exception e)
@ -101,7 +102,7 @@ namespace UWPHook
}
finally
{
if (Properties.Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Properties.Settings.Default.TargetLanguage))
if (Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Settings.Default.TargetLanguage))
{
ScriptManager.RunScript("Set-WinUILanguageOverride " + currentLanguage);
}
@ -165,6 +166,13 @@ namespace UWPHook
{
string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\";
string userGridDirectory = user + "\\config\\grid\\";
// No images were downloaded, maybe the key is invalid or no app had an image
if (!Directory.Exists(tmpGridDirectory))
{
return;
}
string[] images = Directory.GetFiles(tmpGridDirectory);
if (!Directory.Exists(userGridDirectory))
@ -182,8 +190,11 @@ namespace UWPHook
private void RemoveTempGridImages()
{
string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\";
if (Directory.Exists(tmpGridDirectory))
{
Directory.Delete(tmpGridDirectory, true);
}
}
private async Task DownloadTempGridImages(string appName, string appTarget)
{
@ -453,14 +464,28 @@ namespace UWPHook
public bool Contains(object o)
{
AppEntry appEntry = o as AppEntry;
//Return members whose Orders have not been filled
return (appEntry.Aumid.ToLower().Contains(textBox.Text.ToLower()));
}
private void HelpButton_Click(object sender, RoutedEventArgs e)
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
SettingsWindow window = new SettingsWindow();
window.ShowDialog();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (String.IsNullOrEmpty(Settings.Default.SteamGridDbApiKey) && !Settings.Default.OfferedSteamGridDB)
{
Settings.Default.OfferedSteamGridDB = true;
Settings.Default.Save();
var boxResult = MessageBox.Show("Do you want to automatically import grid images for imported games?", "UWPHook", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (boxResult == MessageBoxResult.Yes)
{
SettingsButton_Click(this, null);
}
}
}
}
}

@ -195,5 +195,17 @@ namespace UWPHook.Properties {
this["SelectedSteamGridDB_Humor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool OfferedSteamGridDB {
get {
return ((bool)(this["OfferedSteamGridDB"]));
}
set {
this["OfferedSteamGridDB"] = value;
}
}
}
}

@ -64,5 +64,8 @@
<Setting Name="SelectedSteamGridDB_Humor" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="OfferedSteamGridDB" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

@ -34,8 +34,8 @@
<RowDefinition Height="44*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="52*"/>
<ColumnDefinition Width="177*"/>
<ColumnDefinition Width="62*"/>
<ColumnDefinition Width="167*"/>
<ColumnDefinition Width="124*"/>
<ColumnDefinition Width="113*"/>
</Grid.ColumnDefinitions>
@ -48,7 +48,7 @@
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="3" Grid.Row="4"/>
<Label x:Name="label3" Content="Check if the launched app is running every" Margin="5,7,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"/>
<ComboBox x:Name="seconds_comboBox" Margin="0,7,10,0" VerticalAlignment="Top" Height="31" Grid.Column="3" HorizontalAlignment="Right" Width="93" Grid.Row="1"/>
<Button x:Name="update_button" Click="update_button_Click" Content="Check for updates" Margin="0,0,8,9" Grid.Row="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="162" Grid.Column="1"/>
<Button x:Name="update_button" Click="update_button_Click" Content="Check for updates" Margin="0,0,8,9" Grid.Row="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="162" Grid.ColumnSpan="2"/>
<Button x:Name="help_button" Click="help_button_Click" Content="Get help at our Reddit" Grid.Column="2" Margin="0,0,0,9" Grid.Row="5" VerticalAlignment="Bottom" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="163"/>
<ToggleButton x:Name="streaming_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="6,6,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Height="18" HorizontalAlignment="Left" Width="46" Grid.Row="2" />
<Label ToolTip="This fixes Steam in-home Streaming, set this in the host computer." x:Name="label1_Copy" Content="Enable streaming mode" Margin="5,1,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Grid.RowSpan="2"/>
@ -57,6 +57,7 @@
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="27" Grid.ColumnSpan="4" Margin="0,7,0,0" Grid.Row="3">
<Label Content="SteamGrid" HorizontalAlignment="Left" Margin="-10,-15,0,-17" FontFamily="Segoe UI Semibold" FontSize="14" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Button x:Name="key_Button" Content="{materialDesign:PackIcon Key}" ToolTip="Get a new API Key" Margin="6,39,7,161" Grid.Row="3" Height="Auto" Click="key_Button_Click" />
<Label ToolTip="The main style of the artwork." x:Name="label1_Copy2" Content="Artwork Style" Margin="5,73,0,0" VerticalAlignment="Top" Height="29" Grid.Row="3" Grid.Column="1"/>
<ComboBox x:Name="style_comboBox" Margin="0,73,10,0" VerticalAlignment="Top" Height="31" Grid.Column="2" HorizontalAlignment="Right" Width="222" Grid.Row="3" Grid.ColumnSpan="2">
<ComboBoxItem Content="Any"/>

@ -83,5 +83,12 @@ namespace UWPHook
{
System.Diagnostics.Process.Start("https://github.com/BrianLima/OverFy/releases");
}
private void key_Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show(messageBoxText: "You are being redirected to SteamGridDB website!\r\n" +
"Log-in, or create your account, go to your profile preferences and click 'Generate API Key', then paste the key back on UWPHook.", "Attention!", MessageBoxButton.OK, MessageBoxImage.Information );
System.Diagnostics.Process.Start("https://www.steamgriddb.com/profile/preferences");
}
}
}

@ -68,8 +68,8 @@
<Reference Include="MaterialDesignThemes.Wpf, Version=3.1.3.1513, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.3.1.3\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpSteam">
<HintPath>..\..\SharpSteam\SharpSteam\bin\Release\SharpSteam.dll</HintPath>

@ -5,6 +5,6 @@
<package id="MaterialDesignThemes" version="3.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net461" />
<package id="Microsoft.PowerShell.5.ReferenceAssemblies" version="1.1.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
<package id="System.Management.Automation" version="7.0.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="System.Management.Automation" version="7.1.0" targetFramework="net461" />
</packages>
Loading…
Cancel
Save