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.

435 lines
21 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 Extensions
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class Extensions
  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.Utilities.Extensions">
  74. <h1 id="IPA_Utilities_Extensions" data-uid="IPA.Utilities.Extensions" class="text-break">Class Extensions
  75. </h1>
  76. <div class="markdown level0 summary"><p>A class providing various extension 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">Extensions</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_Extensions_syntax">Syntax</h5>
  111. <div class="codewrapper">
  112. <pre><code class="lang-csharp hljs">public static class Extensions</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/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions_GetDefault_System_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.GetDefault(System.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>
  119. </span>
  120. <span class="small pull-right mobile-hide">
  121. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L19">View Source</a>
  122. </span>
  123. <a id="IPA_Utilities_Extensions_GetDefault_" data-uid="IPA.Utilities.Extensions.GetDefault*"></a>
  124. <h4 id="IPA_Utilities_Extensions_GetDefault_System_Type_" data-uid="IPA.Utilities.Extensions.GetDefault(System.Type)">GetDefault(Type)</h4>
  125. <div class="markdown level1 summary"><p>Gets the default value for a given <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a>.</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 GetDefault(this Type type)</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.type">Type</a></td>
  144. <td><span class="parametername">type</span></td>
  145. <td><p>the <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.type">Type</a> to get the default value for</p>
  146. </td>
  147. </tr>
  148. </tbody>
  149. </table>
  150. <h5 class="returns">Returns</h5>
  151. <table class="table table-bordered table-striped table-condensed">
  152. <thead>
  153. <tr>
  154. <th>Type</th>
  155. <th>Description</th>
  156. </tr>
  157. </thead>
  158. <tbody>
  159. <tr>
  160. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  161. <td><p>the default value of <code data-dev-comment-type="paramref" class="paramref">type</code></p>
  162. </td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. <span class="small pull-right mobile-hide">
  167. <span class="divider">|</span>
  168. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions_IsSubPathOf_System_String_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.IsSubPathOf(System.String%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>
  169. </span>
  170. <span class="small pull-right mobile-hide">
  171. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L36">View Source</a>
  172. </span>
  173. <a id="IPA_Utilities_Extensions_IsSubPathOf_" data-uid="IPA.Utilities.Extensions.IsSubPathOf*"></a>
  174. <h4 id="IPA_Utilities_Extensions_IsSubPathOf_System_String_System_String_" data-uid="IPA.Utilities.Extensions.IsSubPathOf(System.String,System.String)">IsSubPathOf(String, String)</h4>
  175. <div class="markdown level1 summary"><p>Returns true if <code data-dev-comment-type="paramref" class="paramref">path</code> starts with the path <code data-dev-comment-type="paramref" class="paramref">baseDirPath</code>.
  176. The comparison is case-insensitive, handles / and \ slashes as folder separators and
  177. only matches if the base dir folder name is matched exactly (&quot;c:\foobar\file.txt&quot; is not a sub path of &quot;c:\foo&quot;).</p>
  178. </div>
  179. <div class="markdown level1 conceptual"></div>
  180. <h5 class="decalaration">Declaration</h5>
  181. <div class="codewrapper">
  182. <pre><code class="lang-csharp hljs">public static bool IsSubPathOf(this string path, string baseDirPath)</code></pre>
  183. </div>
  184. <h5 class="parameters">Parameters</h5>
  185. <table class="table table-bordered table-striped table-condensed">
  186. <thead>
  187. <tr>
  188. <th>Type</th>
  189. <th>Name</th>
  190. <th>Description</th>
  191. </tr>
  192. </thead>
  193. <tbody>
  194. <tr>
  195. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  196. <td><span class="parametername">path</span></td>
  197. <td></td>
  198. </tr>
  199. <tr>
  200. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  201. <td><span class="parametername">baseDirPath</span></td>
  202. <td></td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. <h5 class="returns">Returns</h5>
  207. <table class="table table-bordered table-striped table-condensed">
  208. <thead>
  209. <tr>
  210. <th>Type</th>
  211. <th>Description</th>
  212. </tr>
  213. </thead>
  214. <tbody>
  215. <tr>
  216. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  217. <td></td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. <span class="small pull-right mobile-hide">
  222. <span class="divider">|</span>
  223. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions_Right_System_String_System_Int32_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.Right(System.String%2CSystem.Int32)%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>
  224. </span>
  225. <span class="small pull-right mobile-hide">
  226. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L76">View Source</a>
  227. </span>
  228. <a id="IPA_Utilities_Extensions_Right_" data-uid="IPA.Utilities.Extensions.Right*"></a>
  229. <h4 id="IPA_Utilities_Extensions_Right_System_String_System_Int32_" data-uid="IPA.Utilities.Extensions.Right(System.String,System.Int32)">Right(String, Int32)</h4>
  230. <div class="markdown level1 summary"><p>Gets the rightmost <code data-dev-comment-type="paramref" class="paramref">length</code> characters from a string.</p>
  231. </div>
  232. <div class="markdown level1 conceptual"></div>
  233. <h5 class="decalaration">Declaration</h5>
  234. <div class="codewrapper">
  235. <pre><code class="lang-csharp hljs">public static string Right(this string value, int length)</code></pre>
  236. </div>
  237. <h5 class="parameters">Parameters</h5>
  238. <table class="table table-bordered table-striped table-condensed">
  239. <thead>
  240. <tr>
  241. <th>Type</th>
  242. <th>Name</th>
  243. <th>Description</th>
  244. </tr>
  245. </thead>
  246. <tbody>
  247. <tr>
  248. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  249. <td><span class="parametername">value</span></td>
  250. <td><p>The string to retrieve the substring from.</p>
  251. </td>
  252. </tr>
  253. <tr>
  254. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  255. <td><span class="parametername">length</span></td>
  256. <td><p>The number of characters to retrieve.</p>
  257. </td>
  258. </tr>
  259. </tbody>
  260. </table>
  261. <h5 class="returns">Returns</h5>
  262. <table class="table table-bordered table-striped table-condensed">
  263. <thead>
  264. <tr>
  265. <th>Type</th>
  266. <th>Description</th>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. <tr>
  271. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  272. <td><p>The substring.</p>
  273. </td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. <span class="small pull-right mobile-hide">
  278. <span class="divider">|</span>
  279. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions_Unwrap_System_Nullable_System_Boolean__.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.Unwrap(System.Nullable%7BSystem.Boolean%7D)%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>
  280. </span>
  281. <span class="small pull-right mobile-hide">
  282. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L29">View Source</a>
  283. </span>
  284. <a id="IPA_Utilities_Extensions_Unwrap_" data-uid="IPA.Utilities.Extensions.Unwrap*"></a>
  285. <h4 id="IPA_Utilities_Extensions_Unwrap_System_Nullable_System_Boolean__" data-uid="IPA.Utilities.Extensions.Unwrap(System.Nullable{System.Boolean})">Unwrap(Nullable&lt;Boolean&gt;)</h4>
  286. <div class="markdown level1 summary"><p>Unwraps a <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.nullable-1">Nullable&lt;T&gt;</a> where T is <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a> such that if the value is null, it gives <span class="xref">false</span>.</p>
  287. </div>
  288. <div class="markdown level1 conceptual"></div>
  289. <h5 class="decalaration">Declaration</h5>
  290. <div class="codewrapper">
  291. <pre><code class="lang-csharp hljs">public static bool Unwrap(this bool? self)</code></pre>
  292. </div>
  293. <h5 class="parameters">Parameters</h5>
  294. <table class="table table-bordered table-striped table-condensed">
  295. <thead>
  296. <tr>
  297. <th>Type</th>
  298. <th>Name</th>
  299. <th>Description</th>
  300. </tr>
  301. </thead>
  302. <tbody>
  303. <tr>
  304. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.nullable-1">Nullable</a>&lt;<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a>&gt;</td>
  305. <td><span class="parametername">self</span></td>
  306. <td><p>the bool? to unwrap</p>
  307. </td>
  308. </tr>
  309. </tbody>
  310. </table>
  311. <h5 class="returns">Returns</h5>
  312. <table class="table table-bordered table-striped table-condensed">
  313. <thead>
  314. <tr>
  315. <th>Type</th>
  316. <th>Description</th>
  317. </tr>
  318. </thead>
  319. <tbody>
  320. <tr>
  321. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  322. <td><p>the unwrapped value, or <span class="xref">false</span> if it was <span class="xref">null</span></p>
  323. </td>
  324. </tr>
  325. </tbody>
  326. </table>
  327. <span class="small pull-right mobile-hide">
  328. <span class="divider">|</span>
  329. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions_WithEnding_System_String_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.WithEnding(System.String%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>
  330. </span>
  331. <span class="small pull-right mobile-hide">
  332. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L52">View Source</a>
  333. </span>
  334. <a id="IPA_Utilities_Extensions_WithEnding_" data-uid="IPA.Utilities.Extensions.WithEnding*"></a>
  335. <h4 id="IPA_Utilities_Extensions_WithEnding_System_String_System_String_" data-uid="IPA.Utilities.Extensions.WithEnding(System.String,System.String)">WithEnding(String, String)</h4>
  336. <div class="markdown level1 summary"><p>Returns <code data-dev-comment-type="paramref" class="paramref">str</code> with the minimal concatenation of <code data-dev-comment-type="paramref" class="paramref">ending</code> (starting from end) that
  337. results in satisfying .EndsWith(ending).</p>
  338. </div>
  339. <div class="markdown level1 conceptual"></div>
  340. <h5 class="decalaration">Declaration</h5>
  341. <div class="codewrapper">
  342. <pre><code class="lang-csharp hljs">public static string WithEnding(this string str, string ending)</code></pre>
  343. </div>
  344. <h5 class="parameters">Parameters</h5>
  345. <table class="table table-bordered table-striped table-condensed">
  346. <thead>
  347. <tr>
  348. <th>Type</th>
  349. <th>Name</th>
  350. <th>Description</th>
  351. </tr>
  352. </thead>
  353. <tbody>
  354. <tr>
  355. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  356. <td><span class="parametername">str</span></td>
  357. <td></td>
  358. </tr>
  359. <tr>
  360. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  361. <td><span class="parametername">ending</span></td>
  362. <td></td>
  363. </tr>
  364. </tbody>
  365. </table>
  366. <h5 class="returns">Returns</h5>
  367. <table class="table table-bordered table-striped table-condensed">
  368. <thead>
  369. <tr>
  370. <th>Type</th>
  371. <th>Description</th>
  372. </tr>
  373. </thead>
  374. <tbody>
  375. <tr>
  376. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  377. <td></td>
  378. </tr>
  379. </tbody>
  380. </table>
  381. <h5 id="IPA_Utilities_Extensions_WithEnding_System_String_System_String__examples">Examples</h5>
  382. <p>&quot;hel&quot;.WithEnding(&quot;llo&quot;) returns &quot;hello&quot;, which is the result of &quot;hel&quot; + &quot;lo&quot;.</p>
  383. </article>
  384. </div>
  385. <div class="hidden-sm col-md-2" role="complementary">
  386. <div class="sideaffix">
  387. <div class="contribution">
  388. <ul class="nav">
  389. <li>
  390. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/4.0.0-beta/docs/override/new?filename=IPA_Utilities_Extensions.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions%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>
  391. </li>
  392. <li>
  393. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/154f22292e0c2566936beb9f47f26c44274627bb/IPA.Loader/Utilities/Extensions.cs/#L12" class="contribution-link">View Source</a>
  394. </li>
  395. </ul>
  396. </div>
  397. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  398. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  399. </nav>
  400. </div>
  401. </div>
  402. </div>
  403. </div>
  404. <footer>
  405. <div class="grad-bottom"></div>
  406. <div class="footer">
  407. <div class="container">
  408. <span class="pull-right">
  409. <a href="#top">Back to top</a>
  410. </span>
  411. <span>Generated by <strong>DocFX</strong></span>
  412. </div>
  413. </div>
  414. </footer>
  415. </div>
  416. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  417. <script type="text/javascript" src="../styles/docfx.js"></script>
  418. <script type="text/javascript" src="../styles/main.js"></script>
  419. </body>
  420. </html>