embed plugin loader directly into the launcher
This commit is contained in:
43
PluginLoader/Data/WorkshopPlugin.cs
Normal file
43
PluginLoader/Data/WorkshopPlugin.cs
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user