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.

413 lines
19 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.59.3.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">Search Results for <span></span></div>
  59. <div class="sr-items">
  60. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  61. </div>
  62. <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></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.Utilities.Extensions">
  75. <h1 id="IPA_Utilities_Extensions" data-uid="IPA.Utilities.Extensions" class="text-break">Class Extensions
  76. </h1>
  77. <div class="markdown level0 summary"><p>A class providing various extension methods.</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">Extensions</span></div>
  84. </div>
  85. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Utilities.html">IPA.Utilities</a></h6>
  86. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  87. <h5 id="IPA_Utilities_Extensions_syntax">Syntax</h5>
  88. <div class="codewrapper">
  89. <pre><code class="lang-csharp hljs">public static class Extensions : object</code></pre>
  90. </div>
  91. <h3 id="methods">Methods
  92. </h3>
  93. <span class="small pull-right mobile-hide">
  94. <span class="divider">|</span>
  95. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Extensions_GetDefault_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Extensions.GetDefault(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>
  96. </span>
  97. <span class="small pull-right mobile-hide">
  98. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L19">View Source</a>
  99. </span>
  100. <a id="IPA_Utilities_Extensions_GetDefault_" data-uid="IPA.Utilities.Extensions.GetDefault*"></a>
  101. <h4 id="IPA_Utilities_Extensions_GetDefault_Type_" data-uid="IPA.Utilities.Extensions.GetDefault(Type)">GetDefault(Type)</h4>
  102. <div class="markdown level1 summary"><p>Gets the default value for a given <see cref="!:Type"></see>.</p>
  103. </div>
  104. <div class="markdown level1 conceptual"></div>
  105. <h5 class="decalaration">Declaration</h5>
  106. <div class="codewrapper">
  107. <pre><code class="lang-csharp hljs">public static object GetDefault(this Type type)</code></pre>
  108. </div>
  109. <h5 class="parameters">Parameters</h5>
  110. <table class="table table-bordered table-striped table-condensed">
  111. <thead>
  112. <tr>
  113. <th>Type</th>
  114. <th>Name</th>
  115. <th>Description</th>
  116. </tr>
  117. </thead>
  118. <tbody>
  119. <tr>
  120. <td><span class="xref">Type</span></td>
  121. <td><span class="parametername">type</span></td>
  122. <td><p>the <see cref="!:Type"></see> to get the default value for</p>
  123. </td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. <h5 class="returns">Returns</h5>
  128. <table class="table table-bordered table-striped table-condensed">
  129. <thead>
  130. <tr>
  131. <th>Type</th>
  132. <th>Description</th>
  133. </tr>
  134. </thead>
  135. <tbody>
  136. <tr>
  137. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></td>
  138. <td><p>the default value of <code data-dev-comment-type="paramref" class="paramref">type</code></p>
  139. </td>
  140. </tr>
  141. </tbody>
  142. </table>
  143. <span class="small pull-right mobile-hide">
  144. <span class="divider">|</span>
  145. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/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>
  146. </span>
  147. <span class="small pull-right mobile-hide">
  148. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L36">View Source</a>
  149. </span>
  150. <a id="IPA_Utilities_Extensions_IsSubPathOf_" data-uid="IPA.Utilities.Extensions.IsSubPathOf*"></a>
  151. <h4 id="IPA_Utilities_Extensions_IsSubPathOf_System_String_System_String_" data-uid="IPA.Utilities.Extensions.IsSubPathOf(System.String,System.String)">IsSubPathOf(String, String)</h4>
  152. <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>.
  153. The comparison is case-insensitive, handles / and \ slashes as folder separators and
  154. 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>
  155. </div>
  156. <div class="markdown level1 conceptual"></div>
  157. <h5 class="decalaration">Declaration</h5>
  158. <div class="codewrapper">
  159. <pre><code class="lang-csharp hljs">public static bool IsSubPathOf(this string path, string baseDirPath)</code></pre>
  160. </div>
  161. <h5 class="parameters">Parameters</h5>
  162. <table class="table table-bordered table-striped table-condensed">
  163. <thead>
  164. <tr>
  165. <th>Type</th>
  166. <th>Name</th>
  167. <th>Description</th>
  168. </tr>
  169. </thead>
  170. <tbody>
  171. <tr>
  172. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  173. <td><span class="parametername">path</span></td>
  174. <td></td>
  175. </tr>
  176. <tr>
  177. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  178. <td><span class="parametername">baseDirPath</span></td>
  179. <td></td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. <h5 class="returns">Returns</h5>
  184. <table class="table table-bordered table-striped table-condensed">
  185. <thead>
  186. <tr>
  187. <th>Type</th>
  188. <th>Description</th>
  189. </tr>
  190. </thead>
  191. <tbody>
  192. <tr>
  193. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  194. <td></td>
  195. </tr>
  196. </tbody>
  197. </table>
  198. <span class="small pull-right mobile-hide">
  199. <span class="divider">|</span>
  200. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/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>
  201. </span>
  202. <span class="small pull-right mobile-hide">
  203. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L76">View Source</a>
  204. </span>
  205. <a id="IPA_Utilities_Extensions_Right_" data-uid="IPA.Utilities.Extensions.Right*"></a>
  206. <h4 id="IPA_Utilities_Extensions_Right_System_String_System_Int32_" data-uid="IPA.Utilities.Extensions.Right(System.String,System.Int32)">Right(String, Int32)</h4>
  207. <div class="markdown level1 summary"><p>Gets the rightmost <code data-dev-comment-type="paramref" class="paramref">length</code> characters from a string.</p>
  208. </div>
  209. <div class="markdown level1 conceptual"></div>
  210. <h5 class="decalaration">Declaration</h5>
  211. <div class="codewrapper">
  212. <pre><code class="lang-csharp hljs">public static string Right(this string value, int length)</code></pre>
  213. </div>
  214. <h5 class="parameters">Parameters</h5>
  215. <table class="table table-bordered table-striped table-condensed">
  216. <thead>
  217. <tr>
  218. <th>Type</th>
  219. <th>Name</th>
  220. <th>Description</th>
  221. </tr>
  222. </thead>
  223. <tbody>
  224. <tr>
  225. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  226. <td><span class="parametername">value</span></td>
  227. <td><p>The string to retrieve the substring from.</p>
  228. </td>
  229. </tr>
  230. <tr>
  231. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  232. <td><span class="parametername">length</span></td>
  233. <td><p>The number of characters to retrieve.</p>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. <h5 class="returns">Returns</h5>
  239. <table class="table table-bordered table-striped table-condensed">
  240. <thead>
  241. <tr>
  242. <th>Type</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><p>The substring.</p>
  250. </td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. <span class="small pull-right mobile-hide">
  255. <span class="divider">|</span>
  256. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/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>
  257. </span>
  258. <span class="small pull-right mobile-hide">
  259. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L29">View Source</a>
  260. </span>
  261. <a id="IPA_Utilities_Extensions_Unwrap_" data-uid="IPA.Utilities.Extensions.Unwrap*"></a>
  262. <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>
  263. <div class="markdown level1 summary"><p>Unwraps a <see cref="!:Nullable&lt;T>"></see> where T is <see cref="!:System.Boolean"></see> such that if the value is null, it gives <span class="xref">false</span>.</p>
  264. </div>
  265. <div class="markdown level1 conceptual"></div>
  266. <h5 class="decalaration">Declaration</h5>
  267. <div class="codewrapper">
  268. <pre><code class="lang-csharp hljs">public static bool Unwrap(this bool? self)</code></pre>
  269. </div>
  270. <h5 class="parameters">Parameters</h5>
  271. <table class="table table-bordered table-striped table-condensed">
  272. <thead>
  273. <tr>
  274. <th>Type</th>
  275. <th>Name</th>
  276. <th>Description</th>
  277. </tr>
  278. </thead>
  279. <tbody>
  280. <tr>
  281. <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>
  282. <td><span class="parametername">self</span></td>
  283. <td><p>the bool? to unwrap</p>
  284. </td>
  285. </tr>
  286. </tbody>
  287. </table>
  288. <h5 class="returns">Returns</h5>
  289. <table class="table table-bordered table-striped table-condensed">
  290. <thead>
  291. <tr>
  292. <th>Type</th>
  293. <th>Description</th>
  294. </tr>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  299. <td><p>the unwrapped value, or <span class="xref">false</span> if it was <span class="xref">null</span></p>
  300. </td>
  301. </tr>
  302. </tbody>
  303. </table>
  304. <span class="small pull-right mobile-hide">
  305. <span class="divider">|</span>
  306. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/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>
  307. </span>
  308. <span class="small pull-right mobile-hide">
  309. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L52">View Source</a>
  310. </span>
  311. <a id="IPA_Utilities_Extensions_WithEnding_" data-uid="IPA.Utilities.Extensions.WithEnding*"></a>
  312. <h4 id="IPA_Utilities_Extensions_WithEnding_System_String_System_String_" data-uid="IPA.Utilities.Extensions.WithEnding(System.String,System.String)">WithEnding(String, String)</h4>
  313. <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
  314. results in satisfying .EndsWith(ending).</p>
  315. </div>
  316. <div class="markdown level1 conceptual"></div>
  317. <h5 class="decalaration">Declaration</h5>
  318. <div class="codewrapper">
  319. <pre><code class="lang-csharp hljs">public static string WithEnding(this string str, string ending)</code></pre>
  320. </div>
  321. <h5 class="parameters">Parameters</h5>
  322. <table class="table table-bordered table-striped table-condensed">
  323. <thead>
  324. <tr>
  325. <th>Type</th>
  326. <th>Name</th>
  327. <th>Description</th>
  328. </tr>
  329. </thead>
  330. <tbody>
  331. <tr>
  332. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  333. <td><span class="parametername">str</span></td>
  334. <td></td>
  335. </tr>
  336. <tr>
  337. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  338. <td><span class="parametername">ending</span></td>
  339. <td></td>
  340. </tr>
  341. </tbody>
  342. </table>
  343. <h5 class="returns">Returns</h5>
  344. <table class="table table-bordered table-striped table-condensed">
  345. <thead>
  346. <tr>
  347. <th>Type</th>
  348. <th>Description</th>
  349. </tr>
  350. </thead>
  351. <tbody>
  352. <tr>
  353. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  354. <td></td>
  355. </tr>
  356. </tbody>
  357. </table>
  358. <h5 id="IPA_Utilities_Extensions_WithEnding_System_String_System_String__examples">Examples</h5>
  359. <p>&quot;hel&quot;.WithEnding(&quot;llo&quot;) returns &quot;hello&quot;, which is the result of &quot;hel&quot; + &quot;lo&quot;.</p>
  360. </article>
  361. </div>
  362. <div class="hidden-sm col-md-2" role="complementary">
  363. <div class="sideaffix">
  364. <div class="contribution">
  365. <ul class="nav">
  366. <li>
  367. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/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>
  368. </li>
  369. <li>
  370. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Extensions.cs/#L12" class="contribution-link">View Source</a>
  371. </li>
  372. </ul>
  373. </div>
  374. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  375. <h5>In This Article</h5>
  376. <div></div>
  377. </nav>
  378. </div>
  379. </div>
  380. </div>
  381. </div>
  382. <footer>
  383. <div class="grad-bottom"></div>
  384. <div class="footer">
  385. <div class="container">
  386. <span class="pull-right">
  387. <a href="#top">Back to top</a>
  388. </span>
  389. <span>Generated by <strong>DocFX</strong></span>
  390. </div>
  391. </div>
  392. </footer>
  393. </div>
  394. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  395. <script type="text/javascript" src="../styles/docfx.js"></script>
  396. <script type="text/javascript" src="../styles/main.js"></script>
  397. </body>
  398. </html>