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.

732 lines
36 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.58.9.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. <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/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L161">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/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L44">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/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L112">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/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L168">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_Deconstruct__2_System_Collections_Generic_KeyValuePair___0___1____0____1__.md&amp;value=---%0Auid%3A%20IPA.Utilities.Utils.Deconstruct%60%602(System.Collections.Generic.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>
  288. </span>
  289. <span class="small pull-right mobile-hide">
  290. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L268">View Source</a>
  291. </span>
  292. <a id="IPA_Utilities_Utils_Deconstruct_" data-uid="IPA.Utilities.Utils.Deconstruct*"></a>
  293. <h4 id="IPA_Utilities_Utils_Deconstruct__2_System_Collections_Generic_KeyValuePair___0___1____0____1__" data-uid="IPA.Utilities.Utils.Deconstruct``2(System.Collections.Generic.KeyValuePair{``0,``1},``0@,``1@)">Deconstruct&lt;TKey, TValue&gt;(KeyValuePair&lt;TKey, TValue&gt;, out TKey, out TValue)</h4>
  294. <div class="markdown level1 summary"><p>Deconstructs a <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.collections.generic.keyvaluepair-2">KeyValuePair&lt;TKey,TValue&gt;</a> as its key and value.</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 void Deconstruct&lt;TKey, TValue&gt;(this KeyValuePair&lt;TKey, TValue&gt; kvp, out TKey key, out TValue value)</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.collections.generic.keyvaluepair-2">KeyValuePair</a>&lt;TKey, TValue&gt;</td>
  313. <td><span class="parametername">kvp</span></td>
  314. <td><p>The <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.collections.generic.keyvaluepair-2">KeyValuePair&lt;TKey,TValue&gt;</a> to deconstruct.</p>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td><span class="xref">TKey</span></td>
  319. <td><span class="parametername">key</span></td>
  320. <td><p>The key in <code data-dev-comment-type="paramref" class="paramref">kvp</code>.</p>
  321. </td>
  322. </tr>
  323. <tr>
  324. <td><span class="xref">TValue</span></td>
  325. <td><span class="parametername">value</span></td>
  326. <td><p>The value in <code data-dev-comment-type="paramref" class="paramref">kvp</code>.</p>
  327. </td>
  328. </tr>
  329. </tbody>
  330. </table>
  331. <h5 class="typeParameters">Type Parameters</h5>
  332. <table class="table table-bordered table-striped table-condensed">
  333. <thead>
  334. <tr>
  335. <th>Name</th>
  336. <th>Description</th>
  337. </tr>
  338. </thead>
  339. <tbody>
  340. <tr>
  341. <td><span class="parametername">TKey</span></td>
  342. <td><p>The type of the key.</p>
  343. </td>
  344. </tr>
  345. <tr>
  346. <td><span class="parametername">TValue</span></td>
  347. <td><p>The type of the value.</p>
  348. </td>
  349. </tr>
  350. </tbody>
  351. </table>
  352. <span class="small pull-right mobile-hide">
  353. <span class="divider">|</span>
  354. <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>
  355. </span>
  356. <span class="small pull-right mobile-hide">
  357. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L88">View Source</a>
  358. </span>
  359. <a id="IPA_Utilities_Utils_GetRelativePath_" data-uid="IPA.Utilities.Utils.GetRelativePath*"></a>
  360. <h4 id="IPA_Utilities_Utils_GetRelativePath_System_String_System_String_" data-uid="IPA.Utilities.Utils.GetRelativePath(System.String,System.String)">GetRelativePath(String, String)</h4>
  361. <div class="markdown level1 summary"><p>Gets a path relative to the provided folder.</p>
  362. </div>
  363. <div class="markdown level1 conceptual"></div>
  364. <h5 class="decalaration">Declaration</h5>
  365. <div class="codewrapper">
  366. <pre><code class="lang-csharp hljs">public static string GetRelativePath(string file, string folder)</code></pre>
  367. </div>
  368. <h5 class="parameters">Parameters</h5>
  369. <table class="table table-bordered table-striped table-condensed">
  370. <thead>
  371. <tr>
  372. <th>Type</th>
  373. <th>Name</th>
  374. <th>Description</th>
  375. </tr>
  376. </thead>
  377. <tbody>
  378. <tr>
  379. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  380. <td><span class="parametername">file</span></td>
  381. <td><p>the file to relativize</p>
  382. </td>
  383. </tr>
  384. <tr>
  385. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  386. <td><span class="parametername">folder</span></td>
  387. <td><p>the source folder</p>
  388. </td>
  389. </tr>
  390. </tbody>
  391. </table>
  392. <h5 class="returns">Returns</h5>
  393. <table class="table table-bordered table-striped table-condensed">
  394. <thead>
  395. <tr>
  396. <th>Type</th>
  397. <th>Description</th>
  398. </tr>
  399. </thead>
  400. <tbody>
  401. <tr>
  402. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  403. <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>
  404. </td>
  405. </tr>
  406. </tbody>
  407. </table>
  408. <span class="small pull-right mobile-hide">
  409. <span class="divider">|</span>
  410. <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>
  411. </span>
  412. <span class="small pull-right mobile-hide">
  413. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L257">View Source</a>
  414. </span>
  415. <a id="IPA_Utilities_Utils_ScopeGuard_" data-uid="IPA.Utilities.Utils.ScopeGuard*"></a>
  416. <h4 id="IPA_Utilities_Utils_ScopeGuard_System_Action_" data-uid="IPA.Utilities.Utils.ScopeGuard(System.Action)">ScopeGuard(Action)</h4>
  417. <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>
  418. </div>
  419. <div class="markdown level1 conceptual"></div>
  420. <h5 class="decalaration">Declaration</h5>
  421. <div class="codewrapper">
  422. <pre><code class="lang-csharp hljs">public static Utils.ScopeGuardObject ScopeGuard(Action action)</code></pre>
  423. </div>
  424. <h5 class="parameters">Parameters</h5>
  425. <table class="table table-bordered table-striped table-condensed">
  426. <thead>
  427. <tr>
  428. <th>Type</th>
  429. <th>Name</th>
  430. <th>Description</th>
  431. </tr>
  432. </thead>
  433. <tbody>
  434. <tr>
  435. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a></td>
  436. <td><span class="parametername">action</span></td>
  437. <td><p>the <a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a> to run on dispose</p>
  438. </td>
  439. </tr>
  440. </tbody>
  441. </table>
  442. <h5 class="returns">Returns</h5>
  443. <table class="table table-bordered table-striped table-condensed">
  444. <thead>
  445. <tr>
  446. <th>Type</th>
  447. <th>Description</th>
  448. </tr>
  449. </thead>
  450. <tbody>
  451. <tr>
  452. <td><a class="xref" href="IPA.Utilities.Utils.ScopeGuardObject.html">Utils.ScopeGuardObject</a></td>
  453. <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>
  454. </td>
  455. </tr>
  456. </tbody>
  457. </table>
  458. <h5 id="IPA_Utilities_Utils_ScopeGuard_System_Action__examples">Examples</h5>
  459. <pre><code>using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value));</code></pre>
  460. <span class="small pull-right mobile-hide">
  461. <span class="divider">|</span>
  462. <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>
  463. </span>
  464. <span class="small pull-right mobile-hide">
  465. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L28">View Source</a>
  466. </span>
  467. <a id="IPA_Utilities_Utils_StringToByteArray_" data-uid="IPA.Utilities.Utils.StringToByteArray*"></a>
  468. <h4 id="IPA_Utilities_Utils_StringToByteArray_System_String_" data-uid="IPA.Utilities.Utils.StringToByteArray(System.String)">StringToByteArray(String)</h4>
  469. <div class="markdown level1 summary"><p>Converts a hex string to a byte array.</p>
  470. </div>
  471. <div class="markdown level1 conceptual"></div>
  472. <h5 class="decalaration">Declaration</h5>
  473. <div class="codewrapper">
  474. <pre><code class="lang-csharp hljs">public static byte[] StringToByteArray(string hex)</code></pre>
  475. </div>
  476. <h5 class="parameters">Parameters</h5>
  477. <table class="table table-bordered table-striped table-condensed">
  478. <thead>
  479. <tr>
  480. <th>Type</th>
  481. <th>Name</th>
  482. <th>Description</th>
  483. </tr>
  484. </thead>
  485. <tbody>
  486. <tr>
  487. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  488. <td><span class="parametername">hex</span></td>
  489. <td><p>the hex stream</p>
  490. </td>
  491. </tr>
  492. </tbody>
  493. </table>
  494. <h5 class="returns">Returns</h5>
  495. <table class="table table-bordered table-striped table-condensed">
  496. <thead>
  497. <tr>
  498. <th>Type</th>
  499. <th>Description</th>
  500. </tr>
  501. </thead>
  502. <tbody>
  503. <tr>
  504. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  505. <td><p>the corresponding byte array</p>
  506. </td>
  507. </tr>
  508. </tbody>
  509. </table>
  510. <span class="small pull-right mobile-hide">
  511. <span class="divider">|</span>
  512. <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>
  513. </span>
  514. <span class="small pull-right mobile-hide">
  515. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L64">View Source</a>
  516. </span>
  517. <a id="IPA_Utilities_Utils_UnsafeCompare_" data-uid="IPA.Utilities.Utils.UnsafeCompare*"></a>
  518. <h4 id="IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___" data-uid="IPA.Utilities.Utils.UnsafeCompare(System.Byte[],System.Byte[])">UnsafeCompare(Byte[], Byte[])</h4>
  519. <div class="markdown level1 summary"><p>Uses unsafe code to compare 2 byte arrays quickly.</p>
  520. </div>
  521. <div class="markdown level1 conceptual"></div>
  522. <h5 class="decalaration">Declaration</h5>
  523. <div class="codewrapper">
  524. <pre><code class="lang-csharp hljs">public static bool UnsafeCompare(byte[] a1, byte[] a2)</code></pre>
  525. </div>
  526. <h5 class="parameters">Parameters</h5>
  527. <table class="table table-bordered table-striped table-condensed">
  528. <thead>
  529. <tr>
  530. <th>Type</th>
  531. <th>Name</th>
  532. <th>Description</th>
  533. </tr>
  534. </thead>
  535. <tbody>
  536. <tr>
  537. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  538. <td><span class="parametername">a1</span></td>
  539. <td><p>array 1</p>
  540. </td>
  541. </tr>
  542. <tr>
  543. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.byte">Byte</a>[]</td>
  544. <td><span class="parametername">a2</span></td>
  545. <td><p>array 2</p>
  546. </td>
  547. </tr>
  548. </tbody>
  549. </table>
  550. <h5 class="returns">Returns</h5>
  551. <table class="table table-bordered table-striped table-condensed">
  552. <thead>
  553. <tr>
  554. <th>Type</th>
  555. <th>Description</th>
  556. </tr>
  557. </thead>
  558. <tbody>
  559. <tr>
  560. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
  561. <td><p>whether or not they are byte-for-byte equal</p>
  562. </td>
  563. </tr>
  564. </tbody>
  565. </table>
  566. <span class="small pull-right mobile-hide">
  567. <span class="divider">|</span>
  568. <a href="https://github.com/bsmg/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>
  569. </span>
  570. <span class="small pull-right mobile-hide">
  571. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L207">View Source</a>
  572. </span>
  573. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  574. <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>
  575. <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>
  576. </div>
  577. <div class="markdown level1 conceptual"></div>
  578. <h5 class="decalaration">Declaration</h5>
  579. <div class="codewrapper">
  580. <pre><code class="lang-csharp hljs">public static int VersionCompareNoPrerelease(Hive.Versioning.Version l, Hive.Versioning.Version r)</code></pre>
  581. </div>
  582. <h5 class="parameters">Parameters</h5>
  583. <table class="table table-bordered table-striped table-condensed">
  584. <thead>
  585. <tr>
  586. <th>Type</th>
  587. <th>Name</th>
  588. <th>Description</th>
  589. </tr>
  590. </thead>
  591. <tbody>
  592. <tr>
  593. <td><span class="xref">Hive.Versioning.Version</span></td>
  594. <td><span class="parametername">l</span></td>
  595. <td><p>the left value</p>
  596. </td>
  597. </tr>
  598. <tr>
  599. <td><span class="xref">Hive.Versioning.Version</span></td>
  600. <td><span class="parametername">r</span></td>
  601. <td><p>the right value</p>
  602. </td>
  603. </tr>
  604. </tbody>
  605. </table>
  606. <h5 class="returns">Returns</h5>
  607. <table class="table table-bordered table-striped table-condensed">
  608. <thead>
  609. <tr>
  610. <th>Type</th>
  611. <th>Description</th>
  612. </tr>
  613. </thead>
  614. <tbody>
  615. <tr>
  616. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  617. <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>
  618. </td>
  619. </tr>
  620. </tbody>
  621. </table>
  622. <span class="small pull-right mobile-hide">
  623. <span class="divider">|</span>
  624. <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>
  625. </span>
  626. <span class="small pull-right mobile-hide">
  627. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L197">View Source</a>
  628. </span>
  629. <a id="IPA_Utilities_Utils_VersionCompareNoPrerelease_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease*"></a>
  630. <h4 id="IPA_Utilities_Utils_VersionCompareNoPrerelease_SemVer_Version_SemVer_Version_" data-uid="IPA.Utilities.Utils.VersionCompareNoPrerelease(SemVer.Version,SemVer.Version)">VersionCompareNoPrerelease(Version, Version)</h4>
  631. <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>
  632. </div>
  633. <div class="markdown level1 conceptual"></div>
  634. <h5 class="decalaration">Declaration</h5>
  635. <div class="codewrapper">
  636. <pre><code class="lang-csharp hljs">[Obsolete(&quot;Use Hive.Versioning.Version overload instead.&quot;)]
  637. public static int VersionCompareNoPrerelease(Version l, Version r)</code></pre>
  638. </div>
  639. <h5 class="parameters">Parameters</h5>
  640. <table class="table table-bordered table-striped table-condensed">
  641. <thead>
  642. <tr>
  643. <th>Type</th>
  644. <th>Name</th>
  645. <th>Description</th>
  646. </tr>
  647. </thead>
  648. <tbody>
  649. <tr>
  650. <td><a class="xref" href="SemVer.Version.html">Version</a></td>
  651. <td><span class="parametername">l</span></td>
  652. <td><p>the left value</p>
  653. </td>
  654. </tr>
  655. <tr>
  656. <td><a class="xref" href="SemVer.Version.html">Version</a></td>
  657. <td><span class="parametername">r</span></td>
  658. <td><p>the right value</p>
  659. </td>
  660. </tr>
  661. </tbody>
  662. </table>
  663. <h5 class="returns">Returns</h5>
  664. <table class="table table-bordered table-striped table-condensed">
  665. <thead>
  666. <tr>
  667. <th>Type</th>
  668. <th>Description</th>
  669. </tr>
  670. </thead>
  671. <tbody>
  672. <tr>
  673. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
  674. <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>
  675. </td>
  676. </tr>
  677. </tbody>
  678. </table>
  679. </article>
  680. </div>
  681. <div class="hidden-sm col-md-2" role="complementary">
  682. <div class="sideaffix">
  683. <div class="contribution">
  684. <ul class="nav">
  685. <li>
  686. <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>
  687. </li>
  688. <li>
  689. <a href="https://github.com/bsmg/BeatSaber-IPA-Reloaded/blob/4a92815e7273704523a5a101f52e587ba28cbe99/IPA.Loader/Utilities/Utils.cs/#L21" class="contribution-link">View Source</a>
  690. </li>
  691. </ul>
  692. </div>
  693. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  694. <h5>In This Article</h5>
  695. <div></div>
  696. </nav>
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. <footer>
  702. <div class="grad-bottom"></div>
  703. <div class="footer">
  704. <div class="container">
  705. <span class="pull-right">
  706. <a href="#top">Back to top</a>
  707. </span>
  708. <span>Generated by <strong>DocFX</strong></span>
  709. </div>
  710. </div>
  711. </footer>
  712. </div>
  713. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  714. <script type="text/javascript" src="../styles/docfx.js"></script>
  715. <script type="text/javascript" src="../styles/main.js"></script>
  716. </body>
  717. </html>