public class RASCONN : StructMarshalBase
{
//int dwSize;
//IntPtr hRasCon;
//char[RAS_MaxEntryName + 1] szEntryName;
public Int32 dwSize
{
get
{
return BitConverter.ToInt32(m_data, 0);
}
set
{
Buffer.BlockCopy(BitConverter.GetBytes(value), 0,
m_data, 0, BitConverter.GetBytes(value).Length);
}
}
public IntPtr hRasCon
{
get {return new IntPtr (BitConverter.ToInt32(m_data, 4));}
set
{
Buffer.BlockCopy(BitConverter.GetBytes(value.ToInt32()),
0, m_data, 4, BitConverter.GetBytes(value.ToInt32()).Length);
}
}
public string szEntryName
{
get
{
byte[] Text = new byte[RAS_MaxEntryName];
Array.Copy(m_data, 8, Text, 0, Text.Length);
return xtox.byteArrayToString(Text);
}
set
{
if (value.Length <= RAS_MaxEntryName)
{
Buffer.BlockCopy(xtox.stringToByteArray(value),
0, m_data, 8, value.Length);
}
else
{
throw new
Exception("szEntryName darf nicht größer als " + RAS_MaxEntryName.ToString() + " sein!");
}
}
}
public override int GetSize()
{
return 8 + RAS_MaxEntryName;
}
}