Version 2.2.0

Added a special mode for Steam in-home Streaming, it fools Steam into
streaming the whole desktop then it brings the launched app to the
foreground.

Now, UWPHook will export the app icon to Steam when exporting new games,
it automatically decides on the biggest jpg to be used as icon.
UWPTest 2.2.0
Brian Lima 8 years ago
parent 145a77d766
commit ac8b1dc63f

@ -19,6 +19,9 @@
<setting name="Seconds" serializeAs="String">
<value>5</value>
</setting>
<setting name="StreamMode" serializeAs="String">
<value>False</value>
</setting>
</UWPHook.Properties.Settings>
</userSettings>
</configuration>

@ -44,12 +44,12 @@ namespace UWPHook
set { _aumid = value; }
}
private string _icon;
private string _icon_path;
public string Icon
public string IconPath
{
get { return _icon; }
set { _icon = value; }
get { return _icon_path; }
set { _icon_path = value; }
}
public string widestSquareIcon()
@ -58,9 +58,8 @@ namespace UWPHook
Size size = new Size(0, 0);
List<string> images = new List<string>();
//Get every file on the directory
images.AddRange( Directory.GetFiles(_icon, "*.jpg", SearchOption.AllDirectories));
images.AddRange(Directory.GetFiles(_icon, "*.png", SearchOption.AllDirectories));
//Get every png in this directory, Steam only allows for .png's
images.AddRange(Directory.GetFiles(_icon_path, "*.png"));
//Decide which is the largest
foreach (string image in images)
@ -77,7 +76,6 @@ namespace UWPHook
return result;
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)

@ -28,6 +28,8 @@ namespace UWPHook
try
{
mgr.ActivateApplication(aumid, null, ActivateOptions.None, out processId);
//Bring the launched app to the foreground, this fixes in-home streaming
BringProcess();
}
catch (Exception e)
{
@ -88,6 +90,46 @@ namespace UWPHook
return result;
}
[DllImport("user32.dll")]
private static extern
bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern
bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern
bool IsIconic(IntPtr hWnd);
public static void BringProcess()
{
/*
        const int SW_HIDE = 0;
        const int SW_SHOWNORMAL = 1;
        const int SW_SHOWMINIMIZED = 2;
        const int SW_SHOWMAXIMIZED = 3;
        const int SW_SHOWNOACTIVATE = 4;
        const int SW_RESTORE = 9;
        const int SW_SHOWDEFAULT = 10;
        */
var me = Process.GetCurrentProcess();
var arrProcesses = Process.GetProcessById(id);
// get the window handle
IntPtr hWnd = arrProcesses.MainWindowHandle;
// if iconic, we need to restore the window
if (IsIconic(hWnd))
{
ShowWindowAsync(hWnd, 9);
}
// bring it to the foreground
SetForegroundWindow(hWnd);
}
}
public enum ActivateOptions

