bloxstrap/Bloxstrap/Helpers/RSMM/FileManifest.cs
pizzaboxer 92b159d682 Updates and bugfixes for v1.3.0
- Features
    - Added integration with rbxfpsunlocker
    - Added support for user-applicable mods
    - Added ability to disable auto-update checking

 - Misc
    - Removed Bloxstrap branding from Discord Rich Presence
    - Mod presets for old death sound and mouse cursor are now statically stored as base64 strings, eliminating reliance on the website and the old cursors still existing

 - Bugfixes
    - Fixed vista bootstrapper style not hiding properly and improper behavior when closed
    - Fixed forms not being brought to the front when shown

 - Code
    - Reconsolidated Bootstrapper to a single file, using regions instead of partials
2022-08-21 22:41:16 +01:00

65 lines
1.9 KiB
C#

// https://github.com/MaximumADHD/Roblox-Studio-Mod-Manager/blob/main/ProjectSrc/Bootstrapper/FileManifest.cs
using System.IO;
using System.Net.Http;
using System.Runtime.Serialization;
namespace Bloxstrap.Helpers.RSMM
{
[Serializable]
internal class FileManifest : Dictionary<string, string>
{
public string RawData { get; set; }
protected FileManifest(SerializationInfo info, StreamingContext context)
: base(info, context) { }
private FileManifest(string data, bool remapExtraContent = false)
{
using (var reader = new StringReader(data))
{
bool eof = false;
var readLine = new Func<string>(() =>
{
string line = reader.ReadLine();
if (line == null)
eof = true;
return line;
});
while (!eof)
{
string path = readLine();
string signature = readLine();
if (eof)
break;
else if (remapExtraContent && path.StartsWith("ExtraContent", Program.StringFormat))
path = path.Replace("ExtraContent", "content");
Add(path, signature);
}
}
RawData = data;
}
public static async Task<FileManifest> Get(string versionGuid, bool remapExtraContent = false)
{
string fileManifestUrl = $"{Program.BaseUrlSetup}/{versionGuid}-rbxManifest.txt";
string fileManifestData;
using (HttpClient http = new())
{
var download = http.GetStringAsync(fileManifestUrl);
fileManifestData = await download.ConfigureAwait(false);
}
return new FileManifest(fileManifestData, remapExtraContent);
}
}
}