mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add icon for launching from desktop
This commit is contained in:
parent
e10e2a830b
commit
0f8cd4a922
@ -373,15 +373,21 @@ namespace Bloxstrap
|
||||
// this SHOULD go under Register(),
|
||||
// but then people who have Bloxstrap v1.0.0 installed won't have this without a reinstall
|
||||
// maybe in a later version?
|
||||
if (!Directory.Exists(Program.StartMenu))
|
||||
if (!Directory.Exists(Directories.StartMenu))
|
||||
{
|
||||
Directory.CreateDirectory(Program.StartMenu);
|
||||
Directory.CreateDirectory(Directories.StartMenu);
|
||||
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.App, "", Directories.App, 0)
|
||||
.WriteToFile(Path.Combine(Program.StartMenu, "Play Roblox.lnk"));
|
||||
.WriteToFile(Path.Combine(Directories.StartMenu, "Play Roblox.lnk"));
|
||||
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.App, "-preferences", Directories.App, 0)
|
||||
.WriteToFile(Path.Combine(Program.StartMenu, $"Configure {Program.ProjectName}.lnk"));
|
||||
.WriteToFile(Path.Combine(Directories.StartMenu, $"Configure {Program.ProjectName}.lnk"));
|
||||
}
|
||||
|
||||
if (Program.Settings.CreateDesktopIcon && !File.Exists(Path.Combine(Directories.Desktop, "Play Roblox.lnk")))
|
||||
{
|
||||
ShellLink.Shortcut.CreateShortcut(Directories.App, "", Directories.App, 0)
|
||||
.WriteToFile(Path.Combine(Directories.Desktop, "Play Roblox.lnk"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,7 +422,10 @@ namespace Bloxstrap
|
||||
Registry.CurrentUser.DeleteSubKey($@"Software\{Program.ProjectName}");
|
||||
|
||||
// delete start menu folder
|
||||
Directory.Delete(Program.StartMenu, true);
|
||||
Directory.Delete(Directories.StartMenu, true);
|
||||
|
||||
// delete desktop shortcut
|
||||
File.Delete(Path.Combine(Directories.Desktop, "Play Roblox.lnk"));
|
||||
|
||||
// delete uninstall key
|
||||
Registry.CurrentUser.DeleteSubKey($@"Software\Microsoft\Windows\CurrentVersion\Uninstall\{Program.ProjectName}");
|
||||
@ -425,7 +434,10 @@ namespace Bloxstrap
|
||||
// (should delete everything except bloxstrap itself)
|
||||
Directory.Delete(Directories.Base, true);
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine($"Could not fully uninstall! ({e})");
|
||||
}
|
||||
|
||||
Dialog.ShowSuccess($"{Program.ProjectName} has succesfully uninstalled");
|
||||
|
||||
@ -604,8 +616,7 @@ namespace Bloxstrap
|
||||
// package doesn't exist, likely mistakenly placed file
|
||||
string versionFileLocation = Path.Combine(VersionFolder, fileLocation);
|
||||
|
||||
if (File.Exists(versionFileLocation))
|
||||
File.Delete(versionFileLocation);
|
||||
File.Delete(versionFileLocation);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -647,7 +658,7 @@ namespace Bloxstrap
|
||||
{
|
||||
string packageUrl = $"{DeployManager.BaseUrl}/{VersionGuid}-{package.Name}";
|
||||
string packageLocation = Path.Combine(Directories.Downloads, package.Signature);
|
||||
string robloxPackageLocation = Path.Combine(Program.LocalAppData, "Roblox", "Downloads", package.Signature);
|
||||
string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature);
|
||||
|
||||
if (File.Exists(packageLocation))
|
||||
{
|
||||
@ -657,7 +668,7 @@ namespace Bloxstrap
|
||||
if (calculatedMD5 != package.Signature)
|
||||
{
|
||||
Debug.WriteLine($"{package.Name} is corrupted ({calculatedMD5} != {package.Signature})! Deleting and re-downloading...");
|
||||
file.Delete();
|
||||
file.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -743,10 +754,7 @@ namespace Bloxstrap
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
if (File.Exists(extractPath))
|
||||
File.Delete(extractPath);
|
||||
|
||||
await Task.Run(() => entry.ExtractToFile(extractPath));
|
||||
await Task.Run(() => entry.ExtractToFile(extractPath, true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -776,8 +784,7 @@ namespace Bloxstrap
|
||||
|
||||
string fileLocation = Path.Combine(packageFolder, entry.FullName);
|
||||
|
||||
if (File.Exists(fileLocation))
|
||||
File.Delete(fileLocation);
|
||||
File.Delete(fileLocation);
|
||||
|
||||
entry.ExtractToFile(fileLocation);
|
||||
}
|
||||
|
@ -159,6 +159,7 @@
|
||||
<Button x:Name="ButtonPreview" Content="Preview" Margin="0,5,0,0" VerticalAlignment="Bottom" Height="23" Click="ButtonPreview_Click" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<CheckBox Content=" Create desktop icon" IsChecked="{Binding CreateDesktopIcon, Mode=TwoWay}" Margin="10,10,10,0" />
|
||||
<CheckBox Content=" Check for Bloxstrap updates on startup" IsChecked="{Binding CheckForUpdates, Mode=TwoWay}" Margin="10,10,10,0" />
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
@ -262,7 +262,7 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
#endregion
|
||||
|
||||
#region Installation
|
||||
private string installLocation = Program.IsFirstRun ? Path.Combine(Program.LocalAppData, Program.ProjectName) : Program.BaseDirectory;
|
||||
private string installLocation = Program.IsFirstRun ? Path.Combine(Directories.LocalAppData, Program.ProjectName) : Program.BaseDirectory;
|
||||
public string InstallLocation
|
||||
{
|
||||
get => installLocation;
|
||||
@ -383,6 +383,12 @@ namespace Bloxstrap.Dialogs.Menu
|
||||
set => Program.Settings.BootstrapperIcon = Icons[value];
|
||||
}
|
||||
|
||||
public bool CreateDesktopIcon
|
||||
{
|
||||
get => Program.Settings.CreateDesktopIcon;
|
||||
set => Program.Settings.CreateDesktopIcon = value;
|
||||
}
|
||||
|
||||
public bool CheckForUpdates
|
||||
{
|
||||
get => Program.Settings.CheckForUpdates;
|
||||
|
@ -4,6 +4,12 @@ namespace Bloxstrap.Helpers
|
||||
{
|
||||
class Directories
|
||||
{
|
||||
// note that these are directories that aren't tethered to the basedirectory
|
||||
// so these can safely be called before initialization
|
||||
public static string LocalAppData { get => Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); }
|
||||
public static string Desktop { get => Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); }
|
||||
public static string StartMenu { get => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", Program.ProjectName); }
|
||||
|
||||
public static string Base { get; private set; } = "";
|
||||
public static string Downloads { get; private set; } = "";
|
||||
public static string Integrations { get; private set; } = "";
|
||||
|
@ -85,7 +85,7 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
//
|
||||
// we'll tail the log file continuously, monitoring for any log entries that we need to determine the current game activity
|
||||
|
||||
string logDirectory = Path.Combine(Program.LocalAppData, "Roblox\\logs");
|
||||
string logDirectory = Path.Combine(Directories.LocalAppData, "Roblox\\logs");
|
||||
|
||||
if (!Directory.Exists(logDirectory))
|
||||
return;
|
||||
|
@ -331,12 +331,8 @@ namespace Bloxstrap.Helpers.Integrations
|
||||
Debug.WriteLine("[ReShade] Uninstalling ReShade...");
|
||||
|
||||
// delete any stock config files
|
||||
|
||||
if (File.Exists(injectorLocation))
|
||||
File.Delete(injectorLocation);
|
||||
|
||||
if (File.Exists(ConfigLocation))
|
||||
File.Delete(ConfigLocation);
|
||||
File.Delete(injectorLocation);
|
||||
File.Delete(ConfigLocation);
|
||||
|
||||
Program.Settings.ReShadeConfigVersion = "";
|
||||
|
||||
|
@ -5,32 +5,35 @@ namespace Bloxstrap.Models
|
||||
{
|
||||
public class SettingsFormat
|
||||
{
|
||||
public string Channel { get; set; } = DeployManager.DefaultChannel;
|
||||
public string VersionGuid { get; set; } = "";
|
||||
|
||||
public bool CheckForUpdates { get; set; } = true;
|
||||
public bool PromptChannelChange { get; set; } = false;
|
||||
|
||||
public BootstrapperStyle BootstrapperStyle { get; set; } = BootstrapperStyle.ProgressDialog;
|
||||
public BootstrapperIcon BootstrapperIcon { get; set; } = BootstrapperIcon.IconBloxstrap;
|
||||
public Theme Theme { get; set; } = Theme.Default;
|
||||
|
||||
public bool UseDiscordRichPresence { get; set; } = true;
|
||||
public bool HideRPCButtons { get; set; } = false;
|
||||
public bool RFUEnabled { get; set; } = false;
|
||||
public bool RFUAutoclose { get; set; } = false;
|
||||
|
||||
// could these be moved to a separate file (something like State.json)?
|
||||
// the only problem is i havent yet figured out a way to boil down the settings handler to reduce boilerplate
|
||||
// as the Program class needs a Settings and a SettingsManager property
|
||||
// once i figure that out, then ig i could move these
|
||||
public string VersionGuid { get; set; } = "";
|
||||
public string RFUVersion { get; set; } = "";
|
||||
public string ReShadeConfigVersion { get; set; } = "";
|
||||
public string ExtraviPresetsVersion { get; set; } = "";
|
||||
|
||||
// bloxstrap configuration
|
||||
public BootstrapperStyle BootstrapperStyle { get; set; } = BootstrapperStyle.ProgressDialog;
|
||||
public BootstrapperIcon BootstrapperIcon { get; set; } = BootstrapperIcon.IconBloxstrap;
|
||||
public Theme Theme { get; set; } = Theme.Default;
|
||||
public bool CheckForUpdates { get; set; } = true;
|
||||
public bool CreateDesktopIcon { get; set; } = true;
|
||||
|
||||
// channel configuration
|
||||
public string Channel { get; set; } = DeployManager.DefaultChannel;
|
||||
public bool PromptChannelChange { get; set; } = false;
|
||||
|
||||
// integration configuration
|
||||
public bool UseDiscordRichPresence { get; set; } = true;
|
||||
public bool HideRPCButtons { get; set; } = false;
|
||||
public bool RFUEnabled { get; set; } = false;
|
||||
public bool RFUAutoclose { get; set; } = false;
|
||||
public bool UseReShade { get; set; } = false;
|
||||
public bool UseReShadeExtraviPresets { get; set; } = false;
|
||||
|
||||
// mod preset configuration
|
||||
public bool UseOldDeathSound { get; set; } = true;
|
||||
public bool UseOldMouseCursor { get; set; } = false;
|
||||
public bool UseDisableAppPatch { get; set; } = false;
|
||||
|
@ -31,8 +31,6 @@ namespace Bloxstrap
|
||||
public static bool IsUpgrade { get; private set; } = false;
|
||||
public static string[] LaunchArgs { get; private set; } = null!;
|
||||
|
||||
public static string LocalAppData { get; private set; } = null!;
|
||||
public static string StartMenu { get; private set; } = null!;
|
||||
|
||||
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
|
||||
|
||||
@ -70,9 +68,6 @@ namespace Bloxstrap
|
||||
HttpClient.Timeout = TimeSpan.FromMinutes(5);
|
||||
HttpClient.DefaultRequestHeaders.Add("User-Agent", ProjectRepository);
|
||||
|
||||
LocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
StartMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", ProjectName);
|
||||
|
||||
if (args.Length > 0)
|
||||
{
|
||||
if (Array.IndexOf(args, "-quiet") != -1)
|
||||
@ -97,7 +92,7 @@ namespace Bloxstrap
|
||||
Settings = SettingsManager.Settings;
|
||||
|
||||
if (IsQuiet)
|
||||
BaseDirectory = Path.Combine(LocalAppData, ProjectName);
|
||||
BaseDirectory = Path.Combine(Directories.LocalAppData, ProjectName);
|
||||
else
|
||||
new Preferences().ShowDialog();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user