@ -18,13 +18,12 @@ namespace UWPHook
public partial class GamesWindow : Window
{
AppEntryModel Apps;
BackgroundWorker bwr;
BackgroundWorker bwrLoad, bwrSave;
public GamesWindow()
{
InitializeComponent();
Apps = new AppEntryModel();
listGames.ItemsSource = Apps.Entries;
//If null or 1, the app was launched normally
if (Environment.GetCommandLineArgs() != null)
@ -39,6 +38,14 @@ namespace UWPHook
private void Launcher()
{
if (Properties.Settings.Default.StreamMode)
{
this.Show();
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;
Thread.Sleep(1000);
}
this.Title = "UWPHook: Playing a game";
//Hide the window so the app is launched seamless making UWPHook run in the background without bothering the user
this.Hide();
@ -80,6 +87,24 @@ namespace UWPHook
}
private void ExportButton_Click(object sender, RoutedEventArgs e)
{
bwrSave = new BackgroundWorker();
bwrSave.DoWork += BwrSave_DoWork;
bwrSave.RunWorkerCompleted += BwrSave_RunWorkerCompleted;
grid.IsEnabled = false;
progressBar.Visibility = Visibility.Visible;
bwrSave.RunWorkerAsync();
}
private void BwrSave_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
grid.IsEnabled = true;
progressBar.Visibility = Visibility.Collapsed;
MessageBox.Show("Your apps were successfuly exported, please restart Steam in order to see your apps in it.", "UWPHook", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void BwrSave_DoWork(object sender, DoWorkEventArgs e)
{
string steam_folder = SteamManager.GetSteamFolder();
if (!String.IsNullOrEmpty(steam_folder))
@ -145,26 +170,29 @@ namespace UWPHook
}
}
MessageBox.Show("Your apps were successfuly exported, please restart Steam in order to see your apps in it.", "UWPHook", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void LoadButton_Click(object sender, RoutedEventArgs e)
{
bwr = new BackgroundWorker();
bwr.DoWork += Bwr_DoWork;
bwr.RunWorkerCompleted += Bwr_RunWorkerCompleted;
bwrLoad = new BackgroundWorker();
bwrLoad.DoWork += Bwr_DoWork;
bwrLoad.RunWorkerCompleted += Bwr_RunWorkerCompleted;
grid.IsEnabled = false;
progressBar.Visibility = Visibility.Visible;
bwr.RunWorkerAsync();
Apps.Entries = new System.Collections.ObjectModel.ObservableCollection<AppEntry>();
bwrLoad.RunWorkerAsync();
}
private void Bwr_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
grid.IsEnabled = true;
listGames.Columns[1].IsReadOnly = true;
listGames.ItemsSource = Apps.Entries;
listGames.Columns[2].IsReadOnly = true;
listGames.Columns[3].IsReadOnly = true;
grid.IsEnabled = true;
progressBar.Visibility = Visibility.Collapsed;
label.Content = "Installed Apps";
}
@ -174,19 +202,19 @@ namespace UWPHook
try
{
//Get all installed apps on the system excluding frameworks
List<String> installedApps = AppManager.GetInstalledApps();
List<String> installedApps = AppManager.GetInstalledApps();
//Alfabetic sort
installedApps.Sort();
//Split every app that we couldn't resolve the app name
var x = (from s in installedApps where s.Contains("double click") select s).ToList<String>();
var nameNotFound = (from s in installedApps where s.Contains("double click") select s).ToList<String>();
//Remove them from the original list
installedApps.RemoveAll(item => item.Contains("double click"));
//Rejoin them in the original list, but putting them into last
installedApps = installedApps.Union(x).ToList<String>();
installedApps = installedApps.Union(nameNotFound).ToList<String>();
foreach (var app in installedApps)
{
@ -199,11 +227,10 @@ namespace UWPHook
string logosPath = Path.GetDirectoryName(valor[1]);
Application.Current.Dispatcher.BeginInvoke((Action)delegate ()
{
Apps.Entries.Add(new AppEntry() { Name = valor[0], Icon = logosPath, Aumid = valor[2], Selected = false});
Apps.Entries.Add(new AppEntry() { Name = valor[0], IconPath = logosPath, Aumid = valor[2], Selected = false });
});
}
}
}
catch (Exception ex)
{

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.4.0")]
[assembly: AssemblyFileVersion("2.1.4.0")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]

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

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

@ -25,8 +25,9 @@
<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!"/>
<Grid Margin="10" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="4*"/>
<RowDefinition Height="93*"/>
<RowDefinition Height="49*"/>
<RowDefinition Height="325*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="52*"/>
@ -40,11 +41,13 @@
<ToggleButton x:Name="language_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="4,56,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Height="18" HorizontalAlignment="Left" Width="46" />
<Label ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="label1" Content="Set system language when launching an app*" Margin="5,48,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.ColumnSpan="2"/>
<ComboBox ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="cultures_comboBox" Margin="0,48,10,0" VerticalAlignment="Top" Height="31" Grid.Column="3" HorizontalAlignment="Right" Width="93"/>
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" Margin="0,95,10,0" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="3" Grid.Row="1"/>
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" Margin="0,42,10,0" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="3" Grid.Row="2"/>
<Label x:Name="label3" Content="Check if the launched app is running every" Margin="5,0,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"/>
<ComboBox x:Name="seconds_comboBox" Margin="0,10,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" Grid.Column="1" Margin="0,0,5,10" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="162"/>
<Button x:Name="help_button" Click="help_button_Click" Content="Get help at our Reddit" Grid.Column="2" Margin="8,0,0,10" Grid.Row="1" VerticalAlignment="Bottom" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="163"/>
<Button x:Name="update_button" Click="update_button_Click" Content="Check for updates" Grid.Column="1" Margin="0,0,5,10" Grid.Row="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="162"/>
<Button x:Name="help_button" Click="help_button_Click" Content="Get help at our Reddit" Grid.Column="2" Margin="8,0,0,10" Grid.Row="2" VerticalAlignment="Bottom" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="163"/>
<ToggleButton x:Name="streaming_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="0,17,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Height="18" HorizontalAlignment="Left" Width="46" Grid.Row="2" />
<Label ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="label1_Copy" Content="Enable streaming mode" Margin="5,10,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2"/>
</Grid>
<Grid Margin="10,10,10,0" Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
@ -88,7 +91,7 @@
<Label Content="About" HorizontalAlignment="Left" Margin="-10,-15,0,-17" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="14" Height="32" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image2" Height="150" VerticalAlignment="Top" Source="Resources/briano.png" Stretch="UniformToFill" Margin="8,32,0,0" HorizontalAlignment="Left" Width="150" Grid.Column="1"/>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock_Copy" VerticalAlignment="Top" Height="59" Text="This project uses the MaterialDesignXAMLToolkit. Special thanks to /r/Forza community at Reddit." TextAlignment="Justify" Grid.Row="4" Grid.ColumnSpan="3"/>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock_Copy" VerticalAlignment="Top" Height="59" Text="This project uses the MaterialDesignXAMLToolkit. Special thanks to /r/Forza and /r/Steam communities at Reddit." TextAlignment="Justify" Grid.Row="3" Grid.ColumnSpan="3" Margin="0,44,0,0" Grid.RowSpan="2"/>
</Grid>
</Grid>
</Window>

@ -31,6 +31,7 @@ namespace UWPHook
cultures_comboBox.SelectedItem = Properties.Settings.Default.TargetLanguage;
language_toggle.IsChecked = Properties.Settings.Default.ChangeLanguage;
streaming_toggle.IsChecked = Properties.Settings.Default.StreamMode;
}
private void saveButton_Click(object sender, RoutedEventArgs e)
@ -38,6 +39,7 @@ namespace UWPHook
Properties.Settings.Default.ChangeLanguage = (bool)language_toggle.IsChecked;
Properties.Settings.Default.TargetLanguage = cultures_comboBox.SelectedItem.ToString();
Properties.Settings.Default.Seconds = Int32.Parse(seconds_comboBox.SelectedItem.ToString().Substring(0, 1));
Properties.Settings.Default.StreamMode = (bool)streaming_toggle.IsChecked;
Properties.Settings.Default.Save();
this.Close();
}

Loading…
Cancel
Save