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; } }