42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Diagnostics;
|
|
using RobloxLegacy.Utilities;
|
|
|
|
namespace RobloxLegacy;
|
|
|
|
public class Installer
|
|
{
|
|
private static readonly string InstallPath = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
|
"Roblox", "Versions"
|
|
);
|
|
|
|
private static void SetShortcuts(string filePath)
|
|
{
|
|
// create a shortcut on the desktop
|
|
Shortcut.Create(
|
|
"Launch Roblox",
|
|
filePath,
|
|
"Updater and patcher for roblox on legacy operating systems",
|
|
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
|
|
);
|
|
|
|
// create a shortcut in the start menu
|
|
Shortcut.Create(
|
|
"Roblox Legacy",
|
|
filePath,
|
|
"Updater and patcher for roblox on legacy operating systems",
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs")
|
|
);
|
|
}
|
|
|
|
public static void DeployBootstrapper()
|
|
{
|
|
var bootstrapperPath = Process.GetCurrentProcess()?.MainModule?.FileName ?? throw new Exception("Could not find bootstrapper");
|
|
var installPath = Path.Combine(InstallPath, "RobloxLegacy.exe");
|
|
if(bootstrapperPath == installPath) // already installed
|
|
return;
|
|
Directory.CreateDirectory(InstallPath);
|
|
File.Copy(bootstrapperPath, installPath, true);
|
|
SetShortcuts(installPath);
|
|
}
|
|
} |