SetEncryptKeyISCL Example for C#

[StructLayout(LayoutKind.Sequential)]
public class KeyLoHi
{
   public UInt32 LoValue;
   public UInt32 HiValue;
}

[StructLayout(LayoutKind.Sequential)]
public class Key64
{
   public UInt64 Value;
}
 

//LEADDICOMNet1 is a predefined LEADDicomNet object
private void TestSetEncryptKeyISCL()
{
   Key64 key = null;
   KeyLoHi compKey = null;
   IntPtr UnManagedMemory ;
   key = new Key64();
   compKey = new KeyLoHi();
   UnManagedMemory = Marshal.AllocHGlobal(Marshal.SizeOf(compKey));

   // use a 64 bit key value of 0123456789ABCDEF hex.
   compKey.HiValue = System.Convert.ToUInt32(0X1234567L);
   compKey.LoValue = Convert.ToUInt32(0X89ABCDEFL);
   key.Value = Convert.ToUInt64(0);
   Marshal.StructureToPtr(compKey, UnManagedMemory, true);
   Marshal.PtrToStructure(UnManagedMemory, key);
   LEADDICOMNet1.SetEncryptKeyISCL(LEADDICOMNet1.hNet, 1, key.Value);
   LEADDICOMNet1.SetIndexForEncryptISCL(LEADDICOMNet1.hNet, 1);
   MessageBox.Show("Index value is: " + LEADDICOMNet1.GetIndexForEncryptISCL(LEADDICOMNet1.hNet));
}