SimpleInventoryStoragePlugin.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Reflection;
  29. using System.Collections.Generic;
  30. using System.IO;
  31. using System.Text;
  32. using OpenMetaverse;
  33. using OpenSim.Framework;
  34. using log4net;
  35. namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
  36. {
  37. public class SimpleInventoryStoragePlugin : IInventoryStorageProvider
  38. {
  39. const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting
  40. const string DEFAULT_INVENTORY_DIR = "SimpleInventory";
  41. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  42. AssetInventoryServer server;
  43. Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>();
  44. Dictionary<Uri, List<InventoryItemBase>> activeGestures = new Dictionary<Uri, List<InventoryItemBase>>();
  45. Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
  46. Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
  47. public SimpleInventoryStoragePlugin()
  48. {
  49. }
  50. #region Required Interfaces
  51. public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item)
  52. {
  53. item = null;
  54. BackendResponse ret;
  55. InventoryCollection collection;
  56. if (inventories.TryGetValue(owner, out collection) && collection.Items.TryGetValue(itemID, out item))
  57. ret = BackendResponse.Success;
  58. else
  59. ret = BackendResponse.NotFound;
  60. server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
  61. return ret;
  62. }
  63. public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
  64. {
  65. folder = null;
  66. BackendResponse ret;
  67. InventoryCollection collection;
  68. if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
  69. ret = BackendResponse.Success;
  70. else
  71. ret = BackendResponse.NotFound;
  72. server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
  73. return ret;
  74. }
  75. public BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents)
  76. {
  77. contents = null;
  78. BackendResponse ret;
  79. InventoryCollection collection;
  80. InventoryFolderWithChildren folder;
  81. if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
  82. {
  83. contents = new InventoryCollection();
  84. contents.UserID = collection.UserID;
  85. contents.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
  86. contents.Items = new Dictionary<UUID, InventoryItemBase>();
  87. foreach (InventoryNodeBase invBase in folder.Children.Values)
  88. {
  89. if (invBase is InventoryItemBase)
  90. {
  91. InventoryItemBase invItem = invBase as InventoryItemBase;
  92. contents.Items.Add(invItem.ID, invItem);
  93. }
  94. else
  95. {
  96. InventoryFolderWithChildren invFolder = invBase as InventoryFolderWithChildren;
  97. contents.Folders.Add(invFolder.ID, invFolder);
  98. }
  99. }
  100. ret = BackendResponse.Success;
  101. }
  102. else
  103. {
  104. ret = BackendResponse.NotFound;
  105. }
  106. server.MetricsProvider.LogInventoryFetchFolderContents(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
  107. return ret;
  108. }
  109. public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
  110. {
  111. folders = null;
  112. BackendResponse ret;
  113. InventoryCollection collection;
  114. if (inventories.TryGetValue(owner, out collection))
  115. {
  116. folders = new List<InventoryFolderWithChildren>(collection.Folders.Values);
  117. return BackendResponse.Success;
  118. }
  119. else
  120. {
  121. ret = BackendResponse.NotFound;
  122. }
  123. server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
  124. return ret;
  125. }
  126. public BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory)
  127. {
  128. inventory = null;
  129. BackendResponse ret;
  130. if (inventories.TryGetValue(owner, out inventory))
  131. ret = BackendResponse.Success;
  132. else
  133. ret = BackendResponse.NotFound;
  134. server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
  135. return ret;
  136. }
  137. public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
  138. {
  139. gestures = null;
  140. BackendResponse ret;
  141. if (activeGestures.TryGetValue(owner, out gestures))
  142. ret = BackendResponse.Success;
  143. else
  144. ret = BackendResponse.NotFound;
  145. server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
  146. return ret;
  147. }
  148. public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
  149. {
  150. BackendResponse ret;
  151. InventoryCollection collection;
  152. if (inventories.TryGetValue(owner, out collection))
  153. {
  154. // Delete this item first if it already exists
  155. InventoryItemBase oldItem;
  156. if (collection.Items.TryGetValue(item.ID, out oldItem))
  157. TryDeleteItem(owner, item.ID);
  158. try
  159. {
  160. // Create the file
  161. SaveItem(item);
  162. // Add the item to the collection
  163. lock (collection) collection.Items[item.ID] = item;
  164. // Add the item to its parent folder
  165. InventoryFolderWithChildren parent;
  166. if (collection.Folders.TryGetValue(item.Folder, out parent))
  167. lock (parent.Children) parent.Children.Add(item.ID, item);
  168. // Add active gestures to our list
  169. if (item.InvType == (int)InventoryType.Gesture && item.Flags == 1)
  170. {
  171. lock (activeGestures)
  172. activeGestures[owner].Add(item);
  173. }
  174. ret = BackendResponse.Success;
  175. }
  176. catch (Exception ex)
  177. {
  178. m_log.Error("[SIMPLEINVENTORYSTORAGE]: " + ex.Message);
  179. ret = BackendResponse.Failure;
  180. }
  181. }
  182. else
  183. {
  184. return BackendResponse.NotFound;
  185. }
  186. server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
  187. return ret;
  188. }
  189. public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
  190. {
  191. BackendResponse ret;
  192. InventoryCollection collection;
  193. if (inventories.TryGetValue(owner, out collection))
  194. {
  195. // Delete this folder first if it already exists
  196. InventoryFolderWithChildren oldFolder;
  197. if (collection.Folders.TryGetValue(folder.ID, out oldFolder))
  198. TryDeleteFolder(owner, folder.ID);
  199. try
  200. {
  201. // Create the file
  202. SaveFolder(folder);
  203. // Add the folder to the collection
  204. lock (collection) collection.Folders[folder.ID] = folder;
  205. // Add the folder to its parent folder
  206. InventoryFolderWithChildren parent;
  207. if (collection.Folders.TryGetValue(folder.ParentID, out parent))
  208. lock (parent.Children) parent.Children.Add(folder.ID, folder);
  209. ret = BackendResponse.Success;
  210. }
  211. catch (Exception ex)
  212. {
  213. m_log.Error("[SIMPLEINVENTORYSTORAGE]: " + ex.Message);
  214. ret = BackendResponse.Failure;
  215. }
  216. }
  217. else
  218. {
  219. ret = BackendResponse.NotFound;
  220. }
  221. server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
  222. return ret;
  223. }
  224. public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
  225. {
  226. BackendResponse ret;
  227. lock (inventories)
  228. {
  229. if (!inventories.ContainsKey(owner))
  230. {
  231. InventoryCollection collection = new InventoryCollection();
  232. collection.UserID = rootFolder.Owner;
  233. collection.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
  234. collection.Folders.Add(rootFolder.ID, rootFolder);
  235. collection.Items = new Dictionary<UUID, InventoryItemBase>();
  236. inventories.Add(owner, collection);
  237. ret = BackendResponse.Success;
  238. }
  239. else
  240. {
  241. ret = BackendResponse.Failure;
  242. }
  243. }
  244. if (ret == BackendResponse.Success)
  245. {
  246. string path = Path.Combine(DEFAULT_INVENTORY_DIR, rootFolder.Owner.ToString());
  247. try
  248. {
  249. // Create the directory for this agent
  250. Directory.CreateDirectory(path);
  251. // Create an index.txt containing the UUID and URI for this agent
  252. string[] index = new string[] { rootFolder.Owner.ToString(), owner.ToString() };
  253. File.WriteAllLines(Path.Combine(path, "index.txt"), index);
  254. // Create the root folder file
  255. SaveFolder(rootFolder);
  256. }
  257. catch (Exception ex)
  258. {
  259. m_log.Error("[SIMPLEINVENTORYSTORAGE]: " + ex.Message);
  260. ret = BackendResponse.Failure;
  261. }
  262. }
  263. server.MetricsProvider.LogInventoryCreateInventory(EXTENSION_NAME, ret, DateTime.Now);
  264. return ret;
  265. }
  266. public BackendResponse TryDeleteItem(Uri owner, UUID itemID)
  267. {
  268. BackendResponse ret;
  269. InventoryCollection collection;
  270. InventoryItemBase item;
  271. if (inventories.TryGetValue(owner, out collection) && collection.Items.TryGetValue(itemID, out item))
  272. {
  273. // Remove the item from its parent folder
  274. InventoryFolderWithChildren parent;
  275. if (collection.Folders.TryGetValue(item.Folder, out parent))
  276. lock (parent.Children) parent.Children.Remove(itemID);
  277. // Remove the item from the collection
  278. lock (collection) collection.Items.Remove(itemID);
  279. // Remove from the active gestures list if applicable
  280. if (item.InvType == (int)InventoryType.Gesture)
  281. {
  282. lock (activeGestures)
  283. {
  284. for (int i = 0; i < activeGestures[owner].Count; i++)
  285. {
  286. if (activeGestures[owner][i].ID == itemID)
  287. {
  288. activeGestures[owner].RemoveAt(i);
  289. break;
  290. }
  291. }
  292. }
  293. }
  294. // Delete the file. We don't know exactly what the file name is,
  295. // so search for it
  296. string path = PathFromURI(owner);
  297. string[] matches = Directory.GetFiles(path, String.Format("*{0}.item", itemID), SearchOption.TopDirectoryOnly);
  298. foreach (string match in matches)
  299. {
  300. try { File.Delete(match); }
  301. catch (Exception ex) { m_log.ErrorFormat("[SIMPLEINVENTORYSTORAGE]: Failed to delete file {0}: {1}", match, ex.Message); }
  302. }
  303. ret = BackendResponse.Success;
  304. }
  305. else
  306. {
  307. ret = BackendResponse.NotFound;
  308. }
  309. server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
  310. return ret;
  311. }
  312. public BackendResponse TryDeleteFolder(Uri owner, UUID folderID)
  313. {
  314. BackendResponse ret;
  315. InventoryCollection collection;
  316. InventoryFolderWithChildren folder;
  317. if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
  318. {
  319. // Remove the folder from its parent folder
  320. InventoryFolderWithChildren parent;
  321. if (collection.Folders.TryGetValue(folder.ParentID, out parent))
  322. lock (parent.Children) parent.Children.Remove(folderID);
  323. // Remove the folder from the collection
  324. lock (collection) collection.Items.Remove(folderID);
  325. // Delete the folder file. We don't know exactly what the file name is,
  326. // so search for it
  327. string path = PathFromURI(owner);
  328. string[] matches = Directory.GetFiles(path, String.Format("*{0}.folder", folderID), SearchOption.TopDirectoryOnly);
  329. foreach (string match in matches)
  330. {
  331. try { File.Delete(match); }
  332. catch (Exception ex) { m_log.ErrorFormat("[SIMPLEINVENTORYSTORAGE]: Failed to delete folder file {0}: {1}", match, ex.Message); }
  333. }
  334. ret = BackendResponse.Success;
  335. }
  336. else
  337. {
  338. ret = BackendResponse.NotFound;
  339. }
  340. server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
  341. return ret;
  342. }
  343. public BackendResponse TryPurgeFolder(Uri owner, UUID folderID)
  344. {
  345. BackendResponse ret;
  346. InventoryCollection collection;
  347. InventoryFolderWithChildren folder;
  348. if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
  349. {
  350. // Delete all of the folder children
  351. foreach (InventoryNodeBase obj in new List<InventoryNodeBase>(folder.Children.Values))
  352. {
  353. if (obj is InventoryItemBase)
  354. {
  355. TryDeleteItem(owner, (obj as InventoryItemBase).ID);
  356. }
  357. else
  358. {
  359. InventoryFolderWithChildren childFolder = obj as InventoryFolderWithChildren;
  360. TryPurgeFolder(owner, childFolder.ID);
  361. TryDeleteFolder(owner, childFolder.ID);
  362. }
  363. }
  364. ret = BackendResponse.Success;
  365. }
  366. else
  367. {
  368. ret = BackendResponse.NotFound;
  369. }
  370. server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
  371. return ret;
  372. }
  373. #endregion Required Interfaces
  374. void SaveItem(InventoryItemBase item)
  375. {
  376. string filename = String.Format("{0}-{1}.item", SanitizeFilename(item.Name), item.ID);
  377. string path = Path.Combine(DEFAULT_INVENTORY_DIR, item.Owner.ToString());
  378. path = Path.Combine(path, filename);
  379. using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
  380. {
  381. itemSerializer.Serialize(stream, item);
  382. stream.Flush();
  383. }
  384. }
  385. void SaveFolder(InventoryFolderWithChildren folder)
  386. {
  387. string filename = String.Format("{0}-{1}.folder", SanitizeFilename(folder.Name), folder.ID);
  388. string path = Path.Combine(DEFAULT_INVENTORY_DIR, folder.Owner.ToString());
  389. path = Path.Combine(path, filename);
  390. using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
  391. {
  392. folderSerializer.Serialize(stream, folder);
  393. stream.Flush();
  394. }
  395. }
  396. string SanitizeFilename(string filename)
  397. {
  398. string output = filename;
  399. if (output.Length > 64)
  400. output = output.Substring(0, 64);
  401. foreach (char i in Path.GetInvalidFileNameChars())
  402. output = output.Replace(i, '_');
  403. return output;
  404. }
  405. static string PathFromURI(Uri uri)
  406. {
  407. byte[] hash = OpenMetaverse.Utils.SHA1(Encoding.UTF8.GetBytes(uri.ToString()));
  408. StringBuilder digest = new StringBuilder(40);
  409. // Convert the hash to a hex string
  410. foreach (byte b in hash)
  411. digest.AppendFormat(OpenMetaverse.Utils.EnUsCulture, "{0:x2}", b);
  412. return Path.Combine(DEFAULT_INVENTORY_DIR, digest.ToString());
  413. }
  414. void LoadFiles(string folder)
  415. {
  416. // Try to create the directory if it doesn't already exist
  417. if (!Directory.Exists(folder))
  418. {
  419. try { Directory.CreateDirectory(folder); }
  420. catch (Exception ex)
  421. {
  422. m_log.Warn("[SIMPLEINVENTORYSTORAGE]: " + ex.Message);
  423. return;
  424. }
  425. }
  426. try
  427. {
  428. string[] agentFolders = Directory.GetDirectories(DEFAULT_INVENTORY_DIR);
  429. for (int i = 0; i < agentFolders.Length; i++)
  430. {
  431. string foldername = agentFolders[i];
  432. string indexPath = Path.Combine(foldername, "index.txt");
  433. UUID ownerID = UUID.Zero;
  434. Uri owner = null;
  435. try
  436. {
  437. string[] index = File.ReadAllLines(indexPath);
  438. ownerID = UUID.Parse(index[0]);
  439. owner = new Uri(index[1]);
  440. }
  441. catch (Exception ex)
  442. {
  443. m_log.WarnFormat("[SIMPLEINVENTORYSTORAGE]: Failed loading the index file {0}: {1}", indexPath, ex.Message);
  444. }
  445. if (ownerID != UUID.Zero && owner != null)
  446. {
  447. // Initialize the active gestures list for this agent
  448. activeGestures.Add(owner, new List<InventoryItemBase>());
  449. InventoryCollection collection = new InventoryCollection();
  450. collection.UserID = ownerID;
  451. // Load all of the folders for this agent
  452. string[] folders = Directory.GetFiles(foldername, "*.folder", SearchOption.TopDirectoryOnly);
  453. collection.Folders = new Dictionary<UUID,InventoryFolderWithChildren>(folders.Length);
  454. for (int j = 0; j < folders.Length; j++)
  455. {
  456. InventoryFolderWithChildren invFolder = (InventoryFolderWithChildren)folderSerializer.Deserialize(
  457. new FileStream(folders[j], FileMode.Open, FileAccess.Read));
  458. collection.Folders[invFolder.ID] = invFolder;
  459. }
  460. // Iterate over the folders collection, adding children to their parents
  461. foreach (InventoryFolderWithChildren invFolder in collection.Folders.Values)
  462. {
  463. InventoryFolderWithChildren parent;
  464. if (collection.Folders.TryGetValue(invFolder.ParentID, out parent))
  465. parent.Children[invFolder.ID] = invFolder;
  466. }
  467. // Load all of the items for this agent
  468. string[] files = Directory.GetFiles(foldername, "*.item", SearchOption.TopDirectoryOnly);
  469. collection.Items = new Dictionary<UUID, InventoryItemBase>(files.Length);
  470. for (int j = 0; j < files.Length; j++)
  471. {
  472. InventoryItemBase invItem = (InventoryItemBase)itemSerializer.Deserialize(
  473. new FileStream(files[j], FileMode.Open, FileAccess.Read));
  474. collection.Items[invItem.ID] = invItem;
  475. // Add items to their parent folders
  476. InventoryFolderWithChildren parent;
  477. if (collection.Folders.TryGetValue(invItem.Folder, out parent))
  478. parent.Children[invItem.ID] = invItem;
  479. // Add active gestures to our list
  480. if (invItem.InvType == (int)InventoryType.Gesture && invItem.Flags != 0)
  481. activeGestures[owner].Add(invItem);
  482. }
  483. inventories.Add(owner, collection);
  484. }
  485. }
  486. }
  487. catch (Exception ex)
  488. {
  489. m_log.ErrorFormat("[SIMPLEINVENTORYSTORAGE]: Failed loading inventory from {0}: {1}", folder, ex.Message);
  490. }
  491. }
  492. #region IPlugin implementation
  493. public void Initialise(AssetInventoryServer server)
  494. {
  495. this.server = server;
  496. LoadFiles(DEFAULT_INVENTORY_DIR);
  497. m_log.InfoFormat("[SIMPLEINVENTORYSTORAGE]: Initialized the inventory index with data for {0} avatars",
  498. inventories.Count);
  499. }
  500. /// <summary>
  501. /// <para>Initialises asset interface</para>
  502. /// </summary>
  503. public void Initialise()
  504. {
  505. m_log.InfoFormat("[SIMPLEINVENTORYSTORAGE]: {0} cannot be default-initialized!", Name);
  506. throw new PluginNotInitialisedException(Name);
  507. }
  508. public void Dispose()
  509. {
  510. }
  511. public string Version
  512. {
  513. // TODO: this should be something meaningful and not hardcoded?
  514. get { return "0.1"; }
  515. }
  516. public string Name
  517. {
  518. get { return "SimpleInventoryStorage"; }
  519. }
  520. #endregion IPlugin implementation
  521. }
  522. }