embed plugin loader directly into the launcher

This commit is contained in:
zznty
2022-10-29 01:50:14 +07:00
parent 7204815c0c
commit 66d3dc2ead
53 changed files with 5689 additions and 10 deletions

View File

@@ -0,0 +1,43 @@
using ProtoBuf;
using VRage;
namespace PluginLoader.Data;
[ProtoContract]
public class WorkshopPlugin : SteamPlugin
{
private string assembly;
protected WorkshopPlugin()
{
}
public override string Source => MyTexts.GetString(MyCommonTexts.Workshop);
protected override string HashFile => "hash.txt";
protected override void CheckForUpdates()
{
assembly = Path.Combine(root, Path.GetFileNameWithoutExtension(sourceFile) + ".dll");
var found = false;
foreach (var dll in Directory.EnumerateFiles(root, "*.dll"))
if (dll == assembly)
found = true;
else
File.Delete(dll);
if (!found)
Status = PluginStatus.PendingUpdate;
else
base.CheckForUpdates();
}
protected override void ApplyUpdate()
{
File.Copy(sourceFile, assembly, true);
}
protected override string GetAssemblyFile()
{
return assembly;
}
}