Skip to content

Commit

Permalink
Release 1.11.0
Browse files Browse the repository at this point in the history
Release 1.11.0
  • Loading branch information
Yelo420 authored Jun 26, 2024
2 parents c5a6da4 + f8d617a commit 1141438
Show file tree
Hide file tree
Showing 35 changed files with 916 additions and 160 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# GameVault App Changelog

## 1.11.0.0
Recommended Gamevault Server Version: `v12.2.0`
### Changes

- You can now delete all downloads at once
- Added setting to automatically delete files from portable games after successful installation
- Added setting to automatically install portable games
- Ability to change and overwrite the Installation Procedure
- Desktop shortcuts start the game via GameVault. So changed executable or parameters are updated immediately as well.
- Option to create a shortcut upon clicking install. Remembers the last input as default.
- Implemented Jumplist to taskbar icon.
- Allow user to specify rows displayed of installed games.
- Notifications about download/extraction events now also display the game box image
- Library filter is set when you click on game type/Genre/Tag in the gameview.
- Added setting to the admin panel to hide/show deleted users
- Bug fix: Crash on local download directory has wrong name format
- Bug fix: The header of the image downloader was sometimes encoded incorrectly

## 1.10.1.0
Recommended Gamevault Server Version: `v12.1.1`
### Changes
Expand Down
85 changes: 81 additions & 4 deletions gamevault/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using System.Text.Json;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Shell;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace gamevault
{
Expand All @@ -24,12 +27,32 @@ namespace gamevault
/// </summary>
public partial class App : Application
{
#region Singleton
private static App instance = null;
private static readonly object padlock = new object();

public static App Instance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new App();
}
return instance;
}
}
}
#endregion
public static bool ShowToastMessage = true;
public static bool IsWindowsPackage = false;

public static CommandOptions? CommandLineOptions { get; internal set; } = null;

private NotifyIcon m_Icon;
private JumpList jumpList;

private GameTimeTracker m_gameTimeTracker;

Expand Down Expand Up @@ -77,9 +100,10 @@ private async void Application_Startup(object sender, StartupEventArgs e)
{
MainWindow.Hide();
}

#if WINDOWS
InitNotifyIcon();

