43 lines
886 B
C#
43 lines
886 B
C#
|
using System.Runtime.InteropServices;
|
||
|
|
||
|
namespace CodeLiturgy.Augeas.Test;
|
||
|
|
||
|
class AugSettings_Wrapper : IDisposable
|
||
|
{
|
||
|
private GCHandle m_loadPath_hand;
|
||
|
private string m_loadPath;
|
||
|
|
||
|
public AugSettings_Wrapper( string loadPath)
|
||
|
{
|
||
|
m_loadPath = new string(loadPath);
|
||
|
m_loadPath_hand = GCHandle.Alloc(m_loadPath, GCHandleType.Pinned);
|
||
|
}
|
||
|
|
||
|
|
||
|
public AugSettings GetUnamangedStruct()
|
||
|
{
|
||
|
AugSettings ret = new AugSettings();
|
||
|
ret.loadPath = (string) m_loadPath_hand.Target;
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
#region IDisposable Members
|
||
|
~AugSettings_Wrapper()
|
||
|
{
|
||
|
Dispose();
|
||
|
}
|
||
|
bool disposed = false;
|
||
|
public void Dispose()
|
||
|
{
|
||
|
lock (this)
|
||
|
{
|
||
|
if (!disposed)
|
||
|
{
|
||
|
m_loadPath_hand.Free();
|
||
|
disposed = true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|