Class Marshalls
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Provides data transformation and encoding utility functions.
public static class Marshalls
- Inheritance
-
Marshalls
- Inherited Members
Properties
Singleton
public static MarshallsInstance Singleton { get; }
Property Value
Methods
Base64ToRaw(string)
Returns a decoded byte[] corresponding to the Base64-encoded string base64Str
.
public static byte[] Base64ToRaw(string base64Str)
Parameters
base64Str
string
Returns
- byte[]
Base64ToUtf8(string)
Returns a decoded string corresponding to the Base64-encoded string base64Str
.
public static string Base64ToUtf8(string base64Str)
Parameters
base64Str
string
Returns
Base64ToVariant(string, bool)
Returns a decoded Variant corresponding to the Base64-encoded string base64Str
. If allowObjects
is true
, decoding objects is allowed.
Internally, this uses the same decoding mechanism as the @GlobalScope.bytes_to_var
method.
Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
public static Variant Base64ToVariant(string base64Str, bool allowObjects = false)
Parameters
Returns
RawToBase64(byte[])
Returns a Base64-encoded string of a given byte[].
public static string RawToBase64(byte[] array)
Parameters
array
byte[]
Returns
Utf8ToBase64(string)
Returns a Base64-encoded string of the UTF-8 string utf8Str
.
public static string Utf8ToBase64(string utf8Str)
Parameters
utf8Str
string
Returns
VariantToBase64(Variant, bool)
Returns a Base64-encoded string of the Variantvariant
. If fullObjects
is true
, encoding objects is allowed (and can potentially include code).
Internally, this uses the same encoding mechanism as the @GlobalScope.var_to_bytes
method.
public static string VariantToBase64(Variant variant, bool fullObjects = false)