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.

609 lines
30 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.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 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"></div>
  59. <div class="sr-items">
  60. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  61. </div>
  62. <ul id="pagination"></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. <div class="inheritedMembers">
  86. <h5>Inherited Members</h5>
  87. <div>
  88. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.tostring#System_Object_ToString">Object.ToString()</a>
  89. </div>
  90. <div>
  91. <a class="xref" href="https://docs.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://docs.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://docs.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://docs.microsoft.com/dotnet/api/system.object.gethashcode#System_Object_GetHashCode">Object.GetHashCode()</a>
  101. </div>
  102. <div>
  103. <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gettype#System_Object_GetType">Object.GetType()</a>
  104. </div>
  105. <div>
  106. <a class="xref" href="https://docs.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_Utils_syntax">Syntax</h5>
  112. <div class="codewrapper">
  113. <pre><code class="lang-csharp hljs">public static class Utils</code></pre>
  114. </div>
  115. <h3 id="properties">Properties
  116. </h3>
  117. <span class="small pull-right mobile-hide">
  118. <span class="divider">|</span>
  119. <a href="https://github.com/beat-saber-modding-group/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>
  120. </span>
  121. <span class="small pull-right mobile-hide">
  122. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L145">View Source</a>
  123. </span>
  124. <a id="IPA_Utilities_Utils_CanUseDateTimeNowSafely_" data-uid="IPA.Utilities.Utils.CanUseDateTimeNowSafely*"></a>
  125. <h4 id="IPA_Utilities_Utils_CanUseDateTimeNowSafely" data-uid="IPA.Utilities.Utils.CanUseDateTimeNowSafely">CanUseDateTimeNowSafely</h4>
  126. <div class="markdown level1 summary"><p>Whether you can safely use <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime.now#System_DateTime_Now">Now</a> without Mono throwing a fit.</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 bool CanUseDateTimeNowSafely { get; }</code></pre>
  132. </div>
  133. <h5 class="propertyValue">Property Value</h5>
  134. <table class="table table-bordered table-striped table-condensed">
  135. <thead>
  136. <tr>
  137. <th>Type</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.boolean">Boolean</a></td>
  144. <td><p><span class="xref">true</span> if you can use <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime.now#System_DateTime_Now">Now</a> safely, <span class="xref">false</span> otherwise</p>
  145. </td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. <h3 id="methods">Methods
  150. </h3>
  151. <span class="small pull-right mobile-hide">
  152. <span class="divider">|</span>
  153. <a href="https://github.com/beat-saber-modding-group/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>
  154. </span>
  155. <span class="small pull-right mobile-hide">
  156. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L39">View Source</a>
  157. </span>
  158. <a id="IPA_Utilities_Utils_ByteArrayToString_" data-uid="IPA.Utilities.Utils.ByteArrayToString*"></a>
  159. <h4 id="IPA_Utilities_Utils_ByteArrayToString_System_Byte___" data-uid="IPA.Utilities.Utils.ByteArrayToString(System.Byte[])">ByteArrayToString(Byte[])</h4>
  160. <div class="markdown level1 summary"><p>Converts a byte array to a hex string.</p>
  161. </div>
  162. <div class="markdown level1 conceptual"></div>
  163. <h5 class="decalaration">Declaration</h5>
  164. <div class="codewrapper">
  165. <pre><code class="lang-csharp hljs">public static string ByteArrayToString(byte[] ba)</code></pre>
  166. </div>
  167. <h5 class="parameters">Parameters</h5>
  168. <table class="table table-bordered table-striped table-condensed">
  169. <thead>
  170. <tr>
  171. <th>Type</th>
  172. <th>Name</th>
  173. <th>Description</th>
  174. </tr>
  175. </thead>
  176. <tbody>
  177. <tr>
  178. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  179. <td><span class="parametername">ba</span></td>
  180. <td><p>the byte array</p>
  181. </td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. <h5 class="returns">Returns</h5>
  186. <table class="table table-bordered table-striped table-condensed">
  187. <thead>
  188. <tr>
  189. <th>Type</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><p>the hex form of the array</p>
  197. </td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <span class="small pull-right mobile-hide">
  202. <span class="divider">|</span>
  203. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_CopyAll_System_IO_DirectoryInfo_System_IO_DirectoryInfo_System_String_System_Func_System_Exception_System_IO_FileInfo_System_Boolean__.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.CopyAll(System.IO.DirectoryInfo%2CSystem.IO.DirectoryInfo%2CSystem.String%2CSystem.Func%7BSystem.Exception%2CSystem.IO.FileInfo%2CSystem.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>
  204. </span>
  205. <span class="small pull-right mobile-hide">
  206. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L100">View Source</a>
  207. </span>
  208. <a id="IPA_Utilities_Utils_CopyAll_" data-uid="IPA.Utilities.Utils.CopyAll*"></a>
  209. <h4 id="IPA_Utilities_Utils_CopyAll_System_IO_DirectoryInfo_System_IO_DirectoryInfo_System_String_System_Func_System_Exception_System_IO_FileInfo_System_Boolean__" data-uid="IPA.Utilities.Utils.CopyAll(System.IO.DirectoryInfo,System.IO.DirectoryInfo,System.String,System.Func{System.Exception,System.IO.FileInfo,System.Boolean})">CopyAll(DirectoryInfo, DirectoryInfo, String, Func&lt;Exception, FileInfo, Boolean&gt;)</h4>
  210. <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>
  211. </div>
  212. <div class="markdown level1 conceptual"></div>
  213. <h5 class="decalaration">Declaration</h5>
  214. <div class="codewrapper">
  215. <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>
  216. </div>
  217. <h5 class="parameters">Parameters</h5>
  218. <table class="table table-bordered table-striped table-condensed">
  219. <thead>
  220. <tr>
  221. <th>Type</th>
  222. <th>Name</th>
  223. <th>Description</th>
  224. </tr>
  225. </thead>
  226. <tbody>
  227. <tr>
  228. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.io.directoryinfo">DirectoryInfo</a></td>
  229. <td><span class="parametername">source</span></td>
  230. <td><p>the source directory</p>
  231. </td>
  232. </tr>
  233. <tr>
  234. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.io.directoryinfo">DirectoryInfo</a></td>
  235. <td><span class="parametername">target</span></td>
  236. <td><p>the destination directory</p>
  237. </td>
  238. </tr>
  239. <tr>
  240. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  241. <td><span class="parametername">appendFileName</span></td>
  242. <td><p>the filename of the file to append together</p>
  243. </td>
  244. </tr>
  245. <tr>
  246. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.exception">Exception</a>, <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.io.fileinfo">FileInfo</a>, <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a>&gt;</td>
  247. <td><span class="parametername">onCopyException</span></td>
  248. <td><p>a delegate called when there is an error copying. Return true to keep going.</p>
  249. </td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <span class="small pull-right mobile-hide">
  254. <span class="divider">|</span>
  255. <a href="https://github.com/beat-saber-modding-group/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>
  256. </span>
  257. <span class="small pull-right mobile-hide">
  258. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L155">View Source</a>
  259. </span>
  260. <a id="IPA_Utilities_Utils_CurrentTime_" data-uid="IPA.Utilities.Utils.CurrentTime*"></a>
  261. <h4 id="IPA_Utilities_Utils_CurrentTime" data-uid="IPA.Utilities.Utils.CurrentTime">CurrentTime()</h4>
  262. <div class="markdown level1 summary"><p>Gets the current <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime">DateTime</a> if supported, otherwise, if Mono would throw a fit,
  263. returns <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime.minvalue">MinValue</a> plus some value, such that each time it is called
  264. the value will be greater than the previous result. Not suitable for timing.</p>
  265. </div>
  266. <div class="markdown level1 conceptual"></div>
  267. <h5 class="decalaration">Declaration</h5>
  268. <div class="codewrapper">
  269. <pre><code class="lang-csharp hljs">public static DateTime CurrentTime()</code></pre>
  270. </div>
  271. <h5 class="returns">Returns</h5>
  272. <table class="table table-bordered table-striped table-condensed">
  273. <thead>
  274. <tr>
  275. <th>Type</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.datetime">DateTime</a></td>
  282. <td><p>the current <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime">DateTime</a> if supported, otherwise some indeterminant increasing value.</p>
  283. </td>
  284. </tr>
  285. </tbody>
  286. </table>
  287. <span class="small pull-right mobile-hide">
  288. <span class="divider">|</span>
  289. <a href="https://github.com/beat-saber-modding-group/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>
  290. </span>
  291. <span class="small pull-right mobile-hide">
  292. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L81">View Source</a>
  293. </span>
  294. <a id="IPA_Utilities_Utils_GetRelativePath_" data-uid="IPA.Utilities.Utils.GetRelativePath*"></a>
  295. <h4 id="IPA_Utilities_Utils_GetRelativePath_System_String_System_String_" data-uid="IPA.Utilities.Utils.GetRelativePath(System.String,System.String)">GetRelativePath(String, String)</h4>
  296. <div class="markdown level1 summary"><p>Gets a path relative to the provided folder.</p>
  297. </div>
  298. <div class="markdown level1 conceptual"></div>
  299. <h5 class="decalaration">Declaration</h5>
  300. <div class="codewrapper">
  301. <pre><code class="lang-csharp hljs">public static string GetRelativePath(string file, string folder)</code></pre>
  302. </div>
  303. <h5 class="parameters">Parameters</h5>
  304. <table class="table table-bordered table-striped table-condensed">
  305. <thead>
  306. <tr>
  307. <th>Type</th>
  308. <th>Name</th>
  309. <th>Description</th>
  310. </tr>
  311. </thead>
  312. <tbody>
  313. <tr>
  314. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  315. <td><span class="parametername">file</span></td>
  316. <td><p>the file to relativize</p>
  317. </td>
  318. </tr>
  319. <tr>
  320. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  321. <td><span class="parametername">folder</span></td>
  322. <td><p>the source folder</p>
  323. </td>
  324. </tr>
  325. </tbody>
  326. </table>
  327. <h5 class="returns">Returns</h5>
  328. <table class="table table-bordered table-striped table-condensed">
  329. <thead>
  330. <tr>
  331. <th>Type</th>
  332. <th>Description</th>
  333. </tr>
  334. </thead>
  335. <tbody>
  336. <tr>
  337. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  338. <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>
  339. </td>
  340. </tr>
  341. </tbody>
  342. </table>
  343. <span class="small pull-right mobile-hide">
  344. <span class="divider">|</span>
  345. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_Utils_ScopeGuard_System_Action_.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.ScopeGuard(System.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>
  346. </span>
  347. <span class="small pull-right mobile-hide">
  348. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L226">View Source</a>
  349. </span>
  350. <a id="IPA_Utilities_Utils_ScopeGuard_" data-uid="IPA.Utilities.Utils.ScopeGuard*"></a>
  351. <h4 id="IPA_Utilities_Utils_ScopeGuard_System_Action_" data-uid="IPA.Utilities.Utils.ScopeGuard(System.Action)">ScopeGuard(Action)</h4>
  352. <div class="markdown level1 summary"><p>Creates a scope guard for a given <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a>.</p>
  353. </div>
  354. <div class="markdown level1 conceptual"></div>
  355. <h5 class="decalaration">Declaration</h5>
  356. <div class="codewrapper">
  357. <pre><code class="lang-csharp hljs">public static Utils.ScopeGuardObject ScopeGuard(Action action)</code></pre>
  358. </div>
  359. <h5 class="parameters">Parameters</h5>
  360. <table class="table table-bordered table-striped table-condensed">
  361. <thead>
  362. <tr>
  363. <th>Type</th>
  364. <th>Name</th>
  365. <th>Description</th>
  366. </tr>
  367. </thead>
  368. <tbody>
  369. <tr>
  370. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a></td>
  371. <td><span class="parametername">action</span></td>
  372. <td><p>the <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a> to run on dispose</p>
  373. </td>
  374. </tr>
  375. </tbody>
  376. </table>
  377. <h5 class="returns">Returns</h5>
  378. <table class="table table-bordered table-striped table-condensed">
  379. <thead>
  380. <tr>
  381. <th>Type</th>
  382. <th>Description</th>
  383. </tr>
  384. </thead>
  385. <tbody>
  386. <tr>
  387. <td><a class="xref" href="IPA.Utilities.Utils.ScopeGuardObject.html">Utils.ScopeGuardObject</a></td>
  388. <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>
  389. </td>
  390. </tr>
  391. </tbody>
  392. </table>
  393. <h5 id="IPA_Utilities_Utils_ScopeGuard_System_Action__examples">Examples</h5>
  394. <pre><code>using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value));</code></pre>
  395. <span class="small pull-right mobile-hide">
  396. <span class="divider">|</span>
  397. <a href="https://github.com/beat-saber-modding-group/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>
  398. </span>
  399. <span class="small pull-right mobile-hide">
  400. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L25">View Source</a>
  401. </span>
  402. <a id="IPA_Utilities_Utils_StringToByteArray_" data-uid="IPA.Utilities.Utils.StringToByteArray*"></a>
  403. <h4 id="IPA_Utilities_Utils_StringToByteArray_System_String_" data-uid="IPA.Utilities.Utils.StringToByteArray(System.String)">StringToByteArray(String)</h4>
  404. <div class="markdown level1 summary"><p>Converts a hex string to a byte array.</p>
  405. </div>
  406. <div class="markdown level1 conceptual"></div>
  407. <h5 class="decalaration">Declaration</h5>
  408. <div class="codewrapper">
  409. <pre><code class="lang-csharp hljs">public static byte[] StringToByteArray(string hex)</code></pre>
  410. </div>
  411. <h5 class="parameters">Parameters</h5>
  412. <table class="table table-bordered table-striped table-condensed">
  413. <thead>
  414. <tr>
  415. <th>Type</th>
  416. <th>Name</th>
  417. <th>Description</th>
  418. </tr>
  419. </thead>
  420. <tbody>
  421. <tr>
  422. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  423. <td><span class="parametername">hex</span></td>
  424. <td><p>the hex stream</p>
  425. </td>
  426. </tr>
  427. </tbody>
  428. </table>
  429. <h5 class="returns">Returns</h5>
  430. <table class="table table-bordered table-striped table-condensed">
  431. <thead>
  432. <tr>
  433. <th>Type</th>
  434. <th>Description</th>
  435. </tr>
  436. </thead>
  437. <tbody>
  438. <tr>
  439. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  440. <td><p>the corresponding byte array</p>
  441. </td>
  442. </tr>
  443. </tbody>
  444. </table>
  445. <span class="small pull-right mobile-hide">
  446. <span class="divider">|</span>
  447. <a href="https://github.com/beat-saber-modding-group/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>
  448. </span>
  449. <span class="small pull-right mobile-hide">
  450. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L57">View Source</a>
  451. </span>
  452. <a id="IPA_Utilities_Utils_UnsafeCompare_" data-uid="IPA.Utilities.Utils.UnsafeCompare*"></a>
  453. <h4 id="IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___" data-uid="IPA.Utilities.Utils.UnsafeCompare(System.Byte[],System.Byte[])">UnsafeCompare(Byte[], Byte[])</h4>
  454. <div class="markdown level1 summary"><p>Uses unsafe code to compare 2 byte arrays quickly.</p>
  455. </div>
  456. <div class="markdown level1 conceptual"></div>
  457. <h5 class="decalaration">Declaration</h5>
  458. <div class="codewrapper">
  459. <pre><code class="lang-csharp hljs">public static bool UnsafeCompare(byte[] a1, byte[] a2)</code></pre>
  460. </div>
  461. <h5 class="parameters">Parameters</h5>
  462. <table class="table table-bordered table-striped table-condensed">
  463. <thead>
  464. <tr>
  465. <th>Type</th>
  466. <th>Name</th>
  467. <th>Description</th>
  468. </tr>
  469. </thead>
  470. <tbody>
  471. <tr>
  472. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  473. <td><span class="parametername">a1</span></td>
  474. <td><p>array 1</p>
  475. </td>
  476. </tr>
  477. <tr>
  478. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  479. <td><span class="parametername">a2</span></td>
  480. <td><p>array 2</p>
  481. </td>
  482. </tr>
  483. </tbody>
  484. </table>
  485. <h5 class="returns">Returns</h5>
  486. <table class="table table-bordered table-striped table-condensed">
  487. <thead>
  488. <tr>
  489. <th>Type</th>
  490. <th>Description</th>
  491. </tr>
  492. </thead>
  493. <tbody>
  494. <tr>
  495. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  496. <td><p>whether or not they are byte-for-byte equal</p>
  497. </td>
  498. </tr>
  499. </tbody>
  500. </table>
  501. <span class="small pull-right mobile-hide">
  502. <span class="divider">|</span>
  503. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_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>
  504. </span>
  505. <span class="small pull-right mobile-hide">
  506. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L184">View Source</a>
  507. </span>
  508. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  509. <h4 id="IPA_Utilities_Utils_VersionCompareNoPrerelease_SemVer_Version_SemVer_Version_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease(SemVer.Version,SemVer.Version)">VersionCompareNoPrerelease(SemVer.Version, SemVer.Version)</h4>
  510. <div class="markdown level1 summary"><p>Compares a pair of <see cref="!:SemVer.Version"></see>s ignoring both the prerelease and build fields.</p>
  511. </div>
  512. <div class="markdown level1 conceptual"></div>
  513. <h5 class="decalaration">Declaration</h5>
  514. <div class="codewrapper">
  515. <pre><code class="lang-csharp hljs">public static int VersionCompareNoPrerelease(SemVer.Version l, SemVer.Version r)</code></pre>
  516. </div>
  517. <h5 class="parameters">Parameters</h5>
  518. <table class="table table-bordered table-striped table-condensed">
  519. <thead>
  520. <tr>
  521. <th>Type</th>
  522. <th>Name</th>
  523. <th>Description</th>
  524. </tr>
  525. </thead>
  526. <tbody>
  527. <tr>
  528. <td><span class="xref">SemVer.Version</span></td>
  529. <td><span class="parametername">l</span></td>
  530. <td><p>the left value</p>
  531. </td>
  532. </tr>
  533. <tr>
  534. <td><span class="xref">SemVer.Version</span></td>
  535. <td><span class="parametername">r</span></td>
  536. <td><p>the right value</p>
  537. </td>
  538. </tr>
  539. </tbody>
  540. </table>
  541. <h5 class="returns">Returns</h5>
  542. <table class="table table-bordered table-striped table-condensed">
  543. <thead>
  544. <tr>
  545. <th>Type</th>
  546. <th>Description</th>
  547. </tr>
  548. </thead>
  549. <tbody>
  550. <tr>
  551. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  552. <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>
  553. </td>
  554. </tr>
  555. </tbody>
  556. </table>
  557. </article>
  558. </div>
  559. <div class="hidden-sm col-md-2" role="complementary">
  560. <div class="sideaffix">
  561. <div class="contribution">
  562. <ul class="nav">
  563. <li>
  564. <a href="https://github.com/beat-saber-modding-group/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>
  565. </li>
  566. <li>
  567. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/24579ec8d039fcb7b230c94cc53920543f9c79c9/IPA.Loader/Utilities/Utils.cs/#L18" class="contribution-link">View Source</a>
  568. </li>
  569. </ul>
  570. </div>
  571. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  572. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  573. </nav>
  574. </div>
  575. </div>
  576. </div>
  577. </div>
  578. <footer>
  579. <div class="grad-bottom"></div>
  580. <div class="footer">
  581. <div class="container">
  582. <span class="pull-right">
  583. <a href="#top">Back to top</a>
  584. </span>
  585. <span>Generated by <strong>DocFX</strong></span>
  586. </div>
  587. </div>
  588. </footer>
  589. </div>
  590. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  591. <script type="text/javascript" src="../styles/docfx.js"></script>
  592. <script type="text/javascript" src="../styles/main.js"></script>
  593. </body>
  594. </html>