Penumbra.String A wrapper around unsafe byte strings that can either be owned or allocated in unmanaged space. Unowned strings may change their value and thus become corrupt, so they should not be stored without cloning.
The string keeps track of whether it is owned or not, being pure ASCII, ASCII-lowercase, or null-terminated.
Owned strings are always null-terminated.
Any constructed string will compute its own CRC32-value (as long as the string itself is not changed).
Returns whether the current string is known to be null-terminated. Returns whether the current string is owned, i.e. allocated in unmanaged space. Returns whether the current string consists purely of ASCII characters. This information is cached. Returns whether the current string contains only ASCII lower-case or non-ASCII characters. This information is cached. Returns the pointer to the actual memory of the string. Returns the CRC32 value of the string. This value is computed on construction and stored. Returns the length of the string. Returns whether the string is empty. Returns a ReadOnlySpan to the actual memory of the string using its length, without null-terminator. Access a specific byte in the string by index. The index of the requested byte. Thrown if is less than 0 or larger than the string. An iterator over all the bytes of the string. The CRC32 hash of the string. Convert to CiByteString. The string to compare with. Whether this string and are equal. Whether this string and the object are equal. The string to compare with. Whether this string and are equal ignoring (ASCII) case. The string to compare with. Whether this string is lexicographically smaller (less than 0), bigger (greater than 0) or equal (0) to . The string to compare with. Whether this string is lexicographically smaller (less than 0), bigger (greater than 0) or equal (0) to ignoring (ASCII) case. The prefix to check for. Whether this string has as a prefix. The suffix to check for. Whether this string has as a suffix. Find the first occurrence of in this string. The needle. An optional starting index in this string. The index of the first occurrence of after or -1 if it is not found. Find the last occurrence of in this string. The needle. An optional stopping index in this string. The index of the last occurrence of before or -1 if it is not found. Whether two strings are equal. Whether two strings are different. 67108863 67108863 Statically allocated null-terminator for empty strings to point to. An empty string of length 0 that is null-terminated. Create a new empty string. Create a temporary ByteString from a byte pointer. A pointer to an existing string. The maximum length until it stops looking for a null-terminator. This computes CRC, checks for ASCII and AsciiLower and assumes Null-Termination. Create a temporary ByteString from a byte span. A null-terminated span of an existing string. This computes CRC, checks for ASCII and AsciiLower and assumes Null-Termination. Construct a temporary ByteString from a given byte string of known size. A pointer to an existing string. The known length of the string. Whether the string is known to be null-terminated or not. Optionally, whether the string is known to only contain (ASCII) lower-case characters. Optionally, whether the string is known to only contain ASCII characters. Optionally, the known CRC32 hash of the string. If length is larger than . Always computes the CRC32 for the path. Construct an ByteString from a given unicode string, possibly converted to ascii lowercase. The existing UTF16 string. The converted, owned ByteString on success, an empty string on failure. Optionally, whether to convert the string to lower-case. False if the resulting length is larger than . Construct an ByteString from a given unicode string without checking for length, and assuming from the argument. The existing UTF16 string. Whether the string is known to be (ASCII) lower-case. The converted, owned string. Free memory if the string is owned. Manually free memory. Sets the string to an empty string, also updates CRC32. Automatic release of memory if not disposed before. Setup from all given values. Check if the string is known to be or not be ASCII, otherwise test for it and store it in the cache. Check if the string is known to be or not be (ASCII) lower-case, otherwise test for it and store it in the cache. Create a C# UTF16 string from this string. Convert the ASCII portion of the string to lowercase. Only creates a new string and copy if the string is not already known to be lower case. Convert the ascii portion of the string to mixed case (i.e. capitalize every first letter in a word) Always creates an owned copy of the string. Convert the ASCII portion of the string to lowercase. Guaranteed to create an owned copy. Create an owned copy of the given string. Create an owned copy of the given string in reverse. Create a non-owning substring from the given position. The starting position. If from is negative or too large, the returned string will be the empty string. Create a non-owning substring from the given position of the given length. The starting position. The total length. If from is negative or too large, the returned string will be the empty string.
If from + length is too large, it will be the same as if length was not specified.
Trim all ascii whitespace characters from the front. Trim all ascii whitespace characters at the end. Trim all ascii whitespace characters from the beginning or end of the string. Create a owned copy of the string and replace all occurrences of from with to in it. The byte to replace. The byte is to be replaced with. Join a number of strings with a given byte between them. The byte to insert between all strings. The list of strings to join. No is inserted before the first or after the last string. Join a number of strings with a given byte between them. The list of strings to join. Split a string and return a list of the substrings delimited by b. An optional maximum number of splits - if the maximum is reached, the last substring may contain delimiters. Remove all empty substrings between delimiters, they are also not counted for . The returned substrings are not owned. Combine two optional bools into a new optional bool. A wrapper around unsafe byte strings that ignores case for comparisons and hashes, that can either be owned or allocated in unmanaged space. Unowned strings may change their value and thus become corrupt, so they should not be stored without cloning.
The string can keep track of whether it is owned or not, being pure ASCII, ASCII-lowercase, or null-terminated.
Owned strings are always null-terminated.
The pointer to the memory of the string. The length of the string. Returns whether the string is empty. The case-insensitive CRC32 hash. This information is cached. The case-sensitive CRC32 hash. This information is cached. Returns whether the current string consists purely of ASCII characters. This information is cached. Returns whether the current string contains only ASCII lower-case or non-ASCII characters. This information is cached. Returns a ReadOnlySpan to the actual memory of the string using its length, without null-terminator. Returns whether the current string is known to be null-terminated. Returns whether the current string is owned, i.e. allocated in unmanaged space. Access a specific byte in the string by index. The index of the requested byte. Thrown if is less than 0 or larger than the string. The case-insensitive CRC32 hash of the string. Convert to ByteString. The string to compare with. Whether this string and are equal ignoring (ASCII) case. Whether this string and the object are equal. The string to compare with. Whether this string and are equal including (ASCII) case. The string to compare with. Whether this string is lexicographically smaller (less than 0), bigger (greater than 0) or equal (0) to ignoring (ASCII) case. The string to compare with. Whether this string is lexicographically smaller (less than 0), bigger (greater than 0) or equal (0) to including (ASCII) case. The prefix to check for. Whether this string has as a prefix. The suffix to check for. Whether this string has as a suffix. Check whether this string contains a substring disregarding case anywhere. The substring to check for. Check whether this string contains an exact substring anywhere. The substring to check for. Find the first occurrence of in this string. The needle. An optional starting index in this string. The index of the first occurrence of after or -1 if it is not found. Find the last occurrence of in this string. The needle. An optional stopping index in this string. The index of the last occurrence of before or -1 if it is not found. Whether two strings are equal. Whether two strings are different. Statically allocated null-terminator for empty strings to point to. An empty string of length 0 that is null-terminated. Create a new empty string. Create a temporary ByteString from a byte pointer which should be null-terminated. A pointer to an existing string. Which meta information to precompute. The maximum length to scan for a null-terminator. Create a temporary ByteString from a byte span. A preferably null-terminated span of an existing string. Which meta information to precompute. This computes all required values for the string up to null-termination or the length of the span. Construct an ByteString from a given unicode string, possibly converted to ascii lowercase. The existing UTF16 string. The converted, owned ByteString on success, an empty string on failure. Which meta information to precompute. Optionally, whether to convert the string to lower-case. Construct a temporary ByteString from a given byte string of known size. A pointer to an existing string. The known length of the string. Whether the string is known to be null-terminated or not. Optionally, whether the string is known to only contain (ASCII) lower-case characters. Optionally, whether the string is known to only contain ASCII characters. Free memory if the string is owned. Manually free memory. Sets the string to an empty string, also updates CRC32. Automatic release of memory if not disposed before. Setup from all given values. Check if the string is known to be or not be ASCII, otherwise test for it and store it in the cache. Check if the string is known to be or not be (ASCII) lower-case, otherwise test for it and store it in the cache. Create a C# UTF16 string from this string. Convert the ASCII portion of the string to lowercase. Only creates a new string and copy if the string is not already known to be lower case. Convert the ascii portion of the string to mixed case (i.e. capitalize every first letter in a word) Always creates an owned copy of the string. Convert the ASCII portion of the string to lowercase. Guaranteed to create an owned copy. Create an owned copy of the given string. Create a non-owning substring from the given position. The starting position. If from is negative or too large, the returned string will be the empty string. Create a non-owning substring from the given position of the given length. The starting position. The total length. If from is negative or too large, the returned string will be the empty string.
If from + length is too large, it will be the same as if length was not specified.
Trim all ascii whitespace characters from the front. Trim all ascii whitespace characters at the end. Trim all ascii whitespace characters from the beginning or end of the string. Create an owned copy of the string and replace all occurrences of from with to in it. The byte to replace. The byte is to be replaced with. Join a number of strings with a given byte between them. The byte to insert between all strings. The list of strings to join. No is inserted before the first or after the last string. Join a number of strings with a given byte between them. The list of strings to join. Split a string and return a list of the substrings delimited by b. An optional maximum number of splits - if the maximum is reached, the last substring may contain delimiters. Remove all empty substrings between delimiters, they are also not counted for . The returned substrings are not owned. Combine two optional bools into a new optional bool. What meta-data for a byte string should be precomputed on construction. Pre-compute nothing. Usually at least the case-insensitive CRC32 is needed. Pre-compute the case-insensitive CRC32, which is used as the general hash. Pre-compute the case-sensitive CRC32. This should not generally be needed. Pre-compute whether the string is entirely in ASCII-lower case. Pre-compute whether the string is not using any characters outside the ASCII range. Pre-compute everything. A combination of a C#-string for filesystem interactions and a lower-case ByteString for FFXIV interactions. Also stores the FFXIV-CRC64 value. The Unicode string containing the full name of the path with backward-slashes. The UTF8 string containing the full name of the path with forward-slashes. The FFXIV specific Crc64 value, i.e. a CRC32 of the file name combined with a CRC32 of the file path. This value is cached after the first computation. An empty string. Combine a relative path with a base directory for a full path. Create a full path from a given file path. Create a full path from a given string. Create a full path from a given game path. Check whether the file exists on your file system. Get the file extension of the file. Get only the file name of the file. Use the given directory path to obtain a game path. Use the given directory path to obtain path relative to it. Compare lexicographically against another FullPath, FileInfo, ByteString or string. Comparison against FileInfo and string ignore case, comparisons against FullPath and ByteString do not, but use the InternalName. Check if two FullPaths are equal. Returns whether the path is rooted. Return the CRC32 of the InternalName. Return the FullName. Return the path with back slashes if it is rooted and with forward-slashes if not. Convert from and to string. A GamePath that verifies some invariants based on a CiByteString. The Invariants are being smaller than , and containing forward-slashes as separators. The maximum length Penumbra accepts. Return the original path. An empty path. Create a new Utf8GamePath from a pointer. The data. The resulting game path if successful, an empty path otherwise. The metadata that should be pre-computed. Whether the given pointer is a valid Utf8GamePath. Same as just with known length. Does not check for Forward/Backslashes due to assuming that SE-strings use the correct one. Does not check for initial slashes either, since they are assumed to be by choice. Checks for maxlength and lowercase. Create a new path from a string. The given string. The converted path or an empty path on failure. False if the string is too long, or can not be converted to UTF8. Create a new path from a string and check its length. The given string. The string as UTF8GamePath, empty string on failure or null input. False if the string is too long. Create a new path from a file and a base directory. The file path to convert. The directory to which the file path should be seen as relative. The converted path or an empty path on failure. False if the file does not lie inside the base directory or the string conversion fails. Get the non-owned substring of the file name of the path. Get the non-owned substring of the extension of the path. Return whether the path is rooted. Return whether the path is rooted. Conversion from and to string. A relative path that verifies some invariants based on an UTF8 string. Similar to Utf8GamePath just kept for filesystem interaction instead of FFXIV interaction. Explicit conversion from string to Utf8RelPath for migrating old dictionaries. Create a new RelPath from a GamePath by replacing all forward slashes with backward slashes. Convert to Utf8GamePath by replacing all backward slashes with forward slashes, and turning to lower case. Optionally skip the first few folders in the conversion. Wrapper class for all utility functions. Convert a byte to its ASCII-lowercase version. Check if a byte is ASCII-lowercase. Convert a byte to its ASCII-uppercase version. Check if a byte is ASCII-uppercase. Check if a byte array of given length is ASCII-lowercase. Compare two byte arrays of given lengths ASCII-case-insensitive. Check two byte arrays of given lengths for ASCII-case-insensitive equality. Check if a byte array of given length consists purely of ASCII characters. Lexicographically compare two byte arrays of given length. Lexicographically compare one byte array of given length with a null-terminated byte array of unknown length. Lexicographically compare two null-terminated byte arrays of unknown length not larger than maxLength. Check two byte arrays of given length for equality. Check one byte array of given length for equality against a null-terminated byte array of unknown length. Check two null-terminated byte arrays of unknown length not larger than maxLength for equality. Used for static null-terminators. Convert a C# unicode-string to an unmanaged UTF8-byte array and return the pointer. If the length would exceed the given maxLength, return a nullpointer instead. Create a copy of a given string and return the pointer. Check the length of a null-terminated byte array no longer than the given maxLength. Compute the FFXIV-CRC64 value of a UTF16 string. The FFXIV-CRC64 consists of the CRC32 of the string up to the last '/' in the lower bytes, and the CRC32 of the string from the last '/' in the upper bytes. Compute the FFXIV-CRC64 value of a UTF8 string. Compute the FFXIV-CRC64 value with lower-cased ascii letters. Compute the case-insensitive CRC32 value and the length. Compute the case-insensitive CRC32 value, the length, the ASCII state and the Lowercase state while iterating only once. Compute the case-insensitive and case-sensitive CRC32 value, the length, the ASCII state and the Lowercase state while iterating only once. Compute the CRC32 value, the length, the ASCII state and the Lowercase state while iterating only once. Compute the CRC32 value and the length while iterating only once. Compute the length of a null-terminated string. Replace all occurrences of from in a byte array of known length with to. Convert a byte array of given length to ASCII-lowercase. Copy a byte array and convert the copy to ASCII-lowercase. Import some standard functions for memory handling. Copies bytes from to . Compares bytes from with lexicographically. Compares bytes from with lexicographically and disregarding ascii-case. Call memicmp from msvcrt.dll. Sets bytes from on to . Class managing unmanaged memory for ByteStrings and CiByteStrings. The total number of allocated bytes for strings. Only available when compiled in debug mode. The total number of freed bytes for strings. Only available when compiled in debug mode. The current number of allocated bytes for strings. Only available when compiled in debug mode. The total number of allocated strings. Only available when compiled in debug mode. The total number of freed strings. Only available when compiled in debug mode. The current number of allocated strings. Only available when compiled in debug mode.