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.

607 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.56.2.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/bsmg/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/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/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/bsmg/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/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/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/bsmg/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/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/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/bsmg/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/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L152">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>Returns <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime.now#System_DateTime_Now">Now</a> if supported, otherwise <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime.utcnow#System_DateTime_UtcNow">UtcNow</a>.</p>
  263. </div>
  264. <div class="markdown level1 conceptual"></div>
  265. <h5 class="decalaration">Declaration</h5>
  266. <div class="codewrapper">
  267. <pre><code class="lang-csharp hljs">public static DateTime CurrentTime()</code></pre>
  268. </div>
  269. <h5 class="returns">Returns</h5>
  270. <table class="table table-bordered table-striped table-condensed">
  271. <thead>
  272. <tr>
  273. <th>Type</th>
  274. <th>Description</th>
  275. </tr>
  276. </thead>
  277. <tbody>
  278. <tr>
  279. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.datetime">DateTime</a></td>
  280. <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>
  281. </td>
  282. </tr>
  283. </tbody>
  284. </table>
  285. <span class="small pull-right mobile-hide">
  286. <span class="divider">|</span>
  287. <a href="https://github.com/bsmg/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>
  288. </span>
  289. <span class="small pull-right mobile-hide">
  290. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L81">View Source</a>
  291. </span>
  292. <a id="IPA_Utilities_Utils_GetRelativePath_" data-uid="IPA.Utilities.Utils.GetRelativePath*"></a>
  293. <h4 id="IPA_Utilities_Utils_GetRelativePath_System_String_System_String_" data-uid="IPA.Utilities.Utils.GetRelativePath(System.String,System.String)">GetRelativePath(String, String)</h4>
  294. <div class="markdown level1 summary"><p>Gets a path relative to the provided folder.</p>
  295. </div>
  296. <div class="markdown level1 conceptual"></div>
  297. <h5 class="decalaration">Declaration</h5>
  298. <div class="codewrapper">
  299. <pre><code class="lang-csharp hljs">public static string GetRelativePath(string file, string folder)</code></pre>
  300. </div>
  301. <h5 class="parameters">Parameters</h5>
  302. <table class="table table-bordered table-striped table-condensed">
  303. <thead>
  304. <tr>
  305. <th>Type</th>
  306. <th>Name</th>
  307. <th>Description</th>
  308. </tr>
  309. </thead>
  310. <tbody>
  311. <tr>
  312. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  313. <td><span class="parametername">file</span></td>
  314. <td><p>the file to relativize</p>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  319. <td><span class="parametername">folder</span></td>
  320. <td><p>the source folder</p>
  321. </td>
  322. </tr>
  323. </tbody>
  324. </table>
  325. <h5 class="returns">Returns</h5>
  326. <table class="table table-bordered table-striped table-condensed">
  327. <thead>
  328. <tr>
  329. <th>Type</th>
  330. <th>Description</th>
  331. </tr>
  332. </thead>
  333. <tbody>
  334. <tr>
  335. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  336. <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>
  337. </td>
  338. </tr>
  339. </tbody>
  340. </table>
  341. <span class="small pull-right mobile-hide">
  342. <span class="divider">|</span>
  343. <a href="https://github.com/bsmg/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>
  344. </span>
  345. <span class="small pull-right mobile-hide">
  346. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L223">View Source</a>
  347. </span>
  348. <a id="IPA_Utilities_Utils_ScopeGuard_" data-uid="IPA.Utilities.Utils.ScopeGuard*"></a>
  349. <h4 id="IPA_Utilities_Utils_ScopeGuard_System_Action_" data-uid="IPA.Utilities.Utils.ScopeGuard(System.Action)">ScopeGuard(Action)</h4>
  350. <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>
  351. </div>
  352. <div class="markdown level1 conceptual"></div>
  353. <h5 class="decalaration">Declaration</h5>
  354. <div class="codewrapper">
  355. <pre><code class="lang-csharp hljs">public static Utils.ScopeGuardObject ScopeGuard(Action action)</code></pre>
  356. </div>
  357. <h5 class="parameters">Parameters</h5>
  358. <table class="table table-bordered table-striped table-condensed">
  359. <thead>
  360. <tr>
  361. <th>Type</th>
  362. <th>Name</th>
  363. <th>Description</th>
  364. </tr>
  365. </thead>
  366. <tbody>
  367. <tr>
  368. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a></td>
  369. <td><span class="parametername">action</span></td>
  370. <td><p>the <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a> to run on dispose</p>
  371. </td>
  372. </tr>
  373. </tbody>
  374. </table>
  375. <h5 class="returns">Returns</h5>
  376. <table class="table table-bordered table-striped table-condensed">
  377. <thead>
  378. <tr>
  379. <th>Type</th>
  380. <th>Description</th>
  381. </tr>
  382. </thead>
  383. <tbody>
  384. <tr>
  385. <td><a class="xref" href="IPA.Utilities.Utils.ScopeGuardObject.html">Utils.ScopeGuardObject</a></td>
  386. <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>
  387. </td>
  388. </tr>
  389. </tbody>
  390. </table>
  391. <h5 id="IPA_Utilities_Utils_ScopeGuard_System_Action__examples">Examples</h5>
  392. <pre><code>using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value));</code></pre>
  393. <span class="small pull-right mobile-hide">
  394. <span class="divider">|</span>
  395. <a href="https://github.com/bsmg/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>
  396. </span>
  397. <span class="small pull-right mobile-hide">
  398. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L25">View Source</a>
  399. </span>
  400. <a id="IPA_Utilities_Utils_StringToByteArray_" data-uid="IPA.Utilities.Utils.StringToByteArray*"></a>
  401. <h4 id="IPA_Utilities_Utils_StringToByteArray_System_String_" data-uid="IPA.Utilities.Utils.StringToByteArray(System.String)">StringToByteArray(String)</h4>
  402. <div class="markdown level1 summary"><p>Converts a hex string to a byte array.</p>
  403. </div>
  404. <div class="markdown level1 conceptual"></div>
  405. <h5 class="decalaration">Declaration</h5>
  406. <div class="codewrapper">
  407. <pre><code class="lang-csharp hljs">public static byte[] StringToByteArray(string hex)</code></pre>
  408. </div>
  409. <h5 class="parameters">Parameters</h5>
  410. <table class="table table-bordered table-striped table-condensed">
  411. <thead>
  412. <tr>
  413. <th>Type</th>
  414. <th>Name</th>
  415. <th>Description</th>
  416. </tr>
  417. </thead>
  418. <tbody>
  419. <tr>
  420. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  421. <td><span class="parametername">hex</span></td>
  422. <td><p>the hex stream</p>
  423. </td>
  424. </tr>
  425. </tbody>
  426. </table>
  427. <h5 class="returns">Returns</h5>
  428. <table class="table table-bordered table-striped table-condensed">
  429. <thead>
  430. <tr>
  431. <th>Type</th>
  432. <th>Description</th>
  433. </tr>
  434. </thead>
  435. <tbody>
  436. <tr>
  437. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  438. <td><p>the corresponding byte array</p>
  439. </td>
  440. </tr>
  441. </tbody>
  442. </table>
  443. <span class="small pull-right mobile-hide">
  444. <span class="divider">|</span>
  445. <a href="https://github.com/bsmg/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>
  446. </span>
  447. <span class="small pull-right mobile-hide">
  448. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L57">View Source</a>
  449. </span>
  450. <a id="IPA_Utilities_Utils_UnsafeCompare_" data-uid="IPA.Utilities.Utils.UnsafeCompare*"></a>
  451. <h4 id="IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___" data-uid="IPA.Utilities.Utils.UnsafeCompare(System.Byte[],System.Byte[])">UnsafeCompare(Byte[], Byte[])</h4>
  452. <div class="markdown level1 summary"><p>Uses unsafe code to compare 2 byte arrays quickly.</p>
  453. </div>
  454. <div class="markdown level1 conceptual"></div>
  455. <h5 class="decalaration">Declaration</h5>
  456. <div class="codewrapper">
  457. <pre><code class="lang-csharp hljs">public static bool UnsafeCompare(byte[] a1, byte[] a2)</code></pre>
  458. </div>
  459. <h5 class="parameters">Parameters</h5>
  460. <table class="table table-bordered table-striped table-condensed">
  461. <thead>
  462. <tr>
  463. <th>Type</th>
  464. <th>Name</th>
  465. <th>Description</th>
  466. </tr>
  467. </thead>
  468. <tbody>
  469. <tr>
  470. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  471. <td><span class="parametername">a1</span></td>
  472. <td><p>array 1</p>
  473. </td>
  474. </tr>
  475. <tr>
  476. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  477. <td><span class="parametername">a2</span></td>
  478. <td><p>array 2</p>
  479. </td>
  480. </tr>
  481. </tbody>
  482. </table>
  483. <h5 class="returns">Returns</h5>
  484. <table class="table table-bordered table-striped table-condensed">
  485. <thead>
  486. <tr>
  487. <th>Type</th>
  488. <th>Description</th>
  489. </tr>
  490. </thead>
  491. <tbody>
  492. <tr>
  493. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  494. <td><p>whether or not they are byte-for-byte equal</p>
  495. </td>
  496. </tr>
  497. </tbody>
  498. </table>
  499. <span class="small pull-right mobile-hide">
  500. <span class="divider">|</span>
  501. <a href="https://github.com/bsmg/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>
  502. </span>
  503. <span class="small pull-right mobile-hide">
  504. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L181">View Source</a>
  505. </span>
  506. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  507. <h4 id="IPA_Utilities_Utils_VersionCompareNoPrerelease_SemVer_Version_SemVer_Version_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease(SemVer.Version,SemVer.Version)">VersionCompareNoPrerelease(Version, Version)</h4>
  508. <div class="markdown level1 summary"><p>Compares a pair of <span class="xref">SemVer.Version</span>s ignoring both the prerelease and build fields.</p>
  509. </div>
  510. <div class="markdown level1 conceptual"></div>
  511. <h5 class="decalaration">Declaration</h5>
  512. <div class="codewrapper">
  513. <pre><code class="lang-csharp hljs">public static int VersionCompareNoPrerelease(Version l, Version r)</code></pre>
  514. </div>
  515. <h5 class="parameters">Parameters</h5>
  516. <table class="table table-bordered table-striped table-condensed">
  517. <thead>
  518. <tr>
  519. <th>Type</th>
  520. <th>Name</th>
  521. <th>Description</th>
  522. </tr>
  523. </thead>
  524. <tbody>
  525. <tr>
  526. <td><span class="xref">SemVer.Version</span></td>
  527. <td><span class="parametername">l</span></td>
  528. <td><p>the left value</p>
  529. </td>
  530. </tr>
  531. <tr>
  532. <td><span class="xref">SemVer.Version</span></td>
  533. <td><span class="parametername">r</span></td>
  534. <td><p>the right value</p>
  535. </td>
  536. </tr>
  537. </tbody>
  538. </table>
  539. <h5 class="returns">Returns</h5>
  540. <table class="table table-bordered table-striped table-condensed">
  541. <thead>
  542. <tr>
  543. <th>Type</th>
  544. <th>Description</th>
  545. </tr>
  546. </thead>
  547. <tbody>
  548. <tr>
  549. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  550. <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>
  551. </td>
  552. </tr>
  553. </tbody>
  554. </table>
  555. </article>
  556. </div>
  557. <div class="hidden-sm col-md-2" role="complementary">
  558. <div class="sideaffix">
  559. <div class="contribution">
  560. <ul class="nav">
  561. <li>
  562. <a href="https://github.com/bsmg/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>
  563. </li>
  564. <li>
  565. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/9814abc26d2429ad7b0b04eb35c23b7aa660018a/IPA.Loader/Utilities/Utils.cs/#L18" class="contribution-link">View Source</a>
  566. </li>
  567. </ul>
  568. </div>
  569. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  570. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  571. </nav>
  572. </div>
  573. </div>
  574. </div>
  575. </div>
  576. <footer>
  577. <div class="grad-bottom"></div>
  578. <div class="footer">
  579. <div class="container">
  580. <span class="pull-right">
  581. <a href="#top">Back to top</a>
  582. </span>
  583. <span>Generated by <strong>DocFX</strong></span>
  584. </div>
  585. </div>
  586. </footer>
  587. </div>
  588. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  589. <script type="text/javascript" src="../styles/docfx.js"></script>
  590. <script type="text/javascript" src="../styles/main.js"></script>
  591. </body>
  592. </html>