C# Class Nexus.Client.Games.Morrowind.PluginManagement.Boss.StringMarshaler

Marshals strings to and from unmanaged code.
Inheritance: ICustomMarshaler
Show file Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
CleanUpManagedData ( object ManagedObj ) : void

Cleans up the given managed data.

CleanUpNativeData ( IntPtr pNativeData ) : void

Cleans up native data.

GetInstance ( string p_strEncoding ) : ICustomMarshaler

Creates a marshaler for a string of the given encoding.

GetNativeDataSize ( ) : int

Gets the size of the native data being marshalled.

GetNullTerminatedStringPointer ( string p_strString, Encoding p_encEncoding ) : IntPtr

Returns a pointer to a unamanged, null terminated, copy the given string.

GetStringBytes ( IntPtr pNativeData, Encoding p_encEncoding ) : List

Reads the bytes representing a string from the given pointer.

MarshalManagedToNative ( object ManagedObj ) : IntPtr

Marshals the given string to a pointer.

MarshalNativeToManaged ( IntPtr pNativeData ) : object

Marshals the given pointer to a string.

StringMarshaler ( string p_strEncoding ) : System

A simple constructor that initializes the object with the given values.

Method Details

CleanUpManagedData() public method

Cleans up the given managed data.
public CleanUpManagedData ( object ManagedObj ) : void
ManagedObj object The managed object to clean up.
return void

CleanUpNativeData() public method

Cleans up native data.
public CleanUpNativeData ( IntPtr pNativeData ) : void
pNativeData System.IntPtr The pointer to the native data to clean up.
return void

GetInstance() public static method

Creates a marshaler for a string of the given encoding.
public static GetInstance ( string p_strEncoding ) : ICustomMarshaler
p_strEncoding string The encoding of the string to marshal.
return ICustomMarshaler

GetNativeDataSize() public method

Gets the size of the native data being marshalled.
public GetNativeDataSize ( ) : int
return int

GetNullTerminatedStringPointer() public static method

Returns a pointer to a unamanged, null terminated, copy the given string.
public static GetNullTerminatedStringPointer ( string p_strString, Encoding p_encEncoding ) : IntPtr
p_strString string The string for which to create a pointer.
p_encEncoding System.Text.Encoding The encoding of the string.
return System.IntPtr

GetStringBytes() public static method

Reads the bytes representing a string from the given pointer.
public static GetStringBytes ( IntPtr pNativeData, Encoding p_encEncoding ) : List
pNativeData System.IntPtr The pointer to the string whose bytes are to be read.
p_encEncoding System.Text.Encoding The encoding of the string whose bytes are to be read.
return List

MarshalManagedToNative() public method

Marshals the given string to a pointer.
public MarshalManagedToNative ( object ManagedObj ) : IntPtr
ManagedObj object The string to marshal.
return System.IntPtr

MarshalNativeToManaged() public method

Marshals the given pointer to a string.
public MarshalNativeToManaged ( IntPtr pNativeData ) : object
pNativeData System.IntPtr The pointer to the data to marshal to a string.
return object

StringMarshaler() public method

A simple constructor that initializes the object with the given values.
public StringMarshaler ( string p_strEncoding ) : System
p_strEncoding string The encoding of the string to marshal.
return System