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.

309 lines
15 KiB

  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class GeneratedExtension
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class GeneratedExtension
  11. ">
  12. <meta name="generator" content="docfx 2.48.1.0">
  13. <link rel="shortcut icon" href="../favicon.ico">
  14. <link rel="stylesheet" href="../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../styles/docfx.css">
  16. <link rel="stylesheet" href="../styles/main.css">
  17. <link rel="stylesheet" href="../styles/fix.css">
  18. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  19. <meta property="docfx:navrel" content="../toc.html">
  20. <meta property="docfx:tocrel" content="toc.html">
  21. <meta property="docfx:rel" content="../">
  22. <meta property="docfx:newtab" content="true">
  23. </head> <body data-spy="scroll" data-target="#affix" data-offset="120">
  24. <div id="wrapper">
  25. <header>
  26. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  27. <div class="container">
  28. <div class="navbar-header">
  29. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  30. <span class="sr-only">Toggle navigation</span>
  31. <span class="icon-bar"></span>
  32. <span class="icon-bar"></span>
  33. <span class="icon-bar"></span>
  34. </button>
  35. <a class="navbar-brand" href="../index.html">
  36. <img id="logo" class="svg" src="../logo.svg" alt="">
  37. </a>
  38. </div>
  39. <div class="collapse navbar-collapse" id="navbar">
  40. <form class="navbar-form navbar-right" role="search" id="search">
  41. <div class="form-group">
  42. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  43. </div>
  44. </form>
  45. </div>
  46. </div>
  47. </nav>
  48. <div class="subnav navbar navbar-default">
  49. <div class="container hide-when-search" id="breadcrumb">
  50. <ul class="breadcrumb">
  51. <li></li>
  52. </ul>
  53. </div>
  54. </div>
  55. </header>
  56. <div class="container body-content">
  57. <div id="search-results">
  58. <div class="search-list"></div>
  59. <div class="sr-items">
  60. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  61. </div>
  62. <ul id="pagination"></ul>
  63. </div>
  64. </div>
  65. <div role="main" class="container body-content hide-when-search">
  66. <div class="sidenav hide-when-search">
  67. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  68. <div class="sidetoggle collapse" id="sidetoggle">
  69. <div id="sidetoc"></div>
  70. </div>
  71. </div>
  72. <div class="article row grid-right">
  73. <div class="col-md-10">
  74. <article class="content wrap" id="_content" data-uid="IPA.Config.Stores.GeneratedExtension">
  75. <h1 id="IPA_Config_Stores_GeneratedExtension" data-uid="IPA.Config.Stores.GeneratedExtension" class="text-break">Class GeneratedExtension
  76. </h1>
  77. <div class="markdown level0 summary"><p>A class providing an extension for <a class="xref" href="IPA.Config.Config.html">Config</a> to make it easy to use generated
  78. config stores.</p>
  79. </div>
  80. <div class="markdown level0 conceptual"></div>
  81. <div class="inheritance">
  82. <h5>Inheritance</h5>
  83. <div class="level0"><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></div>
  84. <div class="level1"><span class="xref">GeneratedExtension</span></div>
  85. </div>
  86. <div class="inheritedMembers">
  87. <h5>Inherited Members</h5>
  88. <div>
  89. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.tostring#System_Object_ToString">Object.ToString()</a>
  90. </div>
  91. <div>
  92. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#System_Object_Equals_System_Object_">Object.Equals(Object)</a>
  93. </div>
  94. <div>
  95. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#System_Object_Equals_System_Object_System_Object_">Object.Equals(Object, Object)</a>
  96. </div>
  97. <div>
  98. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.referenceequals#System_Object_ReferenceEquals_System_Object_System_Object_">Object.ReferenceEquals(Object, Object)</a>
  99. </div>
  100. <div>
  101. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gethashcode#System_Object_GetHashCode">Object.GetHashCode()</a>
  102. </div>
  103. <div>
  104. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gettype#System_Object_GetType">Object.GetType()</a>
  105. </div>
  106. <div>
  107. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.memberwiseclone#System_Object_MemberwiseClone">Object.MemberwiseClone()</a>
  108. </div>
  109. </div>
  110. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Config.Stores.html">IPA.Config.Stores</a></h6>
  111. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  112. <h5 id="IPA_Config_Stores_GeneratedExtension_syntax">Syntax</h5>
  113. <div class="codewrapper">
  114. <pre><code class="lang-csharp hljs">public static class GeneratedExtension</code></pre>
  115. </div>
  116. <h3 id="fields">Fields
  117. </h3>
  118. <span class="small pull-right mobile-hide">
  119. <span class="divider">|</span>
  120. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Config_Stores_GeneratedExtension_AssemblyVisibilityTarget.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.GeneratedExtension.AssemblyVisibilityTarget%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  121. </span>
  122. <span class="small pull-right mobile-hide">
  123. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/ea42dc2c9b2c3b44161ca163d9cc6aaec44375dd/IPA.Loader/Config/Stores/GeneratedStore.cs/#L36">View Source</a>
  124. </span>
  125. <h4 id="IPA_Config_Stores_GeneratedExtension_AssemblyVisibilityTarget" data-uid="IPA.Config.Stores.GeneratedExtension.AssemblyVisibilityTarget">AssemblyVisibilityTarget</h4>
  126. <div class="markdown level1 summary"><p>The name of the assembly that internals must be visible to to allow internal protection.</p>
  127. </div>
  128. <div class="markdown level1 conceptual"></div>
  129. <h5 class="decalaration">Declaration</h5>
  130. <div class="codewrapper">
  131. <pre><code class="lang-csharp hljs">public const string AssemblyVisibilityTarget = &quot;IPA.Config.Generated&quot;</code></pre>
  132. </div>
  133. <h5 class="fieldValue">Field Value</h5>
  134. <table class="table table-bordered table-striped table-condensed">
  135. <thead>
  136. <tr>
  137. <th>Type</th>
  138. <th>Description</th>
  139. </tr>
  140. </thead>
  141. <tbody>
  142. <tr>
  143. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  144. <td></td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. <h3 id="methods">Methods
  149. </h3>
  150. <span class="small pull-right mobile-hide">
  151. <span class="divider">|</span>
  152. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Config_Stores_GeneratedExtension_Generated__1_IPA_Config_Config_System_Boolean_.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.GeneratedExtension.Generated%60%601(IPA.Config.Config%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  153. </span>
  154. <span class="small pull-right mobile-hide">
  155. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/ea42dc2c9b2c3b44161ca163d9cc6aaec44375dd/IPA.Loader/Config/Stores/GeneratedStore.cs/#L82">View Source</a>
  156. </span>
  157. <a id="IPA_Config_Stores_GeneratedExtension_Generated_" data-uid="IPA.Config.Stores.GeneratedExtension.Generated*"></a>
  158. <h4 id="IPA_Config_Stores_GeneratedExtension_Generated__1_IPA_Config_Config_System_Boolean_" data-uid="IPA.Config.Stores.GeneratedExtension.Generated``1(IPA.Config.Config,System.Boolean)">Generated&lt;T&gt;(Config, Boolean)</h4>
  159. <div class="markdown level1 summary"><p>Creates a generated <a class="xref" href="IPA.Config.IConfigStore.html">IConfigStore</a> of type <code data-dev-comment-type="typeparamref" class="typeparamref">T</code>, registers it to
  160. the <a class="xref" href="IPA.Config.Config.html">Config</a> object, and returns it. This also forces a synchronous config load via
  161. <a class="xref" href="IPA.Config.Config.html#IPA_Config_Config_LoadSync">LoadSync()</a> if <code data-dev-comment-type="paramref" class="paramref">loadSync</code> is <span class="xref">true</span>.</p>
  162. </div>
  163. <div class="markdown level1 conceptual"></div>
  164. <h5 class="decalaration">Declaration</h5>
  165. <div class="codewrapper">
  166. <pre><code class="lang-csharp hljs">public static T Generated&lt;T&gt;(this Config cfg, bool loadSync = true)
  167. where T : class</code></pre>
  168. </div>
  169. <h5 class="parameters">Parameters</h5>
  170. <table class="table table-bordered table-striped table-condensed">
  171. <thead>
  172. <tr>
  173. <th>Type</th>
  174. <th>Name</th>
  175. <th>Description</th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. <tr>
  180. <td><a class="xref" href="IPA.Config.Config.html">Config</a></td>
  181. <td><span class="parametername">cfg</span></td>
  182. <td><p>the <a class="xref" href="IPA.Config.Config.html">Config</a> to register to</p>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  187. <td><span class="parametername">loadSync</span></td>
  188. <td><p>whether to synchronously load the content, or trigger an async load</p>
  189. </td>
  190. </tr>
  191. </tbody>
  192. </table>
  193. <h5 class="returns">Returns</h5>
  194. <table class="table table-bordered table-striped table-condensed">
  195. <thead>
  196. <tr>
  197. <th>Type</th>
  198. <th>Description</th>
  199. </tr>
  200. </thead>
  201. <tbody>
  202. <tr>
  203. <td><span class="xref">T</span></td>
  204. <td><p>a generated instance of <code data-dev-comment-type="typeparamref" class="typeparamref">T</code> as a special <a class="xref" href="IPA.Config.IConfigStore.html">IConfigStore</a></p>
  205. </td>
  206. </tr>
  207. </tbody>
  208. </table>
  209. <h5 class="typeParameters">Type Parameters</h5>
  210. <table class="table table-bordered table-striped table-condensed">
  211. <thead>
  212. <tr>
  213. <th>Name</th>
  214. <th>Description</th>
  215. </tr>
  216. </thead>
  217. <tbody>
  218. <tr>
  219. <td><span class="parametername">T</span></td>
  220. <td><p>the type to wrap</p>
  221. </td>
  222. </tr>
  223. </tbody>
  224. </table>
  225. <h5 id="IPA_Config_Stores_GeneratedExtension_Generated__1_IPA_Config_Config_System_Boolean__remarks">Remarks</h5>
  226. <div class="markdown level1 remarks"><p>
  227. <code data-dev-comment-type="typeparamref" class="typeparamref">T</code> must be a public non-<span class="xref">sealed</span> class.
  228. It can also be internal, but in that case, then your assembly must have the following attribute
  229. to allow the generated code to reference it.
  230. <pre><code>[assembly: InternalsVisibleTo(IPA.Config.Stores.GeneratedExtension.AssemblyVisibilityTarget)]</code></pre>
  231. </p>
  232. <p>
  233. Only fields and properties that are public or protected will be considered, and only properties
  234. where both the getter and setter are public or protected are considered. Any fields or properties
  235. with an <a class="xref" href="IPA.Config.Stores.Attributes.IgnoreAttribute.html">IgnoreAttribute</a> applied to them are also ignored. Having properties be <span class="xref">virtual</span> is not strictly
  236. necessary, however it allows the generated type to keep track of changes and lock around them so that the config will auto-save.
  237. </p>
  238. <p>
  239. All of the attributes in the <a class="xref" href="IPA.Config.Stores.Attributes.html">IPA.Config.Stores.Attributes</a> namespace are handled as described by them.
  240. </p>
  241. <p>
  242. If the <code data-dev-comment-type="typeparamref" class="typeparamref">T</code> declares a public or protected, <span class="xref">virtual</span>
  243. method <code>Changed()</code>, then that method may be called to artificially signal to the runtime that the content of the object
  244. has changed. That method will also be called after the write locks are released when a property is set anywhere in the owning
  245. tree. This will only be called on the outermost generated object of the config structure, even if the change being signaled
  246. is somewhere deep into the tree. TODO: is this a good idea?
  247. </p>
  248. <p>
  249. Similarly, <code data-dev-comment-type="typeparamref" class="typeparamref">T</code> can declare a public or protected, <span class="xref">virtual</span>
  250. method <code>OnReload()</code>, which will be called on the filesystem reader thread after the object has been repopulated with new data
  251. values. It will be called <em>after</em> the write lock for this object is released. This will only be called on the outermost generated
  252. object of the config structure.
  253. </p>
  254. <p>
  255. TODO: describe details of generated stores
  256. </p>
  257. </div>
  258. </article>
  259. </div>
  260. <div class="hidden-sm col-md-2" role="complementary">
  261. <div class="sideaffix">
  262. <div class="contribution">
  263. <ul class="nav">
  264. <li>
  265. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Config_Stores_GeneratedExtension.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.GeneratedExtension%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
  266. </li>
  267. <li>
  268. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/ea42dc2c9b2c3b44161ca163d9cc6aaec44375dd/IPA.Loader/Config/Stores/GeneratedStore.cs/#L31" class="contribution-link">View Source</a>
  269. </li>
  270. </ul>
  271. </div>
  272. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  273. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  274. </nav>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. <footer>
  280. <div class="grad-bottom"></div>
  281. <div class="footer">
  282. <div class="container">
  283. <span class="pull-right">
  284. <a href="#top">Back to top</a>
  285. </span>
  286. <span>Generated by <strong>DocFX</strong></span>
  287. </div>
  288. </div>
  289. </footer>
  290. </div>
  291. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  292. <script type="text/javascript" src="../styles/docfx.js"></script>
  293. <script type="text/javascript" src="../styles/main.js"></script>
  294. </body>
  295. </html>