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.

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