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.

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