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.

437 lines
20 KiB

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