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.

707 lines
33 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 Utils
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class Utils
  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.Utils">
  75. <h1 id="IPA_Utilities_Utils" data-uid="IPA.Utilities.Utils" class="text-break">Class Utils
  76. </h1>
  77. <div class="markdown level0 summary"><p>A class providing static utility functions that in any other language would just <em>exist</em>.</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">Utils</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_Utils_syntax">Syntax</h5>
  88. <div class="codewrapper">
  89. <pre><code class="lang-csharp hljs">public static class Utils : object</code></pre>
  90. </div>
  91. <h3 id="properties">Properties
  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_Utils_CanUseDateTimeNowSafely.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.CanUseDateTimeNowSafely%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/Utils.cs/#L161">View Source</a>
  99. </span>
  100. <a id="IPA_Utilities_Utils_CanUseDateTimeNowSafely_" data-uid="IPA.Utilities.Utils.CanUseDateTimeNowSafely*"></a>
  101. <h4 id="IPA_Utilities_Utils_CanUseDateTimeNowSafely" data-uid="IPA.Utilities.Utils.CanUseDateTimeNowSafely">CanUseDateTimeNowSafely</h4>
  102. <div class="markdown level1 summary"><p>Whether you can safely use <see cref="!:DateTime.Now"></see> without Mono throwing a fit.</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 bool CanUseDateTimeNowSafely { get; }</code></pre>
  108. </div>
  109. <h5 class="propertyValue">Property Value</h5>
  110. <table class="table table-bordered table-striped table-condensed">
  111. <thead>
  112. <tr>
  113. <th>Type</th>
  114. <th>Description</th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. <tr>
  119. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  120. <td><p><span class="xref">true</span> if you can use <see cref="!:DateTime.Now"></see> safely, <span class="xref">false</span> otherwise</p>
  121. </td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <h3 id="methods">Methods
  126. </h3>
  127. <span class="small pull-right mobile-hide">
  128. <span class="divider">|</span>
  129. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_ByteArrayToString_System_Byte___.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.ByteArrayToString(System.Byte%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>
  130. </span>
  131. <span class="small pull-right mobile-hide">
  132. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L44">View Source</a>
  133. </span>
  134. <a id="IPA_Utilities_Utils_ByteArrayToString_" data-uid="IPA.Utilities.Utils.ByteArrayToString*"></a>
  135. <h4 id="IPA_Utilities_Utils_ByteArrayToString_System_Byte___" data-uid="IPA.Utilities.Utils.ByteArrayToString(System.Byte[])">ByteArrayToString(Byte[])</h4>
  136. <div class="markdown level1 summary"><p>Converts a byte array to a hex string.</p>
  137. </div>
  138. <div class="markdown level1 conceptual"></div>
  139. <h5 class="decalaration">Declaration</h5>
  140. <div class="codewrapper">
  141. <pre><code class="lang-csharp hljs">public static string ByteArrayToString(byte[] ba)</code></pre>
  142. </div>
  143. <h5 class="parameters">Parameters</h5>
  144. <table class="table table-bordered table-striped table-condensed">
  145. <thead>
  146. <tr>
  147. <th>Type</th>
  148. <th>Name</th>
  149. <th>Description</th>
  150. </tr>
  151. </thead>
  152. <tbody>
  153. <tr>
  154. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  155. <td><span class="parametername">ba</span></td>
  156. <td><p>the byte array</p>
  157. </td>
  158. </tr>
  159. </tbody>
  160. </table>
  161. <h5 class="returns">Returns</h5>
  162. <table class="table table-bordered table-striped table-condensed">
  163. <thead>
  164. <tr>
  165. <th>Type</th>
  166. <th>Description</th>
  167. </tr>
  168. </thead>
  169. <tbody>
  170. <tr>
  171. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  172. <td><p>the hex form of the array</p>
  173. </td>
  174. </tr>
  175. </tbody>
  176. </table>
  177. <span class="small pull-right mobile-hide">
  178. <span class="divider">|</span>
  179. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_CopyAll_DirectoryInfo_DirectoryInfo_System_String_System_Nullable_Func_Exception_FileInfo_System_Boolean___.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.CopyAll(DirectoryInfo%2CDirectoryInfo%2CSystem.String%2CSystem.Nullable%7BFunc%7BException%2CFileInfo%2CSystem.Boolean%7D%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>
  180. </span>
  181. <span class="small pull-right mobile-hide">
  182. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L112">View Source</a>
  183. </span>
  184. <a id="IPA_Utilities_Utils_CopyAll_" data-uid="IPA.Utilities.Utils.CopyAll*"></a>
  185. <h4 id="IPA_Utilities_Utils_CopyAll_DirectoryInfo_DirectoryInfo_System_String_System_Nullable_Func_Exception_FileInfo_System_Boolean___" data-uid="IPA.Utilities.Utils.CopyAll(DirectoryInfo,DirectoryInfo,System.String,System.Nullable{Func{Exception,FileInfo,System.Boolean}})">CopyAll(DirectoryInfo, DirectoryInfo, String, Nullable&lt;Func&lt;Exception, FileInfo, Boolean&gt;&gt;)</h4>
  186. <div class="markdown level1 summary"><p>Copies all files from <code data-dev-comment-type="paramref" class="paramref">source</code> to <code data-dev-comment-type="paramref" class="paramref">target</code>.</p>
  187. </div>
  188. <div class="markdown level1 conceptual"></div>
  189. <h5 class="decalaration">Declaration</h5>
  190. <div class="codewrapper">
  191. <pre><code class="lang-csharp hljs">public static void CopyAll(DirectoryInfo source, DirectoryInfo target, string appendFileName = &quot;&quot;, Func&lt;Exception, FileInfo, bool&gt;? onCopyException = null)</code></pre>
  192. </div>
  193. <h5 class="parameters">Parameters</h5>
  194. <table class="table table-bordered table-striped table-condensed">
  195. <thead>
  196. <tr>
  197. <th>Type</th>
  198. <th>Name</th>
  199. <th>Description</th>
  200. </tr>
  201. </thead>
  202. <tbody>
  203. <tr>
  204. <td><span class="xref">DirectoryInfo</span></td>
  205. <td><span class="parametername">source</span></td>
  206. <td><p>the source directory</p>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td><span class="xref">DirectoryInfo</span></td>
  211. <td><span class="parametername">target</span></td>
  212. <td><p>the destination directory</p>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  217. <td><span class="parametername">appendFileName</span></td>
  218. <td><p>the filename of the file to append together</p>
  219. </td>
  220. </tr>
  221. <tr>
  222. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.nullable-1">Nullable</a>&lt;<span class="xref">Func</span>&lt;<span class="xref">Exception</span>, <span class="xref">FileInfo</span>, <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a>&gt;&gt;</td>
  223. <td><span class="parametername">onCopyException</span></td>
  224. <td><p>a delegate called when there is an error copying. Return true to keep going.</p>
  225. </td>
  226. </tr>
  227. </tbody>
  228. </table>
  229. <span class="small pull-right mobile-hide">
  230. <span class="divider">|</span>
  231. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_CurrentTime.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.CurrentTime%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>
  232. </span>
  233. <span class="small pull-right mobile-hide">
  234. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L168">View Source</a>
  235. </span>
  236. <a id="IPA_Utilities_Utils_CurrentTime_" data-uid="IPA.Utilities.Utils.CurrentTime*"></a>
  237. <h4 id="IPA_Utilities_Utils_CurrentTime" data-uid="IPA.Utilities.Utils.CurrentTime">CurrentTime()</h4>
  238. <div class="markdown level1 summary"><p>Returns <see cref="!:DateTime.Now"></see> if supported, otherwise <see cref="!:DateTime.UtcNow"></see>.</p>
  239. </div>
  240. <div class="markdown level1 conceptual"></div>
  241. <h5 class="decalaration">Declaration</h5>
  242. <div class="codewrapper">
  243. <pre><code class="lang-csharp hljs">public static DateTime CurrentTime()</code></pre>
  244. </div>
  245. <h5 class="returns">Returns</h5>
  246. <table class="table table-bordered table-striped table-condensed">
  247. <thead>
  248. <tr>
  249. <th>Type</th>
  250. <th>Description</th>
  251. </tr>
  252. </thead>
  253. <tbody>
  254. <tr>
  255. <td><span class="xref">DateTime</span></td>
  256. <td><p>the current <see cref="!:DateTime"></see> if supported, otherwise some indeterminant increasing value.</p>
  257. </td>
  258. </tr>
  259. </tbody>
  260. </table>
  261. <span class="small pull-right mobile-hide">
  262. <span class="divider">|</span>
  263. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_Deconstruct__2_KeyValuePair___0___1____0____1__.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.Deconstruct%60%602(KeyValuePair%7B%60%600%2C%60%601%7D%2C%60%600%40%2C%60%601%40)%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>
  264. </span>
  265. <span class="small pull-right mobile-hide">
  266. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L268">View Source</a>
  267. </span>
  268. <a id="IPA_Utilities_Utils_Deconstruct_" data-uid="IPA.Utilities.Utils.Deconstruct*"></a>
  269. <h4 id="IPA_Utilities_Utils_Deconstruct__2_KeyValuePair___0___1____0____1__" data-uid="IPA.Utilities.Utils.Deconstruct``2(KeyValuePair{``0,``1},``0@,``1@)">Deconstruct&lt;TKey, TValue&gt;(KeyValuePair&lt;TKey, TValue&gt;, out TKey, out TValue)</h4>
  270. <div class="markdown level1 summary"><p>Deconstructs a <see cref="!:KeyValuePair&lt;TKey, TValue>"></see> as its key and value.</p>
  271. </div>
  272. <div class="markdown level1 conceptual"></div>
  273. <h5 class="decalaration">Declaration</h5>
  274. <div class="codewrapper">
  275. <pre><code class="lang-csharp hljs">public static void Deconstruct&lt;TKey, TValue&gt;(this KeyValuePair&lt;TKey, TValue&gt; kvp, out TKey key, out TValue value)</code></pre>
  276. </div>
  277. <h5 class="parameters">Parameters</h5>
  278. <table class="table table-bordered table-striped table-condensed">
  279. <thead>
  280. <tr>
  281. <th>Type</th>
  282. <th>Name</th>
  283. <th>Description</th>
  284. </tr>
  285. </thead>
  286. <tbody>
  287. <tr>
  288. <td><span class="xref">KeyValuePair</span>&lt;TKey, TValue&gt;</td>
  289. <td><span class="parametername">kvp</span></td>
  290. <td><p>The <see cref="!:KeyValuePair&lt;TKey, TValue>"></see> to deconstruct.</p>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td><span class="xref">TKey</span></td>
  295. <td><span class="parametername">key</span></td>
  296. <td><p>The key in <code data-dev-comment-type="paramref" class="paramref">kvp</code>.</p>
  297. </td>
  298. </tr>
  299. <tr>
  300. <td><span class="xref">TValue</span></td>
  301. <td><span class="parametername">value</span></td>
  302. <td><p>The value in <code data-dev-comment-type="paramref" class="paramref">kvp</code>.</p>
  303. </td>
  304. </tr>
  305. </tbody>
  306. </table>
  307. <h5 class="typeParameters">Type Parameters</h5>
  308. <table class="table table-bordered table-striped table-condensed">
  309. <thead>
  310. <tr>
  311. <th>Name</th>
  312. <th>Description</th>
  313. </tr>
  314. </thead>
  315. <tbody>
  316. <tr>
  317. <td><span class="parametername">TKey</span></td>
  318. <td><p>The type of the key.</p>
  319. </td>
  320. </tr>
  321. <tr>
  322. <td><span class="parametername">TValue</span></td>
  323. <td><p>The type of the value.</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_Utils_GetRelativePath_System_String_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.GetRelativePath(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/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L88">View Source</a>
  334. </span>
  335. <a id="IPA_Utilities_Utils_GetRelativePath_" data-uid="IPA.Utilities.Utils.GetRelativePath*"></a>
  336. <h4 id="IPA_Utilities_Utils_GetRelativePath_System_String_System_String_" data-uid="IPA.Utilities.Utils.GetRelativePath(System.String,System.String)">GetRelativePath(String, String)</h4>
  337. <div class="markdown level1 summary"><p>Gets a path relative to the provided folder.</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 GetRelativePath(string file, string folder)</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">file</span></td>
  357. <td><p>the file to relativize</p>
  358. </td>
  359. </tr>
  360. <tr>
  361. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  362. <td><span class="parametername">folder</span></td>
  363. <td><p>the source folder</p>
  364. </td>
  365. </tr>
  366. </tbody>
  367. </table>
  368. <h5 class="returns">Returns</h5>
  369. <table class="table table-bordered table-striped table-condensed">
  370. <thead>
  371. <tr>
  372. <th>Type</th>
  373. <th>Description</th>
  374. </tr>
  375. </thead>
  376. <tbody>
  377. <tr>
  378. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  379. <td><p>a path to get from <code data-dev-comment-type="paramref" class="paramref">folder</code> to <code data-dev-comment-type="paramref" class="paramref">file</code></p>
  380. </td>
  381. </tr>
  382. </tbody>
  383. </table>
  384. <span class="small pull-right mobile-hide">
  385. <span class="divider">|</span>
  386. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_ScopeGuard_Action_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.ScopeGuard(Action)%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>
  387. </span>
  388. <span class="small pull-right mobile-hide">
  389. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L257">View Source</a>
  390. </span>
  391. <a id="IPA_Utilities_Utils_ScopeGuard_" data-uid="IPA.Utilities.Utils.ScopeGuard*"></a>
  392. <h4 id="IPA_Utilities_Utils_ScopeGuard_Action_" data-uid="IPA.Utilities.Utils.ScopeGuard(Action)">ScopeGuard(Action)</h4>
  393. <div class="markdown level1 summary"><p>Creates a scope guard for a given <see cref="!:Action"></see>.</p>
  394. </div>
  395. <div class="markdown level1 conceptual"></div>
  396. <h5 class="decalaration">Declaration</h5>
  397. <div class="codewrapper">
  398. <pre><code class="lang-csharp hljs">public static Utils.ScopeGuardObject ScopeGuard(Action action)</code></pre>
  399. </div>
  400. <h5 class="parameters">Parameters</h5>
  401. <table class="table table-bordered table-striped table-condensed">
  402. <thead>
  403. <tr>
  404. <th>Type</th>
  405. <th>Name</th>
  406. <th>Description</th>
  407. </tr>
  408. </thead>
  409. <tbody>
  410. <tr>
  411. <td><span class="xref">Action</span></td>
  412. <td><span class="parametername">action</span></td>
  413. <td><p>the <see cref="!:Action"></see> to run on dispose</p>
  414. </td>
  415. </tr>
  416. </tbody>
  417. </table>
  418. <h5 class="returns">Returns</h5>
  419. <table class="table table-bordered table-striped table-condensed">
  420. <thead>
  421. <tr>
  422. <th>Type</th>
  423. <th>Description</th>
  424. </tr>
  425. </thead>
  426. <tbody>
  427. <tr>
  428. <td><a class="xref" href="IPA.Utilities.Utils.ScopeGuardObject.html">Utils.ScopeGuardObject</a></td>
  429. <td><p>a <a class="xref" href="IPA.Utilities.Utils.ScopeGuardObject.html">Utils.ScopeGuardObject</a> that will run <code data-dev-comment-type="paramref" class="paramref">action</code> on disposal</p>
  430. </td>
  431. </tr>
  432. </tbody>
  433. </table>
  434. <h5 id="IPA_Utilities_Utils_ScopeGuard_Action__examples">Examples</h5>
  435. <pre><code>using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value));</code></pre>
  436. <span class="small pull-right mobile-hide">
  437. <span class="divider">|</span>
  438. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_StringToByteArray_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.StringToByteArray(System.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>
  439. </span>
  440. <span class="small pull-right mobile-hide">
  441. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L28">View Source</a>
  442. </span>
  443. <a id="IPA_Utilities_Utils_StringToByteArray_" data-uid="IPA.Utilities.Utils.StringToByteArray*"></a>
  444. <h4 id="IPA_Utilities_Utils_StringToByteArray_System_String_" data-uid="IPA.Utilities.Utils.StringToByteArray(System.String)">StringToByteArray(String)</h4>
  445. <div class="markdown level1 summary"><p>Converts a hex string to a byte array.</p>
  446. </div>
  447. <div class="markdown level1 conceptual"></div>
  448. <h5 class="decalaration">Declaration</h5>
  449. <div class="codewrapper">
  450. <pre><code class="lang-csharp hljs">public static byte[] StringToByteArray(string hex)</code></pre>
  451. </div>
  452. <h5 class="parameters">Parameters</h5>
  453. <table class="table table-bordered table-striped table-condensed">
  454. <thead>
  455. <tr>
  456. <th>Type</th>
  457. <th>Name</th>
  458. <th>Description</th>
  459. </tr>
  460. </thead>
  461. <tbody>
  462. <tr>
  463. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  464. <td><span class="parametername">hex</span></td>
  465. <td><p>the hex stream</p>
  466. </td>
  467. </tr>
  468. </tbody>
  469. </table>
  470. <h5 class="returns">Returns</h5>
  471. <table class="table table-bordered table-striped table-condensed">
  472. <thead>
  473. <tr>
  474. <th>Type</th>
  475. <th>Description</th>
  476. </tr>
  477. </thead>
  478. <tbody>
  479. <tr>
  480. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  481. <td><p>the corresponding byte array</p>
  482. </td>
  483. </tr>
  484. </tbody>
  485. </table>
  486. <span class="small pull-right mobile-hide">
  487. <span class="divider">|</span>
  488. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.UnsafeCompare(System.Byte%5B%5D%2CSystem.Byte%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>
  489. </span>
  490. <span class="small pull-right mobile-hide">
  491. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L64">View Source</a>
  492. </span>
  493. <a id="IPA_Utilities_Utils_UnsafeCompare_" data-uid="IPA.Utilities.Utils.UnsafeCompare*"></a>
  494. <h4 id="IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___" data-uid="IPA.Utilities.Utils.UnsafeCompare(System.Byte[],System.Byte[])">UnsafeCompare(Byte[], Byte[])</h4>
  495. <div class="markdown level1 summary"><p>Uses unsafe code to compare 2 byte arrays quickly.</p>
  496. </div>
  497. <div class="markdown level1 conceptual"></div>
  498. <h5 class="decalaration">Declaration</h5>
  499. <div class="codewrapper">
  500. <pre><code class="lang-csharp hljs">public static bool UnsafeCompare(byte[] a1, byte[] a2)</code></pre>
  501. </div>
  502. <h5 class="parameters">Parameters</h5>
  503. <table class="table table-bordered table-striped table-condensed">
  504. <thead>
  505. <tr>
  506. <th>Type</th>
  507. <th>Name</th>
  508. <th>Description</th>
  509. </tr>
  510. </thead>
  511. <tbody>
  512. <tr>
  513. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  514. <td><span class="parametername">a1</span></td>
  515. <td><p>array 1</p>
  516. </td>
  517. </tr>
  518. <tr>
  519. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  520. <td><span class="parametername">a2</span></td>
  521. <td><p>array 2</p>
  522. </td>
  523. </tr>
  524. </tbody>
  525. </table>
  526. <h5 class="returns">Returns</h5>
  527. <table class="table table-bordered table-striped table-condensed">
  528. <thead>
  529. <tr>
  530. <th>Type</th>
  531. <th>Description</th>
  532. </tr>
  533. </thead>
  534. <tbody>
  535. <tr>
  536. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  537. <td><p>whether or not they are byte-for-byte equal</p>
  538. </td>
  539. </tr>
  540. </tbody>
  541. </table>
  542. <span class="small pull-right mobile-hide">
  543. <span class="divider">|</span>
  544. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_VersionCompareNoPrerelease_Hive_Versioning_Version_Hive_Versioning_Version_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.VersionCompareNoPrerelease(Hive.Versioning.Version%2CHive.Versioning.Version)%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>
  545. </span>
  546. <span class="small pull-right mobile-hide">
  547. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L207">View Source</a>
  548. </span>
  549. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  550. <h4 id="IPA_Utilities_Utils_VersionCompareNoPrerelease_Hive_Versioning_Version_Hive_Versioning_Version_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease(Hive.Versioning.Version,Hive.Versioning.Version)">VersionCompareNoPrerelease(Hive.Versioning.Version, Hive.Versioning.Version)</h4>
  551. <div class="markdown level1 summary"><p>Compares a pair of <see cref="!:Hive.Versioning.Version"></see>s ignoring both the prerelease and build fields.</p>
  552. </div>
  553. <div class="markdown level1 conceptual"></div>
  554. <h5 class="decalaration">Declaration</h5>
  555. <div class="codewrapper">
  556. <pre><code class="lang-csharp hljs">public static int VersionCompareNoPrerelease(Hive.Versioning.Version l, Hive.Versioning.Version r)</code></pre>
  557. </div>
  558. <h5 class="parameters">Parameters</h5>
  559. <table class="table table-bordered table-striped table-condensed">
  560. <thead>
  561. <tr>
  562. <th>Type</th>
  563. <th>Name</th>
  564. <th>Description</th>
  565. </tr>
  566. </thead>
  567. <tbody>
  568. <tr>
  569. <td><span class="xref">Hive.Versioning.Version</span></td>
  570. <td><span class="parametername">l</span></td>
  571. <td><p>the left value</p>
  572. </td>
  573. </tr>
  574. <tr>
  575. <td><span class="xref">Hive.Versioning.Version</span></td>
  576. <td><span class="parametername">r</span></td>
  577. <td><p>the right value</p>
  578. </td>
  579. </tr>
  580. </tbody>
  581. </table>
  582. <h5 class="returns">Returns</h5>
  583. <table class="table table-bordered table-striped table-condensed">
  584. <thead>
  585. <tr>
  586. <th>Type</th>
  587. <th>Description</th>
  588. </tr>
  589. </thead>
  590. <tbody>
  591. <tr>
  592. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  593. <td><p>&lt; 0 if l is less than r, 0 if they are equal in the numeric portion, or &gt; 0 if l is greater than r</p>
  594. </td>
  595. </tr>
  596. </tbody>
  597. </table>
  598. <span class="small pull-right mobile-hide">
  599. <span class="divider">|</span>
  600. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_VersionCompareNoPrerelease_SemVer_Version_SemVer_Version_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.VersionCompareNoPrerelease(SemVer.Version%2CSemVer.Version)%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>
  601. </span>
  602. <span class="small pull-right mobile-hide">
  603. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L197">View Source</a>
  604. </span>
  605. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  606. <h4 id="IPA_Utilities_Utils_VersionCompareNoPrerelease_SemVer_Version_SemVer_Version_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease(SemVer.Version,SemVer.Version)">VersionCompareNoPrerelease(Version, Version)</h4>
  607. <div class="markdown level1 summary"><p>Compares a pair of <a class="xref" href="SemVer.Version.html">Version</a>s ignoring both the prerelease and build fields.</p>
  608. </div>
  609. <div class="markdown level1 conceptual"></div>
  610. <h5 class="decalaration">Declaration</h5>
  611. <div class="codewrapper">
  612. <pre><code class="lang-csharp hljs">public static int VersionCompareNoPrerelease(Version l, Version r)</code></pre>
  613. </div>
  614. <h5 class="parameters">Parameters</h5>
  615. <table class="table table-bordered table-striped table-condensed">
  616. <thead>
  617. <tr>
  618. <th>Type</th>
  619. <th>Name</th>
  620. <th>Description</th>
  621. </tr>
  622. </thead>
  623. <tbody>
  624. <tr>
  625. <td><a class="xref" href="SemVer.Version.html">Version</a></td>
  626. <td><span class="parametername">l</span></td>
  627. <td><p>the left value</p>
  628. </td>
  629. </tr>
  630. <tr>
  631. <td><a class="xref" href="SemVer.Version.html">Version</a></td>
  632. <td><span class="parametername">r</span></td>
  633. <td><p>the right value</p>
  634. </td>
  635. </tr>
  636. </tbody>
  637. </table>
  638. <h5 class="returns">Returns</h5>
  639. <table class="table table-bordered table-striped table-condensed">
  640. <thead>
  641. <tr>
  642. <th>Type</th>
  643. <th>Description</th>
  644. </tr>
  645. </thead>
  646. <tbody>
  647. <tr>
  648. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  649. <td><p>&lt; 0 if l is less than r, 0 if they are equal in the numeric portion, or &gt; 0 if l is greater than r</p>
  650. </td>
  651. </tr>
  652. </tbody>
  653. </table>
  654. </article>
  655. </div>
  656. <div class="hidden-sm col-md-2" role="complementary">
  657. <div class="sideaffix">
  658. <div class="contribution">
  659. <ul class="nav">
  660. <li>
  661. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils%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>
  662. </li>
  663. <li>
  664. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/0ba9d3c46d55d5ae58d8887ac27b303379298b53/IPA.Loader/Utilities/Utils.cs/#L21" class="contribution-link">View Source</a>
  665. </li>
  666. </ul>
  667. </div>
  668. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  669. <h5>In This Article</h5>
  670. <div></div>
  671. </nav>
  672. </div>
  673. </div>
  674. </div>
  675. </div>
  676. <footer>
  677. <div class="grad-bottom"></div>
  678. <div class="footer">
  679. <div class="container">
  680. <span class="pull-right">
  681. <a href="#top">Back to top</a>
  682. </span>
  683. <span>Generated by <strong>DocFX</strong></span>
  684. </div>
  685. </div>
  686. </footer>
  687. </div>
  688. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  689. <script type="text/javascript" src="../styles/docfx.js"></script>
  690. <script type="text/javascript" src="../styles/main.js"></script>
  691. </body>
  692. </html>