public void Install(MmcMinecraftInstance instance, string version) { instance.PackFile.Load(); MmcPackFile.Component modloaderComponent = instance.PackFile.Components.FirstOrDefault( c => c.Uid == Identificator ); if (modloaderComponent == null) { InstallModloader(instance, version); } else { // Update modloader version // modloaderComponent.CachedVersion = version; modloaderComponent.Version = version; } // Create or update version entry in instance.cfg file // ReSharper disable once InvertIf if (!string.IsNullOrEmpty(VersionConfigProperty)) { MmcConfigFile config = instance.MmcConfig; config.GetType().GetProperty(VersionConfigProperty)?.SetValue(config, version); } }
public void Uninstall(MmcMinecraftInstance instance) { // Remove config component from mmc-pack.jsonfile if (instance.PackFile.Exists) { UninstallModloader(instance); } // Remove entry from Packsly config file MmcConfigFile config = instance.MmcConfig; config.GetType().GetProperty(VersionConfigProperty)?.SetValue(config, string.Empty); }