using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace ITC81DB_0H.Part11_Encryption { public partial class Encryption { public delegate void ObjectEventHandler(object data); public static event ObjectEventHandler DllAesEncryption_Event; public static event ObjectEventHandler DllAesEncryption_GetVersionDataEvent; public static void InitializeEncryption() { // register callback fnAesVersionCallBack = AesEncryption_VersionCallback; DLL_AES_Register_VersionCB(fnAesVersionCallBack); fnAesEncryptionCallBack = cbAesEncryption; DLL_AES_Register_EncryptionCB(fnAesEncryptionCallBack); // call the function DLL_AES_Activation(); } #region Aes_Fuction public static void fAesEncryption(string inFileName, string outFileName, bool encrypt, bool compress) { IntPtr pInFileName = Marshal.StringToBSTR(inFileName); IntPtr pOutFileName = Marshal.StringToBSTR(outFileName); DLL_AES_Encryption(pInFileName, pOutFileName, encrypt, compress); } public static void AesEncryption_GetVersion() { DLL_SAES_Getversion(); } #endregion #region Aes_Callback public static void cbAesEncryption(ref auth_encryption_status_t encryption_status) { if (DllAesEncryption_Event != null) DllAesEncryption_Event(encryption_status); } private static void AesEncryption_VersionCallback(StringBuilder version) { try { if (DllAesEncryption_GetVersionDataEvent != null) DllAesEncryption_GetVersionDataEvent(version); } catch { } } #endregion } }