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.

421 lines
18 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.42.4.0">
  13. <link rel="shortcut icon" href="../favicon.ico">
  14. <link rel="stylesheet" href="../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../styles/docfx.css">
  16. <link rel="stylesheet" href="../styles/main.css">
  17. <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
  18. <meta property="docfx:navrel" content="../toc.html">
  19. <meta property="docfx:tocrel" content="toc.html">
  20. </head> <body data-spy="scroll" data-target="#affix" data-offset="120">
  21. <div id="wrapper">
  22. <header>
  23. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  24. <div class="container">
  25. <div class="navbar-header">
  26. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  27. <span class="sr-only">Toggle navigation</span>
  28. <span class="icon-bar"></span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. </button>
  32. <a class="navbar-brand" href="../index.html">
  33. <img id="logo" class="svg" src="../logo.svg" alt="">
  34. </a>
  35. </div>
  36. <div class="collapse navbar-collapse" id="navbar">
  37. <form class="navbar-form navbar-right" role="search" id="search">
  38. <div class="form-group">
  39. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  40. </div>
  41. </form>
  42. </div>
  43. </div>
  44. </nav>
  45. <div class="subnav navbar navbar-default">
  46. <div class="container hide-when-search" id="breadcrumb">
  47. <ul class="breadcrumb">
  48. <li></li>
  49. </ul>
  50. </div>
  51. </div>
  52. </header>
  53. <div role="main" class="container body-content hide-when-search">
  54. <div class="sidenav hide-when-search">
  55. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  56. <div class="sidetoggle collapse" id="sidetoggle">
  57. <div id="sidetoc"></div>
  58. </div>
  59. </div>
  60. <div class="article row grid-right">
  61. <div class="col-md-10">
  62. <article class="content wrap" id="_content" data-uid="IPA.Utilities.Utils">
  63. <h1 id="IPA_Utilities_Utils" data-uid="IPA.Utilities.Utils" class="text-break">Class Utils
  64. </h1>
  65. <div class="markdown level0 summary"><p>A class providing static utility functions that in any other language would just <em>exist</em>.</p>
  66. </div>
  67. <div class="markdown level0 conceptual"></div>
  68. <div class="inheritance">
  69. <h5>Inheritance</h5>
  70. <div class="level0"><span class="xref">System.Object</span></div>
  71. <div class="level1"><span class="xref">Utils</span></div>
  72. </div>
  73. <div class="inheritedMembers">
  74. <h5>Inherited Members</h5>
  75. <div>
  76. <span class="xref">System.Object.ToString()</span>
  77. </div>
  78. <div>
  79. <span class="xref">System.Object.Equals(System.Object)</span>
  80. </div>
  81. <div>
  82. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  83. </div>
  84. <div>
  85. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  86. </div>
  87. <div>
  88. <span class="xref">System.Object.GetHashCode()</span>
  89. </div>
  90. <div>
  91. <span class="xref">System.Object.GetType()</span>
  92. </div>
  93. <div>
  94. <span class="xref">System.Object.MemberwiseClone()</span>
  95. </div>
  96. </div>
  97. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Utilities.html">IPA.Utilities</a></h6>
  98. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  99. <h5 id="IPA_Utilities_Utils_syntax">Syntax</h5>
  100. <div class="codewrapper">
  101. <pre><code class="lang-csharp hljs">public static class Utils</code></pre>
  102. </div>
  103. <h3 id="methods">Methods
  104. </h3>
  105. <span class="small pull-right mobile-hide">
  106. <span class="divider">|</span>
  107. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  108. </span>
  109. <span class="small pull-right mobile-hide">
  110. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L31">View Source</a>
  111. </span>
  112. <a id="IPA_Utilities_Utils_ByteArrayToString_" data-uid="IPA.Utilities.Utils.ByteArrayToString*"></a>
  113. <h4 id="IPA_Utilities_Utils_ByteArrayToString_System_Byte___" data-uid="IPA.Utilities.Utils.ByteArrayToString(System.Byte[])">ByteArrayToString(Byte[])</h4>
  114. <div class="markdown level1 summary"><p>Converts a byte array to a hex string.</p>
  115. </div>
  116. <div class="markdown level1 conceptual"></div>
  117. <h5 class="decalaration">Declaration</h5>
  118. <div class="codewrapper">
  119. <pre><code class="lang-csharp hljs">public static string ByteArrayToString(byte[] ba)</code></pre>
  120. </div>
  121. <h5 class="parameters">Parameters</h5>
  122. <table class="table table-bordered table-striped table-condensed">
  123. <thead>
  124. <tr>
  125. <th>Type</th>
  126. <th>Name</th>
  127. <th>Description</th>
  128. </tr>
  129. </thead>
  130. <tbody>
  131. <tr>
  132. <td><span class="xref">System.Byte</span>[]</td>
  133. <td><span class="parametername">ba</span></td>
  134. <td><p>the byte array</p>
  135. </td>
  136. </tr>
  137. </tbody>
  138. </table>
  139. <h5 class="returns">Returns</h5>
  140. <table class="table table-bordered table-striped table-condensed">
  141. <thead>
  142. <tr>
  143. <th>Type</th>
  144. <th>Description</th>
  145. </tr>
  146. </thead>
  147. <tbody>
  148. <tr>
  149. <td><span class="xref">System.String</span></td>
  150. <td><p>the hex form of the array</p>
  151. </td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <span class="small pull-right mobile-hide">
  156. <span class="divider">|</span>
  157. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  158. </span>
  159. <span class="small pull-right mobile-hide">
  160. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L92">View Source</a>
  161. </span>
  162. <a id="IPA_Utilities_Utils_CopyAll_" data-uid="IPA.Utilities.Utils.CopyAll*"></a>
  163. <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>
  164. <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>
  165. </div>
  166. <div class="markdown level1 conceptual"></div>
  167. <h5 class="decalaration">Declaration</h5>
  168. <div class="codewrapper">
  169. <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>
  170. </div>
  171. <h5 class="parameters">Parameters</h5>
  172. <table class="table table-bordered table-striped table-condensed">
  173. <thead>
  174. <tr>
  175. <th>Type</th>
  176. <th>Name</th>
  177. <th>Description</th>
  178. </tr>
  179. </thead>
  180. <tbody>
  181. <tr>
  182. <td><span class="xref">System.IO.DirectoryInfo</span></td>
  183. <td><span class="parametername">source</span></td>
  184. <td><p>the source directory</p>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td><span class="xref">System.IO.DirectoryInfo</span></td>
  189. <td><span class="parametername">target</span></td>
  190. <td><p>the destination directory</p>
  191. </td>
  192. </tr>
  193. <tr>
  194. <td><span class="xref">System.String</span></td>
  195. <td><span class="parametername">appendFileName</span></td>
  196. <td><p>the filename of the file to append together</p>
  197. </td>
  198. </tr>
  199. <tr>
  200. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Exception</span>, <span class="xref">System.IO.FileInfo</span>, <span class="xref">System.Boolean</span>&gt;</td>
  201. <td><span class="parametername">onCopyException</span></td>
  202. <td><p>a delegate called when there is an error copying. Return true to keep going.</p>
  203. </td>
  204. </tr>
  205. </tbody>
  206. </table>
  207. <span class="small pull-right mobile-hide">
  208. <span class="divider">|</span>
  209. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  210. </span>
  211. <span class="small pull-right mobile-hide">
  212. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L73">View Source</a>
  213. </span>
  214. <a id="IPA_Utilities_Utils_GetRelativePath_" data-uid="IPA.Utilities.Utils.GetRelativePath*"></a>
  215. <h4 id="IPA_Utilities_Utils_GetRelativePath_System_String_System_String_" data-uid="IPA.Utilities.Utils.GetRelativePath(System.String,System.String)">GetRelativePath(String, String)</h4>
  216. <div class="markdown level1 summary"><p>Gets a path relative to the provided folder.</p>
  217. </div>
  218. <div class="markdown level1 conceptual"></div>
  219. <h5 class="decalaration">Declaration</h5>
  220. <div class="codewrapper">
  221. <pre><code class="lang-csharp hljs">public static string GetRelativePath(string file, string folder)</code></pre>
  222. </div>
  223. <h5 class="parameters">Parameters</h5>
  224. <table class="table table-bordered table-striped table-condensed">
  225. <thead>
  226. <tr>
  227. <th>Type</th>
  228. <th>Name</th>
  229. <th>Description</th>
  230. </tr>
  231. </thead>
  232. <tbody>
  233. <tr>
  234. <td><span class="xref">System.String</span></td>
  235. <td><span class="parametername">file</span></td>
  236. <td><p>the file to relativize</p>
  237. </td>
  238. </tr>
  239. <tr>
  240. <td><span class="xref">System.String</span></td>
  241. <td><span class="parametername">folder</span></td>
  242. <td><p>the source folder</p>
  243. </td>
  244. </tr>
  245. </tbody>
  246. </table>
  247. <h5 class="returns">Returns</h5>
  248. <table class="table table-bordered table-striped table-condensed">
  249. <thead>
  250. <tr>
  251. <th>Type</th>
  252. <th>Description</th>
  253. </tr>
  254. </thead>
  255. <tbody>
  256. <tr>
  257. <td><span class="xref">System.String</span></td>
  258. <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>
  259. </td>
  260. </tr>
  261. </tbody>
  262. </table>
  263. <span class="small pull-right mobile-hide">
  264. <span class="divider">|</span>
  265. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  266. </span>
  267. <span class="small pull-right mobile-hide">
  268. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L17">View Source</a>
  269. </span>
  270. <a id="IPA_Utilities_Utils_StringToByteArray_" data-uid="IPA.Utilities.Utils.StringToByteArray*"></a>
  271. <h4 id="IPA_Utilities_Utils_StringToByteArray_System_String_" data-uid="IPA.Utilities.Utils.StringToByteArray(System.String)">StringToByteArray(String)</h4>
  272. <div class="markdown level1 summary"><p>Converts a hex string to a byte array.</p>
  273. </div>
  274. <div class="markdown level1 conceptual"></div>
  275. <h5 class="decalaration">Declaration</h5>
  276. <div class="codewrapper">
  277. <pre><code class="lang-csharp hljs">public static byte[] StringToByteArray(string hex)</code></pre>
  278. </div>
  279. <h5 class="parameters">Parameters</h5>
  280. <table class="table table-bordered table-striped table-condensed">
  281. <thead>
  282. <tr>
  283. <th>Type</th>
  284. <th>Name</th>
  285. <th>Description</th>
  286. </tr>
  287. </thead>
  288. <tbody>
  289. <tr>
  290. <td><span class="xref">System.String</span></td>
  291. <td><span class="parametername">hex</span></td>
  292. <td><p>the hex stream</p>
  293. </td>
  294. </tr>
  295. </tbody>
  296. </table>
  297. <h5 class="returns">Returns</h5>
  298. <table class="table table-bordered table-striped table-condensed">
  299. <thead>
  300. <tr>
  301. <th>Type</th>
  302. <th>Description</th>
  303. </tr>
  304. </thead>
  305. <tbody>
  306. <tr>
  307. <td><span class="xref">System.Byte</span>[]</td>
  308. <td><p>the corresponding byte array</p>
  309. </td>
  310. </tr>
  311. </tbody>
  312. </table>
  313. <span class="small pull-right mobile-hide">
  314. <span class="divider">|</span>
  315. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  316. </span>
  317. <span class="small pull-right mobile-hide">
  318. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L49">View Source</a>
  319. </span>
  320. <a id="IPA_Utilities_Utils_UnsafeCompare_" data-uid="IPA.Utilities.Utils.UnsafeCompare*"></a>
  321. <h4 id="IPA_Utilities_Utils_UnsafeCompare_System_Byte___System_Byte___" data-uid="IPA.Utilities.Utils.UnsafeCompare(System.Byte[],System.Byte[])">UnsafeCompare(Byte[], Byte[])</h4>
  322. <div class="markdown level1 summary"><p>Uses unsafe code to compare 2 byte arrays quickly.</p>
  323. </div>
  324. <div class="markdown level1 conceptual"></div>
  325. <h5 class="decalaration">Declaration</h5>
  326. <div class="codewrapper">
  327. <pre><code class="lang-csharp hljs">public static bool UnsafeCompare(byte[] a1, byte[] a2)</code></pre>
  328. </div>
  329. <h5 class="parameters">Parameters</h5>
  330. <table class="table table-bordered table-striped table-condensed">
  331. <thead>
  332. <tr>
  333. <th>Type</th>
  334. <th>Name</th>
  335. <th>Description</th>
  336. </tr>
  337. </thead>
  338. <tbody>
  339. <tr>
  340. <td><span class="xref">System.Byte</span>[]</td>
  341. <td><span class="parametername">a1</span></td>
  342. <td><p>array 1</p>
  343. </td>
  344. </tr>
  345. <tr>
  346. <td><span class="xref">System.Byte</span>[]</td>
  347. <td><span class="parametername">a2</span></td>
  348. <td><p>array 2</p>
  349. </td>
  350. </tr>
  351. </tbody>
  352. </table>
  353. <h5 class="returns">Returns</h5>
  354. <table class="table table-bordered table-striped table-condensed">
  355. <thead>
  356. <tr>
  357. <th>Type</th>
  358. <th>Description</th>
  359. </tr>
  360. </thead>
  361. <tbody>
  362. <tr>
  363. <td><span class="xref">System.Boolean</span></td>
  364. <td><p>whether or not they are byte-for-byte equal</p>
  365. </td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. </article>
  370. </div>
  371. <div class="hidden-sm col-md-2" role="complementary">
  372. <div class="sideaffix">
  373. <div class="contribution">
  374. <ul class="nav">
  375. <li>
  376. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/new/master/apiSpec/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>
  377. </li>
  378. <li>
  379. <a href="https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded/blob/master/IPA.Loader/Utilities/Utils.cs/#L10" class="contribution-link">View Source</a>
  380. </li>
  381. </ul>
  382. </div>
  383. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  384. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  385. </nav>
  386. </div>
  387. </div>
  388. </div>
  389. </div>
  390. <footer>
  391. <div class="grad-bottom"></div>
  392. <div class="footer">
  393. <div class="container">
  394. <span class="pull-right">
  395. <a href="#top">Back to top</a>
  396. </span>
  397. <span>Generated by <strong>DocFX</strong></span>
  398. </div>
  399. </div>
  400. </footer>
  401. </div>
  402. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  403. <script type="text/javascript" src="../styles/docfx.js"></script>
  404. <script type="text/javascript" src="../styles/main.js"></script>
  405. </body>
  406. </html>