Class StringExtensions
Inheritance
System.Object
Inherited Members
Show
Syntax
public static class StringExtensions
Properties
MaxStringLength
Maximum number of bytes a string can be serialized to. This is to avoid allocation attack. Defaults MTU, 1300 NOTE: this is byte size after Encoding IMPORTANT: Setting this property will resize the internal buffer. Do not call in hotpath. It is best to call once when you start the application
Declaration
public static int MaxStringLength { get; set; }
Methods
WriteString(NetworkWriter, String)
Declaration
public static void WriteString(this NetworkWriter writer, string value)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkWriter | writer | |
System.String | value | string or null |
ReadString(NetworkReader)
Declaration
public static string ReadString(this NetworkReader reader)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkReader | reader |
Returns
Type | Description |
---|---|
System.String | string or null |
WriteString(NetworkWriter, String, Encoding)
Declaration
public static void WriteString(this NetworkWriter writer, string value, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkWriter | writer | |
System.String | value | string or null |
System.Text.Encoding | encoding | Use this for encoding other than the default (UTF8). Make sure to use same encoding for ReadString |
ReadString(NetworkReader, Encoding)
Declaration
public static string ReadString(this NetworkReader reader, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
Mirage.Serialization.NetworkReader | reader | |
System.Text.Encoding | encoding | Use this for encoding other than the default (UTF8). Make sure to use same encoding for WriterString |
Returns
Type | Description |
---|---|
System.String | string or null |