internal IEnumerator CheckForUpdatesCoroutine(CheckUpdatesComplete onComplete) { var depList = new Ref <List <DependencyObject> >(new List <DependencyObject>()); foreach (var plugin in BSMetas) //.Where(m => m.Metadata.Features.FirstOrDefault(f => f is NoUpdateFeature) == null)) { // initialize with data to resolve (1.1) if (plugin.Metadata.Id != null) { // updatable var msinfo = plugin.Metadata; var dep = new DependencyObject { Name = msinfo.Id, Version = msinfo.Version, Requirement = new Range($">={msinfo.Version}"), LocalPluginMeta = plugin }; if (msinfo.Features.FirstOrDefault(f => f is NoUpdateFeature) != null) { // disable updating, by only matching self, so that dependencies can still be resolved dep.Requirement = new Range(msinfo.Version.ToString()); } depList.Value.Add(dep); } } foreach (var meta in PluginLoader.ignoredPlugins.Where(m => m.Id != null)) //.Where(m => m.Features.FirstOrDefault(f => f is NoUpdateFeature) == null)) { if (meta.Id != null) { // updatable var dep = new DependencyObject { Name = meta.Id, Version = meta.Version, Requirement = new Range($">={meta.Version}"), LocalPluginMeta = new PluginLoader.PluginInfo { Metadata = meta, Plugin = null } }; if (meta.Features.FirstOrDefault(f => f is NoUpdateFeature) != null) { // disable updating, by only matching self dep.Requirement = new Range(meta.Version.ToString()); } depList.Value.Add(dep); } } foreach (var dep in depList.Value) { Logger.updater.Debug($"Phantom Dependency: {dep}"); } yield return(ResolveDependencyRanges(depList)); foreach (var dep in depList.Value) { Logger.updater.Debug($"Dependency: {dep}"); } yield return(ResolveDependencyPresence(depList)); foreach (var dep in depList.Value) { Logger.updater.Debug($"Dependency: {dep}"); } CheckDependencies(depList); onComplete?.Invoke(depList); if (!ModListPresent && SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate) { StartDownload(depList.Value); } }
public void CheckForUpdates(CheckUpdatesComplete onComplete = null) => StartCoroutine(CheckForUpdatesCoroutine(onComplete));
internal IEnumerator CheckForUpdatesCoroutine(CheckUpdatesComplete onComplete) { var depList = new Ref <List <DependencyObject> >(new List <DependencyObject>()); foreach (var plugin in BSMetas) { // initialize with data to resolve (1.1) if (plugin.Metadata.Id != null) { // updatable var msinfo = plugin.Metadata; var dep = new DependencyObject { Name = msinfo.Id, Version = msinfo.Version, Requirement = new Range($">={msinfo.Version}"), LocalPluginMeta = plugin }; if (msinfo.Features.FirstOrDefault(f => f is NoUpdateFeature) != null) { // disable updating, by only matching self, so that dependencies can still be resolved dep.Requirement = new Range(msinfo.Version.ToString()); } depList.Value.Add(dep); } } foreach (var meta in PluginLoader.ignoredPlugins.Where(m => m.Id != null)) { if (meta.Id != null) { // updatable var dep = new DependencyObject { Name = meta.Id, Version = meta.Version, Requirement = new Range($">={meta.Version}"), LocalPluginMeta = new PluginLoader.PluginInfo { Metadata = meta, Plugin = null } }; if (meta.Features.FirstOrDefault(f => f is NoUpdateFeature) != null) { // disable updating, by only matching self dep.Requirement = new Range(meta.Version.ToString()); } depList.Value.Add(dep); } } #pragma warning disable CS0618 // Type or member is obsolete foreach (var plug in Plugins) { // throw these in the updater on the off chance that they are set up properly try { var dep = new DependencyObject { Name = plug.Name, Version = new Version(plug.Version), Requirement = new Range($">={plug.Version}"), IsLegacy = true, LocalPluginMeta = null }; depList.Value.Add(dep); } catch (Exception e) { Logger.updater.Warn($"Error trying to add legacy plugin {plug.Name} to updater"); Logger.updater.Warn(e); } } #pragma warning restore CS0618 // Type or member is obsolete foreach (var dep in depList.Value) { Logger.updater.Debug($"Phantom Dependency: {dep}"); } yield return(ResolveDependencyRanges(depList)); foreach (var dep in depList.Value) { Logger.updater.Debug($"Dependency: {dep}"); } yield return(ResolveDependencyPresence(depList)); foreach (var dep in depList.Value) { Logger.updater.Debug($"Dependency: {dep}"); } CheckDependencies(depList); onComplete?.Invoke(depList); if (!ModListPresent && SelfConfig.SelfConfigRef.Value.Updates.AutoUpdate) { StartDownload(depList.Value); } }