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.

856 lines
40 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 ReflectionUtil
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class ReflectionUtil
  11. ">
  12. <meta name="generator" content="docfx 2.43.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.Utilities.ReflectionUtil">
  74. <h1 id="IPA_Utilities_ReflectionUtil" data-uid="IPA.Utilities.ReflectionUtil" class="text-break">Class ReflectionUtil
  75. </h1>
  76. <div class="markdown level0 summary"><p>A utility class providing reflection helper methods.</p>
  77. </div>
  78. <div class="markdown level0 conceptual"></div>
  79. <div class="inheritance">
  80. <h5>Inheritance</h5>
  81. <div class="level0"><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></div>
  82. <div class="level1"><span class="xref">ReflectionUtil</span></div>
  83. </div>
  84. <div class="inheritedMembers">
  85. <h5>Inherited Members</h5>
  86. <div>
  87. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.tostring#System_Object_ToString">Object.ToString()</a>
  88. </div>
  89. <div>
  90. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#System_Object_Equals_System_Object_">Object.Equals(Object)</a>
  91. </div>
  92. <div>
  93. <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>
  94. </div>
  95. <div>
  96. <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>
  97. </div>
  98. <div>
  99. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gethashcode#System_Object_GetHashCode">Object.GetHashCode()</a>
  100. </div>
  101. <div>
  102. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gettype#System_Object_GetType">Object.GetType()</a>
  103. </div>
  104. <div>
  105. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.memberwiseclone#System_Object_MemberwiseClone">Object.MemberwiseClone()</a>
  106. </div>
  107. </div>
  108. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Utilities.html">IPA.Utilities</a></h6>
  109. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  110. <h5 id="IPA_Utilities_ReflectionUtil_syntax">Syntax</h5>
  111. <div class="codewrapper">
  112. <pre><code class="lang-csharp hljs">public static class ReflectionUtil</code></pre>
  113. </div>
  114. <h3 id="methods">Methods
  115. </h3>
  116. <span class="small pull-right mobile-hide">
  117. <span class="divider">|</span>
  118. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_String_System_String_System_String_System_Type___System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CallNonStaticMethod(System.String%2CSystem.String%2CSystem.String%2CSystem.Type%5B%5D%2CSystem.Object%5B%5D)%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>
  119. </span>
  120. <span class="small pull-right mobile-hide">
  121. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L145">View Source</a>
  122. </span>
  123. <a id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod*"></a>
  124. <h4 id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_String_System_String_System_String_System_Type___System_Object___" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod(System.String,System.String,System.String,System.Type[],System.Object[])">CallNonStaticMethod(String, String, String, Type[], Object[])</h4>
  125. <div class="markdown level1 summary"><p>Calls an instance method on a type specified by <code data-dev-comment-type="paramref" class="paramref">functionClass</code> and <code data-dev-comment-type="paramref" class="paramref">dependency</code>.</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 static object CallNonStaticMethod(string functionClass, string dependency, string function, Type[] methodSig, params object[] parameters)</code></pre>
  131. </div>
  132. <h5 class="parameters">Parameters</h5>
  133. <table class="table table-bordered table-striped table-condensed">
  134. <thead>
  135. <tr>
  136. <th>Type</th>
  137. <th>Name</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><span class="parametername">functionClass</span></td>
  145. <td><p>the type name</p>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  150. <td><span class="parametername">dependency</span></td>
  151. <td><p>the assembly the type is in</p>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  156. <td><span class="parametername">function</span></td>
  157. <td><p>the name of the method to call</p>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a>[]</td>
  162. <td><span class="parametername">methodSig</span></td>
  163. <td><p>the type signature of the method</p>
  164. </td>
  165. </tr>
  166. <tr>
  167. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  168. <td><span class="parametername">parameters</span></td>
  169. <td><p>the method parameters</p>
  170. </td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <h5 class="returns">Returns</h5>
  175. <table class="table table-bordered table-striped table-condensed">
  176. <thead>
  177. <tr>
  178. <th>Type</th>
  179. <th>Description</th>
  180. </tr>
  181. </thead>
  182. <tbody>
  183. <tr>
  184. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  185. <td><p>the result of the call</p>
  186. </td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. <h5 id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_String_System_String_System_String_System_Type___System_Object____seealso">See Also</h5>
  191. <div class="seealso">
  192. <div><a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_Type_System_String_System_Type___System_Object___">CallNonStaticMethod(Type, String, Type[], Object[])</a></div>
  193. </div>
  194. <span class="small pull-right mobile-hide">
  195. <span class="divider">|</span>
  196. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_Type_System_String_System_Type___System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CallNonStaticMethod(System.Type%2CSystem.String%2CSystem.Type%5B%5D%2CSystem.Object%5B%5D)%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>
  197. </span>
  198. <span class="small pull-right mobile-hide">
  199. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L158">View Source</a>
  200. </span>
  201. <a id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod*"></a>
  202. <h4 id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_Type_System_String_System_Type___System_Object___" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod(System.Type,System.String,System.Type[],System.Object[])">CallNonStaticMethod(Type, String, Type[], Object[])</h4>
  203. <div class="markdown level1 summary"><p>Calls an instance method on a new object.</p>
  204. </div>
  205. <div class="markdown level1 conceptual"></div>
  206. <h5 class="decalaration">Declaration</h5>
  207. <div class="codewrapper">
  208. <pre><code class="lang-csharp hljs">public static object CallNonStaticMethod(this Type type, string function, Type[] methodSig, params object[] parameters)</code></pre>
  209. </div>
  210. <h5 class="parameters">Parameters</h5>
  211. <table class="table table-bordered table-striped table-condensed">
  212. <thead>
  213. <tr>
  214. <th>Type</th>
  215. <th>Name</th>
  216. <th>Description</th>
  217. </tr>
  218. </thead>
  219. <tbody>
  220. <tr>
  221. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a></td>
  222. <td><span class="parametername">type</span></td>
  223. <td><p>the object type</p>
  224. </td>
  225. </tr>
  226. <tr>
  227. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  228. <td><span class="parametername">function</span></td>
  229. <td><p>the name of the method to call</p>
  230. </td>
  231. </tr>
  232. <tr>
  233. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a>[]</td>
  234. <td><span class="parametername">methodSig</span></td>
  235. <td><p>the type signature</p>
  236. </td>
  237. </tr>
  238. <tr>
  239. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  240. <td><span class="parametername">parameters</span></td>
  241. <td><p>the parameters</p>
  242. </td>
  243. </tr>
  244. </tbody>
  245. </table>
  246. <h5 class="returns">Returns</h5>
  247. <table class="table table-bordered table-striped table-condensed">
  248. <thead>
  249. <tr>
  250. <th>Type</th>
  251. <th>Description</th>
  252. </tr>
  253. </thead>
  254. <tbody>
  255. <tr>
  256. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  257. <td><p>the result of the call</p>
  258. </td>
  259. </tr>
  260. </tbody>
  261. </table>
  262. <span class="small pull-right mobile-hide">
  263. <span class="divider">|</span>
  264. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CallNonStaticMethod__1_System_Type_System_String_System_Type___System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CallNonStaticMethod%60%601(System.Type%2CSystem.String%2CSystem.Type%5B%5D%2CSystem.Object%5B%5D)%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>
  265. </span>
  266. <span class="small pull-right mobile-hide">
  267. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L189">View Source</a>
  268. </span>
  269. <a id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod_" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod*"></a>
  270. <h4 id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod__1_System_Type_System_String_System_Type___System_Object___" data-uid="IPA.Utilities.ReflectionUtil.CallNonStaticMethod``1(System.Type,System.String,System.Type[],System.Object[])">CallNonStaticMethod&lt;T&gt;(Type, String, Type[], Object[])</h4>
  271. <div class="markdown level1 summary"><p>Calls an instance method on a new object.</p>
  272. </div>
  273. <div class="markdown level1 conceptual"></div>
  274. <h5 class="decalaration">Declaration</h5>
  275. <div class="codewrapper">
  276. <pre><code class="lang-csharp hljs">public static T CallNonStaticMethod&lt;T&gt;(this Type type, string function, Type[] methodSig, params object[] parameters)</code></pre>
  277. </div>
  278. <h5 class="parameters">Parameters</h5>
  279. <table class="table table-bordered table-striped table-condensed">
  280. <thead>
  281. <tr>
  282. <th>Type</th>
  283. <th>Name</th>
  284. <th>Description</th>
  285. </tr>
  286. </thead>
  287. <tbody>
  288. <tr>
  289. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a></td>
  290. <td><span class="parametername">type</span></td>
  291. <td><p>the object type</p>
  292. </td>
  293. </tr>
  294. <tr>
  295. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  296. <td><span class="parametername">function</span></td>
  297. <td><p>the name of the method to call</p>
  298. </td>
  299. </tr>
  300. <tr>
  301. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a>[]</td>
  302. <td><span class="parametername">methodSig</span></td>
  303. <td><p>the type signature</p>
  304. </td>
  305. </tr>
  306. <tr>
  307. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  308. <td><span class="parametername">parameters</span></td>
  309. <td><p>the parameters</p>
  310. </td>
  311. </tr>
  312. </tbody>
  313. </table>
  314. <h5 class="returns">Returns</h5>
  315. <table class="table table-bordered table-striped table-condensed">
  316. <thead>
  317. <tr>
  318. <th>Type</th>
  319. <th>Description</th>
  320. </tr>
  321. </thead>
  322. <tbody>
  323. <tr>
  324. <td><span class="xref">T</span></td>
  325. <td><p>the result of the call</p>
  326. </td>
  327. </tr>
  328. </tbody>
  329. </table>
  330. <h5 class="typeParameters">Type Parameters</h5>
  331. <table class="table table-bordered table-striped table-condensed">
  332. <thead>
  333. <tr>
  334. <th>Name</th>
  335. <th>Description</th>
  336. </tr>
  337. </thead>
  338. <tbody>
  339. <tr>
  340. <td><span class="parametername">T</span></td>
  341. <td><p>the return type</p>
  342. </td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <h5 id="IPA_Utilities_ReflectionUtil_CallNonStaticMethod__1_System_Type_System_String_System_Type___System_Object____seealso">See Also</h5>
  347. <div class="seealso">
  348. <div><a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CallNonStaticMethod_System_Type_System_String_System_Type___System_Object___">CallNonStaticMethod(Type, String, Type[], Object[])</a></div>
  349. </div>
  350. <span class="small pull-right mobile-hide">
  351. <span class="divider">|</span>
  352. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CopyComponent(UnityEngine.Component%2CSystem.Type%2CUnityEngine.GameObject%2CSystem.Type)%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>
  353. </span>
  354. <span class="small pull-right mobile-hide">
  355. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L85">View Source</a>
  356. </span>
  357. <a id="IPA_Utilities_ReflectionUtil_CopyComponent_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent*"></a>
  358. <h4 id="IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent(UnityEngine.Component,System.Type,UnityEngine.GameObject,System.Type)">CopyComponent(Component, Type, GameObject, Type)</h4>
  359. <div class="markdown level1 summary"><p>Copies a component <code data-dev-comment-type="paramref" class="paramref">original</code> to a component of <code data-dev-comment-type="paramref" class="paramref">overridingType</code> on the destination <span class="xref">UnityEngine.GameObject</span>.</p>
  360. </div>
  361. <div class="markdown level1 conceptual"></div>
  362. <h5 class="decalaration">Declaration</h5>
  363. <div class="codewrapper">
  364. <pre><code class="lang-csharp hljs">public static Component CopyComponent(this Component original, Type overridingType, GameObject destination, Type originalTypeOverride = null)</code></pre>
  365. </div>
  366. <h5 class="parameters">Parameters</h5>
  367. <table class="table table-bordered table-striped table-condensed">
  368. <thead>
  369. <tr>
  370. <th>Type</th>
  371. <th>Name</th>
  372. <th>Description</th>
  373. </tr>
  374. </thead>
  375. <tbody>
  376. <tr>
  377. <td><span class="xref">UnityEngine.Component</span></td>
  378. <td><span class="parametername">original</span></td>
  379. <td><p>the original component</p>
  380. </td>
  381. </tr>
  382. <tr>
  383. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a></td>
  384. <td><span class="parametername">overridingType</span></td>
  385. <td><p>the new component&apos;s type</p>
  386. </td>
  387. </tr>
  388. <tr>
  389. <td><span class="xref">UnityEngine.GameObject</span></td>
  390. <td><span class="parametername">destination</span></td>
  391. <td><p>the destination GameObject</p>
  392. </td>
  393. </tr>
  394. <tr>
  395. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a></td>
  396. <td><span class="parametername">originalTypeOverride</span></td>
  397. <td><p>overrides the source component type (for example, to a superclass)</p>
  398. </td>
  399. </tr>
  400. </tbody>
  401. </table>
  402. <h5 class="returns">Returns</h5>
  403. <table class="table table-bordered table-striped table-condensed">
  404. <thead>
  405. <tr>
  406. <th>Type</th>
  407. <th>Description</th>
  408. </tr>
  409. </thead>
  410. <tbody>
  411. <tr>
  412. <td><span class="xref">UnityEngine.Component</span></td>
  413. <td><p>the copied component</p>
  414. </td>
  415. </tr>
  416. </tbody>
  417. </table>
  418. <span class="small pull-right mobile-hide">
  419. <span class="divider">|</span>
  420. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CopyComponent%60%601(UnityEngine.Component%2CUnityEngine.GameObject%2CSystem.Type)%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>
  421. </span>
  422. <span class="small pull-right mobile-hide">
  423. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L109">View Source</a>
  424. </span>
  425. <a id="IPA_Utilities_ReflectionUtil_CopyComponent_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent*"></a>
  426. <h4 id="IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent``1(UnityEngine.Component,UnityEngine.GameObject,System.Type)">CopyComponent&lt;T&gt;(Component, GameObject, Type)</h4>
  427. <div class="markdown level1 summary"><p>A generic version of <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_">CopyComponent(Component, Type, GameObject, Type)</a>. </p>
  428. </div>
  429. <div class="markdown level1 conceptual"></div>
  430. <h5 class="decalaration">Declaration</h5>
  431. <div class="codewrapper">
  432. <pre><code class="lang-csharp hljs">public static T CopyComponent&lt;T&gt;(this Component original, GameObject destination, Type originalTypeOverride = null)
  433. where T : Component</code></pre>
  434. </div>
  435. <h5 class="parameters">Parameters</h5>
  436. <table class="table table-bordered table-striped table-condensed">
  437. <thead>
  438. <tr>
  439. <th>Type</th>
  440. <th>Name</th>
  441. <th>Description</th>
  442. </tr>
  443. </thead>
  444. <tbody>
  445. <tr>
  446. <td><span class="xref">UnityEngine.Component</span></td>
  447. <td><span class="parametername">original</span></td>
  448. <td><p>the original component</p>
  449. </td>
  450. </tr>
  451. <tr>
  452. <td><span class="xref">UnityEngine.GameObject</span></td>
  453. <td><span class="parametername">destination</span></td>
  454. <td><p>the destination game object</p>
  455. </td>
  456. </tr>
  457. <tr>
  458. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a></td>
  459. <td><span class="parametername">originalTypeOverride</span></td>
  460. <td><p>overrides the source component type (for example, to a superclass)</p>
  461. </td>
  462. </tr>
  463. </tbody>
  464. </table>
  465. <h5 class="returns">Returns</h5>
  466. <table class="table table-bordered table-striped table-condensed">
  467. <thead>
  468. <tr>
  469. <th>Type</th>
  470. <th>Description</th>
  471. </tr>
  472. </thead>
  473. <tbody>
  474. <tr>
  475. <td><span class="xref">T</span></td>
  476. <td><p>the copied component</p>
  477. </td>
  478. </tr>
  479. </tbody>
  480. </table>
  481. <h5 class="typeParameters">Type Parameters</h5>
  482. <table class="table table-bordered table-striped table-condensed">
  483. <thead>
  484. <tr>
  485. <th>Name</th>
  486. <th>Description</th>
  487. </tr>
  488. </thead>
  489. <tbody>
  490. <tr>
  491. <td><span class="parametername">T</span></td>
  492. <td><p>the overriding type</p>
  493. </td>
  494. </tr>
  495. </tbody>
  496. </table>
  497. <h5 id="IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type__seealso">See Also</h5>
  498. <div class="seealso">
  499. <div><a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_">CopyComponent(Component, Type, GameObject, Type)</a></div>
  500. </div>
  501. <span class="small pull-right mobile-hide">
  502. <span class="divider">|</span>
  503. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_GetPrivateField__1_System_Object_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.GetPrivateField%60%601(System.Object%2CSystem.String)%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>
  504. </span>
  505. <span class="small pull-right mobile-hide">
  506. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L31">View Source</a>
  507. </span>
  508. <a id="IPA_Utilities_ReflectionUtil_GetPrivateField_" data-uid="IPA.Utilities.ReflectionUtil.GetPrivateField*"></a>
  509. <h4 id="IPA_Utilities_ReflectionUtil_GetPrivateField__1_System_Object_System_String_" data-uid="IPA.Utilities.ReflectionUtil.GetPrivateField``1(System.Object,System.String)">GetPrivateField&lt;T&gt;(Object, String)</h4>
  510. <div class="markdown level1 summary"><p>Gets the value of a (potentially) private field.</p>
  511. </div>
  512. <div class="markdown level1 conceptual"></div>
  513. <h5 class="decalaration">Declaration</h5>
  514. <div class="codewrapper">
  515. <pre><code class="lang-csharp hljs">public static T GetPrivateField&lt;T&gt;(this object obj, string fieldName)</code></pre>
  516. </div>
  517. <h5 class="parameters">Parameters</h5>
  518. <table class="table table-bordered table-striped table-condensed">
  519. <thead>
  520. <tr>
  521. <th>Type</th>
  522. <th>Name</th>
  523. <th>Description</th>
  524. </tr>
  525. </thead>
  526. <tbody>
  527. <tr>
  528. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  529. <td><span class="parametername">obj</span></td>
  530. <td><p>the object instance to pull from</p>
  531. </td>
  532. </tr>
  533. <tr>
  534. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  535. <td><span class="parametername">fieldName</span></td>
  536. <td><p>the name of the field to read</p>
  537. </td>
  538. </tr>
  539. </tbody>
  540. </table>
  541. <h5 class="returns">Returns</h5>
  542. <table class="table table-bordered table-striped table-condensed">
  543. <thead>
  544. <tr>
  545. <th>Type</th>
  546. <th>Description</th>
  547. </tr>
  548. </thead>
  549. <tbody>
  550. <tr>
  551. <td><span class="xref">T</span></td>
  552. <td><p>the value of the field</p>
  553. </td>
  554. </tr>
  555. </tbody>
  556. </table>
  557. <h5 class="typeParameters">Type Parameters</h5>
  558. <table class="table table-bordered table-striped table-condensed">
  559. <thead>
  560. <tr>
  561. <th>Name</th>
  562. <th>Description</th>
  563. </tr>
  564. </thead>
  565. <tbody>
  566. <tr>
  567. <td><span class="parametername">T</span></td>
  568. <td><p>the type of te field (result casted)</p>
  569. </td>
  570. </tr>
  571. </tbody>
  572. </table>
  573. <span class="small pull-right mobile-hide">
  574. <span class="divider">|</span>
  575. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_InvokePrivateMethod_System_Object_System_String_System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.InvokePrivateMethod(System.Object%2CSystem.String%2CSystem.Object%5B%5D)%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>
  576. </span>
  577. <span class="small pull-right mobile-hide">
  578. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L58">View Source</a>
  579. </span>
  580. <a id="IPA_Utilities_ReflectionUtil_InvokePrivateMethod_" data-uid="IPA.Utilities.ReflectionUtil.InvokePrivateMethod*"></a>
  581. <h4 id="IPA_Utilities_ReflectionUtil_InvokePrivateMethod_System_Object_System_String_System_Object___" data-uid="IPA.Utilities.ReflectionUtil.InvokePrivateMethod(System.Object,System.String,System.Object[])">InvokePrivateMethod(Object, String, Object[])</h4>
  582. <div class="markdown level1 summary"><p>Invokes a (potentially) private method.</p>
  583. </div>
  584. <div class="markdown level1 conceptual"></div>
  585. <h5 class="decalaration">Declaration</h5>
  586. <div class="codewrapper">
  587. <pre><code class="lang-csharp hljs">public static object InvokePrivateMethod(this object obj, string methodName, params object[] methodParams)</code></pre>
  588. </div>
  589. <h5 class="parameters">Parameters</h5>
  590. <table class="table table-bordered table-striped table-condensed">
  591. <thead>
  592. <tr>
  593. <th>Type</th>
  594. <th>Name</th>
  595. <th>Description</th>
  596. </tr>
  597. </thead>
  598. <tbody>
  599. <tr>
  600. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  601. <td><span class="parametername">obj</span></td>
  602. <td><p>the object to call from</p>
  603. </td>
  604. </tr>
  605. <tr>
  606. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  607. <td><span class="parametername">methodName</span></td>
  608. <td><p>the method name</p>
  609. </td>
  610. </tr>
  611. <tr>
  612. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  613. <td><span class="parametername">methodParams</span></td>
  614. <td><p>the method parameters</p>
  615. </td>
  616. </tr>
  617. </tbody>
  618. </table>
  619. <h5 class="returns">Returns</h5>
  620. <table class="table table-bordered table-striped table-condensed">
  621. <thead>
  622. <tr>
  623. <th>Type</th>
  624. <th>Description</th>
  625. </tr>
  626. </thead>
  627. <tbody>
  628. <tr>
  629. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  630. <td><p>the return value</p>
  631. </td>
  632. </tr>
  633. </tbody>
  634. </table>
  635. <span class="small pull-right mobile-hide">
  636. <span class="divider">|</span>
  637. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_InvokePrivateMethod__1_System_Object_System_String_System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.InvokePrivateMethod%60%601(System.Object%2CSystem.String%2CSystem.Object%5B%5D)%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>
  638. </span>
  639. <span class="small pull-right mobile-hide">
  640. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L72">View Source</a>
  641. </span>
  642. <a id="IPA_Utilities_ReflectionUtil_InvokePrivateMethod_" data-uid="IPA.Utilities.ReflectionUtil.InvokePrivateMethod*"></a>
  643. <h4 id="IPA_Utilities_ReflectionUtil_InvokePrivateMethod__1_System_Object_System_String_System_Object___" data-uid="IPA.Utilities.ReflectionUtil.InvokePrivateMethod``1(System.Object,System.String,System.Object[])">InvokePrivateMethod&lt;T&gt;(Object, String, Object[])</h4>
  644. <div class="markdown level1 summary"><p>Invokes a (potentially) private method.</p>
  645. </div>
  646. <div class="markdown level1 conceptual"></div>
  647. <h5 class="decalaration">Declaration</h5>
  648. <div class="codewrapper">
  649. <pre><code class="lang-csharp hljs">public static T InvokePrivateMethod&lt;T&gt;(this object obj, string methodName, params object[] methodParams)</code></pre>
  650. </div>
  651. <h5 class="parameters">Parameters</h5>
  652. <table class="table table-bordered table-striped table-condensed">
  653. <thead>
  654. <tr>
  655. <th>Type</th>
  656. <th>Name</th>
  657. <th>Description</th>
  658. </tr>
  659. </thead>
  660. <tbody>
  661. <tr>
  662. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  663. <td><span class="parametername">obj</span></td>
  664. <td><p>the object to call from</p>
  665. </td>
  666. </tr>
  667. <tr>
  668. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  669. <td><span class="parametername">methodName</span></td>
  670. <td><p>the method name to call</p>
  671. </td>
  672. </tr>
  673. <tr>
  674. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  675. <td><span class="parametername">methodParams</span></td>
  676. <td><p>the method&apos;s parameters</p>
  677. </td>
  678. </tr>
  679. </tbody>
  680. </table>
  681. <h5 class="returns">Returns</h5>
  682. <table class="table table-bordered table-striped table-condensed">
  683. <thead>
  684. <tr>
  685. <th>Type</th>
  686. <th>Description</th>
  687. </tr>
  688. </thead>
  689. <tbody>
  690. <tr>
  691. <td><span class="xref">T</span></td>
  692. <td><p>the return value</p>
  693. </td>
  694. </tr>
  695. </tbody>
  696. </table>
  697. <h5 class="typeParameters">Type Parameters</h5>
  698. <table class="table table-bordered table-striped table-condensed">
  699. <thead>
  700. <tr>
  701. <th>Name</th>
  702. <th>Description</th>
  703. </tr>
  704. </thead>
  705. <tbody>
  706. <tr>
  707. <td><span class="parametername">T</span></td>
  708. <td><p>the return type</p>
  709. </td>
  710. </tr>
  711. </tbody>
  712. </table>
  713. <span class="small pull-right mobile-hide">
  714. <span class="divider">|</span>
  715. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_SetPrivateField_System_Object_System_String_System_Object_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.SetPrivateField(System.Object%2CSystem.String%2CSystem.Object)%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>
  716. </span>
  717. <span class="small pull-right mobile-hide">
  718. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L18">View Source</a>
  719. </span>
  720. <a id="IPA_Utilities_ReflectionUtil_SetPrivateField_" data-uid="IPA.Utilities.ReflectionUtil.SetPrivateField*"></a>
  721. <h4 id="IPA_Utilities_ReflectionUtil_SetPrivateField_System_Object_System_String_System_Object_" data-uid="IPA.Utilities.ReflectionUtil.SetPrivateField(System.Object,System.String,System.Object)">SetPrivateField(Object, String, Object)</h4>
  722. <div class="markdown level1 summary"><p>Sets a (potentially) private field on the target object.</p>
  723. </div>
  724. <div class="markdown level1 conceptual"></div>
  725. <h5 class="decalaration">Declaration</h5>
  726. <div class="codewrapper">
  727. <pre><code class="lang-csharp hljs">public static void SetPrivateField(this object obj, string fieldName, object value)</code></pre>
  728. </div>
  729. <h5 class="parameters">Parameters</h5>
  730. <table class="table table-bordered table-striped table-condensed">
  731. <thead>
  732. <tr>
  733. <th>Type</th>
  734. <th>Name</th>
  735. <th>Description</th>
  736. </tr>
  737. </thead>
  738. <tbody>
  739. <tr>
  740. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  741. <td><span class="parametername">obj</span></td>
  742. <td><p>the object instance</p>
  743. </td>
  744. </tr>
  745. <tr>
  746. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  747. <td><span class="parametername">fieldName</span></td>
  748. <td><p>the field to set</p>
  749. </td>
  750. </tr>
  751. <tr>
  752. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  753. <td><span class="parametername">value</span></td>
  754. <td><p>the value to set it to</p>
  755. </td>
  756. </tr>
  757. </tbody>
  758. </table>
  759. <span class="small pull-right mobile-hide">
  760. <span class="divider">|</span>
  761. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_SetPrivateProperty_System_Object_System_String_System_Object_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.SetPrivateProperty(System.Object%2CSystem.String%2CSystem.Object)%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>
  762. </span>
  763. <span class="small pull-right mobile-hide">
  764. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L44">View Source</a>
  765. </span>
  766. <a id="IPA_Utilities_ReflectionUtil_SetPrivateProperty_" data-uid="IPA.Utilities.ReflectionUtil.SetPrivateProperty*"></a>
  767. <h4 id="IPA_Utilities_ReflectionUtil_SetPrivateProperty_System_Object_System_String_System_Object_" data-uid="IPA.Utilities.ReflectionUtil.SetPrivateProperty(System.Object,System.String,System.Object)">SetPrivateProperty(Object, String, Object)</h4>
  768. <div class="markdown level1 summary"><p>Sets a (potentially) private property on the target object.</p>
  769. </div>
  770. <div class="markdown level1 conceptual"></div>
  771. <h5 class="decalaration">Declaration</h5>
  772. <div class="codewrapper">
  773. <pre><code class="lang-csharp hljs">public static void SetPrivateProperty(this object obj, string propertyName, object value)</code></pre>
  774. </div>
  775. <h5 class="parameters">Parameters</h5>
  776. <table class="table table-bordered table-striped table-condensed">
  777. <thead>
  778. <tr>
  779. <th>Type</th>
  780. <th>Name</th>
  781. <th>Description</th>
  782. </tr>
  783. </thead>
  784. <tbody>
  785. <tr>
  786. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  787. <td><span class="parametername">obj</span></td>
  788. <td><p>the target object instance</p>
  789. </td>
  790. </tr>
  791. <tr>
  792. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  793. <td><span class="parametername">propertyName</span></td>
  794. <td><p>the name of the property</p>
  795. </td>
  796. </tr>
  797. <tr>
  798. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  799. <td><span class="parametername">value</span></td>
  800. <td><p>the value to set it to</p>
  801. </td>
  802. </tr>
  803. </tbody>
  804. </table>
  805. </article>
  806. </div>
  807. <div class="hidden-sm col-md-2" role="complementary">
  808. <div class="sideaffix">
  809. <div class="contribution">
  810. <ul class="nav">
  811. <li>
  812. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil%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>
  813. </li>
  814. <li>
  815. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/57cdcd2b85cf3ef32f94212de7d633c305442393/IPA.Loader/Utilities/ReflectionUtil.cs/#L10" class="contribution-link">View Source</a>
  816. </li>
  817. </ul>
  818. </div>
  819. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  820. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  821. </nav>
  822. </div>
  823. </div>
  824. </div>
  825. </div>
  826. <footer>
  827. <div class="grad-bottom"></div>
  828. <div class="footer">
  829. <div class="container">
  830. <span class="pull-right">
  831. <a href="#top">Back to top</a>
  832. </span>
  833. <span>Generated by <strong>DocFX</strong></span>
  834. </div>
  835. </div>
  836. </footer>
  837. </div>
  838. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  839. <script type="text/javascript" src="../styles/docfx.js"></script>
  840. <script type="text/javascript" src="../styles/main.js"></script>
  841. </body>
  842. </html>