add appsettings writing + organisation
This commit is contained in:
		
							parent
							
								
									b7016ba0ca
								
							
						
					
					
						commit
						191b6d8b4d
					
				@ -32,11 +32,11 @@ public class Installer
 | 
				
			|||||||
    public static void DeployBootstrapper()
 | 
					    public static void DeployBootstrapper()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        var bootstrapperPath = Process.GetCurrentProcess()?.MainModule?.FileName ?? throw new Exception("Could not find bootstrapper");
 | 
					        var bootstrapperPath = Process.GetCurrentProcess()?.MainModule?.FileName ?? throw new Exception("Could not find bootstrapper");
 | 
				
			||||||
        var installPath = Path.Combine(InstallPath, "RobloxLegacy.exe");
 | 
					        var newExePath = Path.Combine(InstallPath, "RobloxLegacy.exe");
 | 
				
			||||||
        if(bootstrapperPath == installPath) // already installed
 | 
					        if(bootstrapperPath == newExePath) // already installed
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        Directory.CreateDirectory(InstallPath);
 | 
					        Directory.CreateDirectory(InstallPath);
 | 
				
			||||||
        File.Copy(bootstrapperPath, installPath, true);
 | 
					        File.Copy(bootstrapperPath, newExePath, true);
 | 
				
			||||||
        SetShortcuts(installPath);
 | 
					        SetShortcuts(newExePath);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										5
									
								
								RobloxLegacy/Resources/AppSettings.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								RobloxLegacy/Resources/AppSettings.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<Settings>
 | 
				
			||||||
 | 
						<ContentFolder>content</ContentFolder>
 | 
				
			||||||
 | 
						<BaseUrl>http://www.roblox.com</BaseUrl>
 | 
				
			||||||
 | 
					</Settings>
 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB  | 
@ -6,7 +6,7 @@
 | 
				
			|||||||
        <ImplicitUsings>enable</ImplicitUsings>
 | 
					        <ImplicitUsings>enable</ImplicitUsings>
 | 
				
			||||||
        <Nullable>enable</Nullable>
 | 
					        <Nullable>enable</Nullable>
 | 
				
			||||||
        <Company>RandomServer</Company>
 | 
					        <Company>RandomServer</Company>
 | 
				
			||||||
        <ApplicationIcon>icon.ico</ApplicationIcon>
 | 
					        <ApplicationIcon>Resources\icon.ico</ApplicationIcon>
 | 
				
			||||||
    </PropertyGroup>
 | 
					    </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <PropertyGroup>
 | 
					    <PropertyGroup>
 | 
				
			||||||
@ -20,8 +20,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <ItemGroup>
 | 
					    <ItemGroup>
 | 
				
			||||||
      <EmbeddedResource Include="..\RobloxWrapper\build\lptch.dll">
 | 
					      <EmbeddedResource Include="..\RobloxWrapper\build\lptch.dll">
 | 
				
			||||||
        <Link>lptch.dll</Link>
 | 
					        <Link>Resources\lptch.dll</Link>
 | 
				
			||||||
      </EmbeddedResource>
 | 
					      </EmbeddedResource>
 | 
				
			||||||
 | 
					      <None Remove="Resources\AppSettings.xml" />
 | 
				
			||||||
 | 
					      <EmbeddedResource Include="Resources\AppSettings.xml" />
 | 
				
			||||||
    </ItemGroup>
 | 
					    </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</Project>
 | 
					</Project>
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ public class Resource(string name)
 | 
				
			|||||||
    private Stream? GetStream()
 | 
					    private Stream? GetStream()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        var assembly = Assembly.GetExecutingAssembly();
 | 
					        var assembly = Assembly.GetExecutingAssembly();
 | 
				
			||||||
        return assembly.GetManifestResourceStream(name);
 | 
					        return assembly.GetManifestResourceStream($"RobloxLegacy.Resources.{name}");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public byte[]? GetBytes()
 | 
					    public byte[]? GetBytes()
 | 
				
			||||||
 | 
				
			|||||||
@ -55,6 +55,14 @@ public class VersionManager : IDisposable
 | 
				
			|||||||
        fastZip.ExtractZip(tempFile, extractPath, null);
 | 
					        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()
 | 
					    private void PatchStudio()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Logger.Info("Patching application...");
 | 
					        Logger.Info("Patching application...");
 | 
				
			||||||
@ -64,7 +72,7 @@ public class VersionManager : IDisposable
 | 
				
			|||||||
        Patcher.RenameImports(exePath, ["KERNEL32.dll", "MFPlat.DLL"], DllName);
 | 
					        Patcher.RenameImports(exePath, ["KERNEL32.dll", "MFPlat.DLL"], DllName);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        // now we can write the dll to the folder
 | 
					        // 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)
 | 
					        if (dllContents == null)
 | 
				
			||||||
            throw new Exception("Failed to get dll resource");
 | 
					            throw new Exception("Failed to get dll resource");
 | 
				
			||||||
        File.WriteAllBytesAsync(Path.Combine(GetVersionPath(_currentVersion), DllName), dllContents);
 | 
					        File.WriteAllBytesAsync(Path.Combine(GetVersionPath(_currentVersion), DllName), dllContents);
 | 
				
			||||||
@ -99,6 +107,7 @@ public class VersionManager : IDisposable
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _currentVersion = version.UploadHash;
 | 
					        _currentVersion = version.UploadHash;
 | 
				
			||||||
 | 
					        WriteAppSettings();
 | 
				
			||||||
        Registry.SaveVersion(_appData.PackageName, version.UploadHash);
 | 
					        Registry.SaveVersion(_appData.PackageName, version.UploadHash);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // need to patch the executable
 | 
					        // need to patch the executable
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user