InitJumpList();
#endif
// After the app is created and most things are instantiated, handle any special command line stuff
if (PipeServiceHandler.Instance != null)
{
Expand Down Expand Up @@ -127,14 +151,56 @@ private void InitNotifyIcon()
m_Icon.MouseDoubleClick += NotifyIcon_DoubleClick;
Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/icon.ico")).Stream;
m_Icon.Icon = new System.Drawing.Icon(iconStream);
m_Icon.ContextMenuStrip = new ContextMenuStrip();
m_Icon.ContextMenuStrip = new ContextMenuStrip();
m_Icon.ContextMenuStrip.Items.Add("Library", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Library.png")).Stream), Navigate_Tab_Click);
m_Icon.ContextMenuStrip.Items.Add("Downloads", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Downloads.png")).Stream), Navigate_Tab_Click);
m_Icon.ContextMenuStrip.Items.Add("Community", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Community.png")).Stream), Navigate_Tab_Click);
m_Icon.ContextMenuStrip.Items.Add("Settings", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Settings.png")).Stream), Navigate_Tab_Click);
m_Icon.ContextMenuStrip.Items.Add("Settings", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Settings.png")).Stream), Navigate_Tab_Click);
m_Icon.ContextMenuStrip.Items.Add("Exit", new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/gamevault;component/Resources/Images/ContextMenuIcon_Exit.png")).Stream), NotifyIcon_Exit_Click);
m_Icon.Visible = true;
}
private void InitJumpList()
{
jumpList = JumpList.GetJumpList(Application.Current);
if (jumpList == null)
{
jumpList = new JumpList();
JumpList.SetJumpList(Application.Current, jumpList);
}

JumpTask LibraryTask = new JumpTask() { Title = "Library", Description = "Open Library", CustomCategory = "Actions", ApplicationPath = Process.GetCurrentProcess().MainModule.FileName, Arguments = "show --jumplistcommand=0" };
JumpTask DownloadsTask = new JumpTask() { Title = "Downloads", Description = "Open Downloads", CustomCategory = "Actions", ApplicationPath = Process.GetCurrentProcess().MainModule.FileName, Arguments = "show --jumplistcommand=1" };
JumpTask CommunityTask = new JumpTask() { Title = "Community", Description = "Open Community", CustomCategory = "Actions", ApplicationPath = Process.GetCurrentProcess().MainModule.FileName, Arguments = "show --jumplistcommand=2" };
JumpTask SettingsTask = new JumpTask() { Title = "Settings", Description = "Open Settings", CustomCategory = "Actions", ApplicationPath = Process.GetCurrentProcess().MainModule.FileName, Arguments = "show --jumplistcommand=3" };
JumpTask ExitTask = new JumpTask() { Title = "Exit", Description = "Exit GameVault", CustomCategory = "Actions", ApplicationPath = Process.GetCurrentProcess().MainModule.FileName, Arguments = "show --jumplistcommand=15" };
jumpList.JumpItems.Add(LibraryTask);
jumpList.JumpItems.Add(DownloadsTask);
jumpList.JumpItems.Add(CommunityTask);
jumpList.JumpItems.Add(SettingsTask);
jumpList.JumpItems.Add(ExitTask);

}
public void SetJumpListGames()
{
var lastGames = InstallViewModel.Instance.InstalledGames.Take(5).ToArray();
foreach (var game in lastGames)
{
if (!jumpList.JumpItems.OfType<JumpTask>().Any(jt => jt.Title == game.Key.Title))
{
JumpTask gameTask = new JumpTask()
{
Title = game.Key.Title,
CustomCategory = "Last Played",
ApplicationPath = Process.GetCurrentProcess().MainModule.FileName,
IconResourcePath = Preferences.Get(AppConfigKey.Executable, $"{game.Value}\\gamevault-exec"),
Arguments = $"start --gameid={game.Key.ID}"
};
jumpList.JumpItems.Add(gameTask);
}
}

jumpList.Apply();
}
private void RestoreTheme()
{
try
Expand Down Expand Up @@ -170,6 +236,10 @@ private void NotifyIcon_DoubleClick(Object sender, EventArgs e)
}

private async void NotifyIcon_Exit_Click(Object sender, EventArgs e)
{
await ExitApp();
}
public async Task ExitApp()
{
if ((DownloadsViewModel.Instance.DownloadedGames.Where(g => g.IsDownloading() == true)).Count() > 0)
{
Expand Down Expand Up @@ -228,5 +298,12 @@ private void CreateDirectories()
Directory.CreateDirectory(AppFilePath.ThemesLoadDir);
}
}
public bool IsWindowActiveAndControlInFocus(MainControl control)
{
if (Current.MainWindow == null)
return false;

return Current.MainWindow.IsActive && MainWindowViewModel.Instance.ActiveControlIndex == (int)control;
}
}
}
2 changes: 1 addition & 1 deletion gamevault/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: AssemblyVersion("1.10.1.0")]
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyCopyright("© Phalcode™. All Rights Reserved.")]
#if DEBUG
[assembly: XmlnsDefinition("debug-mode", "Namespace")]
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Converter/InverseNullConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class InverseNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (value == null);
return (value == null);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
59 changes: 59 additions & 0 deletions gamevault/Helper/DesktopHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using gamevault.ViewModels;
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.Controls;
using System;
using System.IO;
using System.Threading.Tasks;
using gamevault.Models;

namespace gamevault.Helper
{
public static class DesktopHelper
{
public static async Task CreateShortcut(Game game, string iconPath, bool ask)
{
try
{
string desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string shortcutPath = desktopDir + @"\\" + game.Title + ".url";
if (File.Exists(shortcutPath))
{
MainWindowViewModel.Instance.AppBarText = "Desktop shortcut already exists";
return;
}
if (ask)
{
MessageDialogResult result = await ((MetroWindow)App.Current.MainWindow).ShowMessageAsync($"Do you want to create a desktop shortcut for {game.Title}?", "",
MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Yes", NegativeButtonText = "No", AnimateHide = false });

if (result != MessageDialogResult.Affirmative)
return;
}
using (StreamWriter writer = new StreamWriter(shortcutPath))
{
writer.Write("[InternetShortcut]\r\n");
writer.Write($"URL=gamevault://start?gameid={game.ID}" + "\r\n");
writer.Write("IconIndex=0\r\n");
writer.Write("IconFile=" + iconPath.Replace('\\', '/') + "\r\n");
//writer.WriteLine($"WorkingDirectory={Path.GetDirectoryName(SavedExecutable).Replace('\\', '/')}");
writer.Flush();
}

}
catch { }
}
public static void RemoveShotcut(Game game)
{
try
{
string desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string shortcutPath = desktopDir + @"\\" + game.Title + ".url";
if (File.Exists(shortcutPath))
{
File.Delete(shortcutPath);
}
}
catch { }
}
}
}
5 changes: 2 additions & 3 deletions gamevault/Helper/GameTimeTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public async Task Start()
private void TimerCallback(object sender, ElapsedEventArgs e)
{
Task.Run(() =>
{
string installationPath = $"{SettingsViewModel.Instance.RootPath}\\GameVault\\Installations";
installationPath = installationPath.Replace(@"\\", @"\");
{
string installationPath = Path.Combine(SettingsViewModel.Instance.RootPath, "GameVault\\Installations");
if (!Directory.Exists(installationPath))
return;
Expand Down
4 changes: 2 additions & 2 deletions gamevault/Helper/GifHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static bool IsDisposableGif(MagickImageCollection frames)
internal static bool IsGif(string filePath)
{
// GIF signature: 47 49 46 38 39 (47 49 46 37 61 for GIF87a)
byte[] gifSignature = Encoding.ASCII.GetBytes("GIF");
byte[] gifSignature = Encoding.UTF8.GetBytes("GIF");
try
{
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
Expand All @@ -112,7 +112,7 @@ internal static bool IsGif(string filePath)
}
internal static bool IsGif(MemoryStream ms)
{
byte[] gifSignature = Encoding.ASCII.GetBytes("GIF");
byte[] gifSignature = Encoding.UTF8.GetBytes("GIF");
try
{
byte[] buffer = new byte[3];
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Helper/HttpClientDownloadWithProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task StartDownload(bool tryResume = false)
private void CreateHeader()
{
string[] auth = WebHelper.GetCredentials();
HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes($"{auth[0]}:{auth[1]}")));
HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{auth[0]}:{auth[1]}")));
HttpClient.DefaultRequestHeaders.Add("User-Agent", $"GameVault/{SettingsViewModel.Instance.Version}");

if (AdditionalHeader != null)
Expand Down
10 changes: 8 additions & 2 deletions gamevault/Helper/ToastMessageHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -9,11 +10,16 @@ namespace gamevault.Helper
{
public class ToastMessageHelper
{
public static void CreateToastMessage(string title, string message)
public static void CreateToastMessage(string title, string message, string imageUri = "")
{
try
{
new ToastContentBuilder().AddText(title).AddText(message).Show();
var builder = new ToastContentBuilder().AddText(title).AddText(message);
if (imageUri != "" && File.Exists(imageUri))
{
builder.AddInlineImage(new Uri(imageUri));
}
builder.Show();
}
catch { }
}
Expand Down
Loading

0 comments on commit 1141438

Please sign in to comment.