You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

709 lines
27 KiB

  1. using IPA.Config;
  2. using IPA.Loader.Features;
  3. using IPA.Logging;
  4. using IPA.Utilities;
  5. using Mono.Cecil;
  6. using Newtonsoft.Json;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Reflection;
  12. using System.Text.RegularExpressions;
  13. using System.Threading.Tasks;
  14. using Version = SemVer.Version;
  15. #if NET3
  16. using Net3_Proxy;
  17. using Path = Net3_Proxy.Path;
  18. using File = Net3_Proxy.File;
  19. using Directory = Net3_Proxy.Directory;
  20. #endif
  21. namespace IPA.Loader
  22. {
  23. /// <summary>
  24. /// A type to manage the loading of plugins.
  25. /// </summary>
  26. public class PluginLoader
  27. {
  28. internal static Task LoadTask() => Task.Factory.StartNew(() =>
  29. {
  30. YeetIfNeeded();
  31. LoadMetadata();
  32. Resolve();
  33. ComputeLoadOrder();
  34. FilterDisabled();
  35. ResolveDependencies();
  36. });
  37. /// <summary>
  38. /// A class which describes a loaded plugin.
  39. /// </summary>
  40. public class PluginMetadata
  41. {
  42. /// <summary>
  43. /// The assembly the plugin was loaded from.
  44. /// </summary>
  45. /// <value>the loaded Assembly that contains the plugin main type</value>
  46. public Assembly Assembly { get; internal set; }
  47. /// <summary>
  48. /// The TypeDefinition for the main type of the plugin.
  49. /// </summary>
  50. /// <value>the Cecil definition for the plugin main type</value>
  51. public TypeDefinition PluginType { get; internal set; }
  52. /// <summary>
  53. /// The human readable name of the plugin.
  54. /// </summary>
  55. /// <value>the name of the plugin</value>
  56. public string Name { get; internal set; }
  57. /// <summary>
  58. /// The BeatMods ID of the plugin, or null if it doesn't have one.
  59. /// </summary>
  60. /// <value>the updater ID of the plugin</value>
  61. public string Id { get; internal set; }
  62. /// <summary>
  63. /// The version of the plugin.
  64. /// </summary>
  65. /// <value>the version of the plugin</value>
  66. public Version Version { get; internal set; }
  67. /// <summary>
  68. /// The file the plugin was loaded from.
  69. /// </summary>
  70. /// <value>the file the plugin was loaded from</value>
  71. public FileInfo File { get; internal set; }
  72. // ReSharper disable once UnusedAutoPropertyAccessor.Global
  73. /// <summary>
  74. /// The features this plugin requests.
  75. /// </summary>
  76. /// <value>the list of features requested by the plugin</value>
  77. public IReadOnlyList<Feature> Features => InternalFeatures;
  78. internal readonly List<Feature> InternalFeatures = new List<Feature>();
  79. internal bool IsSelf;
  80. /// <summary>
  81. /// Whether or not this metadata object represents a bare manifest.
  82. /// </summary>
  83. /// <value><see langword="true"/> if it is bare, <see langword="false"/> otherwise</value>
  84. public bool IsBare { get; internal set; }
  85. private PluginManifest manifest;
  86. internal HashSet<PluginMetadata> Dependencies { get; } = new HashSet<PluginMetadata>();
  87. internal PluginManifest Manifest
  88. {
  89. get => manifest;
  90. set
  91. {
  92. manifest = value;
  93. Name = value.Name;
  94. Version = value.Version;
  95. Id = value.Id;
  96. }
  97. }
  98. /// <summary>
  99. /// Gets all of the metadata as a readable string.
  100. /// </summary>
  101. /// <returns>the readable printable metadata string</returns>
  102. public override string ToString() => $"{Name}({Id}@{Version})({PluginType?.FullName}) from '{Utils.GetRelativePath(File?.FullName, BeatSaber.InstallPath)}'";
  103. }
  104. /// <summary>
  105. /// A container object for all the data relating to a plugin.
  106. /// </summary>
  107. public class PluginInfo
  108. {
  109. internal IPlugin Plugin { get; set; }
  110. /// <summary>
  111. /// Metadata for the plugin.
  112. /// </summary>
  113. /// <value>the metadata for this plugin</value>
  114. public PluginMetadata Metadata { get; internal set; } = new PluginMetadata();
  115. }
  116. internal static void YeetIfNeeded()
  117. {
  118. string pluginDir = BeatSaber.PluginsPath;
  119. var gameVer = BeatSaber.GameVersion;
  120. var lastVerS = SelfConfig.LastGameVersion_;
  121. var lastVer = lastVerS != null ? new AlmostVersion(lastVerS, gameVer) : null;
  122. if (SelfConfig.YeetMods_ && lastVer != null && gameVer != lastVer)
  123. {
  124. var oldPluginsName = Path.Combine(BeatSaber.InstallPath, $"Old {lastVer} Plugins");
  125. var newPluginsName = Path.Combine(BeatSaber.InstallPath, $"Old {gameVer} Plugins");
  126. if (Directory.Exists(oldPluginsName))
  127. Directory.Delete(oldPluginsName, true);
  128. Directory.Move(pluginDir, oldPluginsName);
  129. if (Directory.Exists(newPluginsName))
  130. Directory.Move(newPluginsName, pluginDir);
  131. else
  132. Directory.CreateDirectory(pluginDir);
  133. }
  134. SelfConfig.Instance.LastGameVersion = gameVer.ToString();
  135. }
  136. internal static List<PluginMetadata> PluginsMetadata = new List<PluginMetadata>();
  137. internal static List<PluginMetadata> DisabledPlugins = new List<PluginMetadata>();
  138. private static readonly Regex embeddedTextDescriptionPattern = new Regex(@"#!\[(.+)\]", RegexOptions.Compiled | RegexOptions.Singleline);
  139. internal static void LoadMetadata()
  140. {
  141. string[] plugins = Directory.GetFiles(BeatSaber.PluginsPath, "*.dll");
  142. try
  143. {
  144. var selfMeta = new PluginMetadata
  145. {
  146. Assembly = Assembly.GetExecutingAssembly(),
  147. File = new FileInfo(Path.Combine(BeatSaber.InstallPath, "IPA.exe")),
  148. PluginType = null,
  149. IsSelf = true
  150. };
  151. string manifest;
  152. using (var manifestReader =
  153. new StreamReader(
  154. selfMeta.Assembly.GetManifestResourceStream(typeof(PluginLoader), "manifest.json") ??
  155. throw new InvalidOperationException()))
  156. manifest = manifestReader.ReadToEnd();
  157. selfMeta.Manifest = JsonConvert.DeserializeObject<PluginManifest>(manifest);
  158. PluginsMetadata.Add(selfMeta);
  159. }
  160. catch (Exception e)
  161. {
  162. Logger.loader.Critical("Error loading own manifest");
  163. Logger.loader.Critical(e);
  164. }
  165. foreach (var plugin in plugins)
  166. {
  167. var metadata = new PluginMetadata
  168. {
  169. File = new FileInfo(Path.Combine(BeatSaber.PluginsPath, plugin)),
  170. IsSelf = false
  171. };
  172. try
  173. {
  174. var pluginModule = AssemblyDefinition.ReadAssembly(plugin, new ReaderParameters
  175. {
  176. ReadingMode = ReadingMode.Immediate,
  177. ReadWrite = false,
  178. AssemblyResolver = new CecilLibLoader()
  179. }).MainModule;
  180. string pluginNs = "";
  181. foreach (var resource in pluginModule.Resources)
  182. {
  183. const string manifestSuffix = ".manifest.json";
  184. if (!(resource is EmbeddedResource embedded) ||
  185. !embedded.Name.EndsWith(manifestSuffix)) continue;
  186. pluginNs = embedded.Name.Substring(0, embedded.Name.Length - manifestSuffix.Length);
  187. string manifest;
  188. using (var manifestReader = new StreamReader(embedded.GetResourceStream()))
  189. manifest = manifestReader.ReadToEnd();
  190. metadata.Manifest = JsonConvert.DeserializeObject<PluginManifest>(manifest);
  191. break;
  192. }
  193. if (metadata.Manifest == null)
  194. {
  195. #if DIRE_LOADER_WARNINGS
  196. Logger.loader.Error($"Could not find manifest.json for {Path.GetFileName(plugin)}");
  197. #else
  198. Logger.loader.Notice($"No manifest.json in {Path.GetFileName(plugin)}");
  199. #endif
  200. continue;
  201. }
  202. foreach (var type in pluginModule.Types)
  203. {
  204. if (type.Namespace != pluginNs) continue;
  205. // TODO: change this to just IPlugin
  206. if (type.HasInterface(typeof(IPlugin).FullName))
  207. {
  208. metadata.PluginType = type;
  209. break;
  210. }
  211. }
  212. if (metadata.PluginType == null)
  213. {
  214. Logger.loader.Error($"No plugin found in the manifest namespace ({pluginNs}) in {Path.GetFileName(plugin)}");
  215. continue;
  216. }
  217. Logger.loader.Debug($"Adding info for {Path.GetFileName(plugin)}");
  218. PluginsMetadata.Add(metadata);
  219. }
  220. catch (Exception e)
  221. {
  222. Logger.loader.Error($"Could not load data for plugin {Path.GetFileName(plugin)}");
  223. Logger.loader.Error(e);
  224. ignoredPlugins.Add(metadata);
  225. }
  226. }
  227. IEnumerable<string> bareManifests = Directory.GetFiles(BeatSaber.PluginsPath, "*.json");
  228. bareManifests = bareManifests.Concat(Directory.GetFiles(BeatSaber.PluginsPath, "*.manifest"));
  229. foreach (var manifest in bareManifests)
  230. {
  231. try
  232. {
  233. var metadata = new PluginMetadata
  234. {
  235. File = new FileInfo(Path.Combine(BeatSaber.PluginsPath, manifest)),
  236. IsSelf = false,
  237. IsBare = true,
  238. };
  239. metadata.Manifest = JsonConvert.DeserializeObject<PluginManifest>(File.ReadAllText(manifest));
  240. Logger.loader.Debug($"Adding info for bare manifest {Path.GetFileName(manifest)}");
  241. PluginsMetadata.Add(metadata);
  242. }
  243. catch (Exception e)
  244. {
  245. Logger.loader.Error($"Could not load data for bare manifest {Path.GetFileName(manifest)}");
  246. Logger.loader.Error(e);
  247. }
  248. }
  249. foreach (var meta in PluginsMetadata)
  250. { // process description include
  251. var lines = meta.Manifest.Description.Split('\n');
  252. var m = embeddedTextDescriptionPattern.Match(lines[0]);
  253. if (m.Success)
  254. {
  255. if (meta.IsBare)
  256. {
  257. Logger.loader.Warn($"Bare manifest cannot specify description file");
  258. meta.Manifest.Description = string.Join("\n", lines.Skip(1).StrJP()); // ignore first line
  259. continue;
  260. }
  261. var name = m.Groups[1].Value;
  262. string description;
  263. if (!meta.IsSelf)
  264. {
  265. var resc = meta.PluginType.Module.Resources.Select(r => r as EmbeddedResource)
  266. .NonNull()
  267. .FirstOrDefault(r => r.Name == name);
  268. if (resc == null)
  269. {
  270. Logger.loader.Warn($"Could not find description file for plugin {meta.Name} ({name}); ignoring include");
  271. meta.Manifest.Description = string.Join("\n", lines.Skip(1).StrJP()); // ignore first line
  272. continue;
  273. }
  274. using (var reader = new StreamReader(resc.GetResourceStream()))
  275. description = reader.ReadToEnd();
  276. }
  277. else
  278. {
  279. using (var descriptionReader =
  280. new StreamReader(
  281. meta.Assembly.GetManifestResourceStream(name) ??
  282. throw new InvalidOperationException()))
  283. description = descriptionReader.ReadToEnd();
  284. }
  285. meta.Manifest.Description = description;
  286. }
  287. }
  288. }
  289. // keep track of these for the updater; it should still be able to update mods not loaded
  290. // TODO: add ignore reason
  291. internal static HashSet<PluginMetadata> ignoredPlugins = new HashSet<PluginMetadata>();
  292. internal static void Resolve()
  293. { // resolves duplicates and conflicts, etc
  294. PluginsMetadata.Sort((a, b) => b.Version.CompareTo(a.Version));
  295. var ids = new HashSet<string>();
  296. var ignore = new HashSet<PluginMetadata>();
  297. var resolved = new List<PluginMetadata>(PluginsMetadata.Count);
  298. foreach (var meta in PluginsMetadata)
  299. {
  300. if (meta.Id != null)
  301. {
  302. if (ids.Contains(meta.Id))
  303. {
  304. Logger.loader.Warn($"Found duplicates of {meta.Id}, using newest");
  305. ignore.Add(meta);
  306. ignoredPlugins.Add(meta);
  307. continue; // because of sorted order, hightest order will always be the first one
  308. }
  309. bool processedLater = false;
  310. foreach (var meta2 in PluginsMetadata)
  311. {
  312. if (ignore.Contains(meta2)) continue;
  313. if (meta == meta2)
  314. {
  315. processedLater = true;
  316. continue;
  317. }
  318. if (!meta2.Manifest.Conflicts.ContainsKey(meta.Id)) continue;
  319. var range = meta2.Manifest.Conflicts[meta.Id];
  320. if (!range.IsSatisfied(meta.Version)) continue;
  321. Logger.loader.Warn($"{meta.Id}@{meta.Version} conflicts with {meta2.Name}");
  322. if (processedLater)
  323. {
  324. Logger.loader.Warn($"Ignoring {meta2.Name}");
  325. ignore.Add(meta2);
  326. }
  327. else
  328. {
  329. Logger.loader.Warn($"Ignoring {meta.Name}");
  330. ignore.Add(meta);
  331. break;
  332. }
  333. }
  334. }
  335. if (ignore.Contains(meta))
  336. {
  337. ignoredPlugins.Add(meta);
  338. continue;
  339. }
  340. if (meta.Id != null)
  341. ids.Add(meta.Id);
  342. resolved.Add(meta);
  343. }
  344. PluginsMetadata = resolved;
  345. }
  346. private static void FilterDisabled()
  347. {
  348. var enabled = new List<PluginMetadata>(PluginsMetadata.Count);
  349. var disabled = DisabledConfig.Instance.DisabledModIds;
  350. foreach (var meta in PluginsMetadata)
  351. {
  352. if (disabled.Contains(meta.Id ?? meta.Name))
  353. DisabledPlugins.Add(meta);
  354. else
  355. enabled.Add(meta);
  356. }
  357. PluginsMetadata = enabled;
  358. }
  359. internal static void ComputeLoadOrder()
  360. {
  361. #if DEBUG
  362. Logger.loader.Debug(string.Join(", ", PluginsMetadata.Select(p => p.ToString()).StrJP()));
  363. #endif
  364. bool InsertInto(HashSet<PluginMetadata> root, PluginMetadata meta, bool isRoot = false)
  365. { // this is slow, and hella recursive
  366. bool inserted = false;
  367. foreach (var sr in root)
  368. {
  369. inserted = inserted || InsertInto(sr.Dependencies, meta);
  370. if (meta.Id != null)
  371. if (sr.Manifest.Dependencies.ContainsKey(meta.Id) || sr.Manifest.LoadAfter.Contains(meta.Id))
  372. inserted = inserted || sr.Dependencies.Add(meta);
  373. if (sr.Id != null)
  374. if (meta.Manifest.LoadBefore.Contains(sr.Id))
  375. inserted = inserted || sr.Dependencies.Add(meta);
  376. }
  377. if (isRoot)
  378. {
  379. foreach (var sr in root)
  380. {
  381. InsertInto(meta.Dependencies, sr);
  382. if (sr.Id != null)
  383. if (meta.Manifest.Dependencies.ContainsKey(sr.Id) || meta.Manifest.LoadAfter.Contains(sr.Id))
  384. meta.Dependencies.Add(sr);
  385. if (meta.Id != null)
  386. if (sr.Manifest.LoadBefore.Contains(meta.Id))
  387. meta.Dependencies.Add(sr);
  388. }
  389. root.Add(meta);
  390. }
  391. return inserted;
  392. }
  393. var pluginTree = new HashSet<PluginMetadata>();
  394. foreach (var meta in PluginsMetadata)
  395. InsertInto(pluginTree, meta, true);
  396. void DeTree(List<PluginMetadata> into, HashSet<PluginMetadata> tree)
  397. {
  398. foreach (var st in tree)
  399. if (!into.Contains(st))
  400. {
  401. DeTree(into, st.Dependencies);
  402. into.Add(st);
  403. }
  404. }
  405. PluginsMetadata = new List<PluginMetadata>();
  406. DeTree(PluginsMetadata, pluginTree);
  407. #if DEBUG
  408. Logger.loader.Debug(string.Join(", ", PluginsMetadata.Select(p => p.ToString()).StrJP()));
  409. #endif
  410. }
  411. internal static void ResolveDependencies()
  412. {
  413. var metadata = new List<PluginMetadata>();
  414. var pluginsToLoad = new Dictionary<string, Version>();
  415. var disabledLookup = DisabledPlugins.NonNull(m => m.Id).ToDictionary(m => m.Id, m => m.Version);
  416. foreach (var meta in PluginsMetadata)
  417. {
  418. bool load = true;
  419. bool disable = false;
  420. foreach (var dep in meta.Manifest.Dependencies)
  421. {
  422. #if DEBUG
  423. Logger.loader.Debug($"Looking for dependency {dep.Key} with version range {dep.Value.Intersect(new SemVer.Range("*.*.*"))}");
  424. #endif
  425. if (pluginsToLoad.ContainsKey(dep.Key) && dep.Value.IsSatisfied(pluginsToLoad[dep.Key]))
  426. continue;
  427. load = false;
  428. if (disabledLookup.ContainsKey(dep.Key) && dep.Value.IsSatisfied(disabledLookup[dep.Key]))
  429. {
  430. disable = true;
  431. Logger.loader.Warn($"Dependency {dep.Key} was found, but disabled. Disabling {meta.Name} too.");
  432. }
  433. else
  434. Logger.loader.Warn($"{meta.Name} is missing dependency {dep.Key}@{dep.Value}");
  435. break;
  436. }
  437. if (load)
  438. {
  439. metadata.Add(meta);
  440. if (meta.Id != null)
  441. pluginsToLoad.Add(meta.Id, meta.Version);
  442. }
  443. else if (disable)
  444. {
  445. DisabledPlugins.Add(meta);
  446. DisabledConfig.Instance.DisabledModIds.Add(meta.Id ?? meta.Name);
  447. }
  448. else
  449. ignoredPlugins.Add(meta);
  450. }
  451. PluginsMetadata = metadata;
  452. }
  453. internal static void InitFeatures()
  454. {
  455. var parsedFeatures = PluginsMetadata.Select(m =>
  456. (metadata: m,
  457. features: m.Manifest.Features.Select(feature =>
  458. (feature, parsed: Ref.Create<Feature.FeatureParse?>(null))
  459. ).ToList()
  460. )
  461. ).ToList();
  462. while (DefineFeature.NewFeature)
  463. {
  464. DefineFeature.NewFeature = false;
  465. foreach (var (metadata, features) in parsedFeatures)
  466. for (var i = 0; i < features.Count; i++)
  467. {
  468. var feature = features[i];
  469. var success = Feature.TryParseFeature(feature.feature, metadata, out var featureObj,
  470. out var exception, out var valid, out var parsed, feature.parsed.Value);
  471. if (!success && !valid && featureObj == null && exception == null) // no feature of type found
  472. feature.parsed.Value = parsed;
  473. else if (success)
  474. {
  475. if (valid && featureObj.StoreOnPlugin)
  476. metadata.InternalFeatures.Add(featureObj);
  477. else if (!valid)
  478. Logger.features.Warn(
  479. $"Feature not valid on {metadata.Name}: {featureObj.InvalidMessage}");
  480. features.RemoveAt(i--);
  481. }
  482. else
  483. {
  484. Logger.features.Error($"Error parsing feature definition on {metadata.Name}");
  485. Logger.features.Error(exception);
  486. features.RemoveAt(i--);
  487. }
  488. }
  489. foreach (var plugin in PluginsMetadata)
  490. foreach (var feature in plugin.Features)
  491. feature.Evaluate();
  492. }
  493. foreach (var plugin in parsedFeatures)
  494. {
  495. if (plugin.features.Count <= 0) continue;
  496. Logger.features.Warn($"On plugin {plugin.metadata.Name}:");
  497. foreach (var feature in plugin.features)
  498. Logger.features.Warn($" Feature not found with name {feature.feature}");
  499. }
  500. }
  501. internal static void ReleaseAll(bool full = false)
  502. {
  503. if (full)
  504. ignoredPlugins = new HashSet<PluginMetadata>();
  505. else
  506. {
  507. foreach (var m in PluginsMetadata)
  508. ignoredPlugins.Add(m);
  509. foreach (var m in ignoredPlugins)
  510. { // clean them up so we can still use the metadata for updates
  511. m.InternalFeatures.Clear();
  512. m.PluginType = null;
  513. m.Assembly = null;
  514. }
  515. }
  516. PluginsMetadata = new List<PluginMetadata>();
  517. DisabledPlugins = new List<PluginMetadata>();
  518. Feature.Reset();
  519. GC.Collect();
  520. }
  521. internal static void Load(PluginMetadata meta)
  522. {
  523. if (meta.Assembly == null && meta.PluginType != null)
  524. meta.Assembly = Assembly.LoadFrom(meta.File.FullName);
  525. }
  526. internal static PluginInfo InitPlugin(PluginMetadata meta)
  527. {
  528. if (meta.PluginType == null)
  529. return new PluginInfo()
  530. {
  531. Metadata = meta,
  532. Plugin = null
  533. };
  534. var info = new PluginInfo();
  535. if (meta.Manifest.GameVersion != BeatSaber.GameVersion)
  536. Logger.loader.Warn($"Mod {meta.Name} developed for game version {meta.Manifest.GameVersion}, so it may not work properly.");
  537. try
  538. { // TODO: add dependency checking for when features prevent loading
  539. Load(meta);
  540. Feature denyingFeature = null;
  541. if (!meta.Features.All(f => (denyingFeature = f).BeforeLoad(meta)))
  542. {
  543. Logger.loader.Warn(
  544. $"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from loading! {denyingFeature?.InvalidMessage}");
  545. ignoredPlugins.Add(meta);
  546. return null;
  547. }
  548. var type = meta.Assembly.GetType(meta.PluginType.FullName);
  549. var instance = Activator.CreateInstance(type) as IPlugin;
  550. info.Metadata = meta;
  551. info.Plugin = instance;
  552. var init = type.GetMethod("Init", BindingFlags.Instance | BindingFlags.Public);
  553. if (init != null)
  554. {
  555. denyingFeature = null;
  556. if (!meta.Features.All(f => (denyingFeature = f).BeforeInit(info)))
  557. {
  558. Logger.loader.Warn(
  559. $"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from initializing! {denyingFeature?.InvalidMessage}");
  560. ignoredPlugins.Add(meta);
  561. return null;
  562. }
  563. PluginInitInjector.Inject(init, info);
  564. }
  565. foreach (var feature in meta.Features)
  566. try
  567. {
  568. feature.AfterInit(info, info.Plugin);
  569. }
  570. catch (Exception e)
  571. {
  572. Logger.loader.Critical($"Feature errored in {nameof(Feature.AfterInit)}: {e}");
  573. }
  574. try // TODO: move this out to after all plugins have been inited
  575. {
  576. instance.OnEnable();
  577. }
  578. catch (Exception e)
  579. {
  580. Logger.loader.Error($"Error occurred trying to enable {meta.Name}");
  581. Logger.loader.Error(e);
  582. return null; // is enable failure a full load failure?
  583. }
  584. }
  585. catch (AmbiguousMatchException)
  586. {
  587. Logger.loader.Error($"Only one Init allowed per plugin (ambiguous match in {meta.Name})");
  588. // not adding to ignoredPlugins here because this should only happen in a development context
  589. // if someone fucks this up on release thats on them
  590. return null;
  591. }
  592. catch (Exception e)
  593. {
  594. Logger.loader.Error($"Could not init plugin {meta.Name}: {e}");
  595. ignoredPlugins.Add(meta);
  596. return null;
  597. }
  598. return info;
  599. }
  600. internal static List<PluginInfo> LoadPlugins()
  601. {
  602. InitFeatures();
  603. DisabledPlugins.ForEach(Load); // make sure they get loaded into memory so their metadata and stuff can be read more easily
  604. return PluginsMetadata.Select(InitPlugin).NonNull().ToList();
  605. }
  606. }
  607. }