cohtml.Utils
Class providing utility methods that are commonly used across the integration code.
Public Classes
Name | |
---|---|
class | Application Utility class providing Application methods. |
Public Functions
Name | |
---|---|
void | CreateDirectory(string path, bool clean) Creates a directory at specified path. |
string | CombinePaths(params string [] paths) Combines paths together. |
string | NormalizeSlashes(this string target) Replaces backward slashes with forward slashes. |
string | DecodeString(string content) Encodes a string into a range of bytes and then decodes it into a string. |
string | DecodeString(byte [] content) Decodes a range of bytes from a byte array into a string. |
byte [] | EncodeString(string content) Encodes a string into a sequence of bytes. |
uint | GetByteCount(string content) Calculates the number of bytes produced by encoding a set of characters. |
T | AddMissingComponent< T >(this GameObject go) Adds a component to a given GameObject only if its missing. |
Public Attributes
Name | |
---|---|
const string | PackagesStr Holds the name of the packages folder. |
const string | CohtmlUpmName The name of the cohtml upm package. |
string | CohtmlUpmPath Returns the path of the cohtml upm package. |
Public Functions Documentation
function CreateDirectory
static void CreateDirectory(
string path,
bool clean
)
Creates a directory at specified path.
Parameters:
- path The path where to create the directory.
- clean A flag whether the directory should be cleaned first if it exists.
function CombinePaths
static string CombinePaths(
params string [] paths
)
Combines paths together.
function NormalizeSlashes
static string NormalizeSlashes(
this string target
)
Replaces backward slashes with forward slashes.
function DecodeString
static string DecodeString(
string content
)
Encodes a string into a range of bytes and then decodes it into a string.
function DecodeString
static string DecodeString(
byte [] content
)
Decodes a range of bytes from a byte array into a string.
function EncodeString
static byte [] EncodeString(
string content
)
Encodes a string into a sequence of bytes.
function GetByteCount
static uint GetByteCount(
string content
)
Calculates the number of bytes produced by encoding a set of characters.
function AddMissingComponent< T >
static T AddMissingComponent< T >(
this GameObject go
)
Adds a component to a given GameObject only if its missing.
Parameters:
- go The GameObject to add the component to.
Template Parameters:
- T The type of the component.
Return: Returns the added component or the already existing one.
Public Attributes Documentation
variable PackagesStr
const string PackagesStr = "Packages";
Holds the name of the packages folder.
variable CohtmlUpmName
const string CohtmlUpmName = "com.coherent-labs.cohtml";
The name of the cohtml upm package.
variable CohtmlUpmPath
static string CohtmlUpmPath => CombinePaths(PackagesStr, CohtmlUpmName);
Returns the path of the cohtml upm package.