Class Utils
A class providing static utility functions that in any other language would just exist.
Inheritance
System.Object
Utils
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public static class Utils
Methods
| Improve this Doc View SourceByteArrayToString(Byte[])
Converts a byte array to a hex string.
Declaration
public static string ByteArrayToString(byte[] ba)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | ba | the byte array |
Returns
Type | Description |
---|---|
System.String | the hex form of the array |
CopyAll(DirectoryInfo, DirectoryInfo, String, Func<Exception, FileInfo, Boolean>)
Copies all files from source
to target
.
Declaration
public static void CopyAll(DirectoryInfo source, DirectoryInfo target, string appendFileName = "", Func<Exception, FileInfo, bool> onCopyException = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.DirectoryInfo | source | the source directory |
System.IO.DirectoryInfo | target | the destination directory |
System.String | appendFileName | the filename of the file to append together |
System.Func<System.Exception, System.IO.FileInfo, System.Boolean> | onCopyException | a delegate called when there is an error copying. Return true to keep going. |
GetRelativePath(String, String)
Gets a path relative to the provided folder.
Declaration
public static string GetRelativePath(string file, string folder)
Parameters
Type | Name | Description |
---|---|---|
System.String | file | the file to relativize |
System.String | folder | the source folder |
Returns
Type | Description |
---|---|
System.String | a path to get from |
StringToByteArray(String)
Converts a hex string to a byte array.
Declaration
public static byte[] StringToByteArray(string hex)
Parameters
Type | Name | Description |
---|---|---|
System.String | hex | the hex stream |
Returns
Type | Description |
---|---|
System.Byte[] | the corresponding byte array |
UnsafeCompare(Byte[], Byte[])
Uses unsafe code to compare 2 byte arrays quickly.
Declaration
public static bool UnsafeCompare(byte[] a1, byte[] a2)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | a1 | array 1 |
System.Byte[] | a2 | array 2 |
Returns
Type | Description |
---|---|
System.Boolean | whether or not they are byte-for-byte equal |