33 lines
1004 B
C#
33 lines
1004 B
C#
/*----------------------------------------------------------------
|
|
// Copyright (C) 2025 Beijing All rights reserved.
|
|
//
|
|
// Author: huachangmiao
|
|
// Create Date: 2025/04/11
|
|
// Module Describe:
|
|
//----------------------------------------------------------------*/
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace LeviathanVideo.Abstractions
|
|
{
|
|
|
|
public class ConstCharPtrMarshaler : ICustomMarshaler
|
|
{
|
|
private static readonly ConstCharPtrMarshaler Instance = new ConstCharPtrMarshaler();
|
|
public object MarshalNativeToManaged(IntPtr pNativeData) => Marshal.PtrToStringAnsi(pNativeData);
|
|
|
|
public IntPtr MarshalManagedToNative(object managedObj) => IntPtr.Zero;
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
{
|
|
}
|
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
{
|
|
}
|
|
|
|
public int GetNativeDataSize() => IntPtr.Size;
|
|
|
|
public static ICustomMarshaler GetInstance(string cookie) => Instance;
|
|
}
|
|
} |