add appsettings writing + organisation

This commit is contained in:
murdle 2025-05-02 07:16:22 -07:00
parent b7016ba0ca
commit 191b6d8b4d
6 changed files with 24 additions and 8 deletions

View File

@ -32,11 +32,11 @@ public class Installer
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
var newExePath = Path.Combine(InstallPath, "RobloxLegacy.exe");
if(bootstrapperPath == newExePath) // already installed
return;
Directory.CreateDirectory(InstallPath);
File.Copy(bootstrapperPath, installPath, true);
SetShortcuts(installPath);
File.Copy(bootstrapperPath, newExePath, true);
SetShortcuts(newExePath);
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings>
<ContentFolder>content</ContentFolder>
<BaseUrl>http://www.roblox.com</BaseUrl>
</Settings>

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Company>RandomServer</Company>
<ApplicationIcon>icon.ico</ApplicationIcon>
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
@ -20,8 +20,10 @@
<ItemGroup>
<EmbeddedResource Include="..\RobloxWrapper\build\lptch.dll">
<Link>lptch.dll</Link>
<Link>Resources\lptch.dll</Link>
</EmbeddedResource>
<None Remove="Resources\AppSettings.xml" />
<EmbeddedResource Include="Resources\AppSettings.xml" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@ public class Resource(string name)
private Stream? GetStream()
{
var assembly = Assembly.GetExecutingAssembly();
return assembly.GetManifestResourceStream(name);
return assembly.GetManifestResourceStream($"RobloxLegacy.Resources.{name}");
}
public byte[]? GetBytes()

View File

@ -55,6 +55,14 @@ public class VersionManager : IDisposable
fastZip.ExtractZip(tempFile, extractPath, null);
}
private void WriteAppSettings()
{
var appSettings = new Resource($"AppSettings.xml").GetBytes();
if (appSettings == null)
throw new Exception("Failed to get AppSettings resource");
File.WriteAllBytesAsync(Path.Combine(GetVersionPath(_currentVersion), "AppSettings.xml"), appSettings);
}
private void PatchStudio()
{
Logger.Info("Patching application...");
@ -64,7 +72,7 @@ public class VersionManager : IDisposable
Patcher.RenameImports(exePath, ["KERNEL32.dll", "MFPlat.DLL"], DllName);
// now we can write the dll to the folder
var dllContents = new Resource($"RobloxLegacy.{DllName}").GetBytes();
var dllContents = new Resource(DllName).GetBytes();
if (dllContents == null)
throw new Exception("Failed to get dll resource");
File.WriteAllBytesAsync(Path.Combine(GetVersionPath(_currentVersion), DllName), dllContents);
@ -99,6 +107,7 @@ public class VersionManager : IDisposable
}
_currentVersion = version.UploadHash;
WriteAppSettings();
Registry.SaveVersion(_appData.PackageName, version.UploadHash);
// need to patch the executable