public virtual void DecryptAsync(string inputFile, string outputFile) { IAsyncResult res = null; var cfDelegate = new CryptFunctionDelegate(this.Crypt); var syncCurrent = SynchronizationContext.Current; res = cfDelegate.BeginInvoke(inputFile, outputFile, false, delegate { syncCurrent.Send(delegate { var cryprres = cfDelegate.EndInvoke(res); if (DecryptComplitedEvent != null) { DecryptComplitedEvent(cryprres, Password); } }, null); }, null); }
public virtual void EncryptAsync(string inputFile, string outputFile) { IAsyncResult res = null; var syncCurrent = SynchronizationContext.Current; var cfDelegate = new CryptFunctionDelegate(this.Crypt); res = cfDelegate.BeginInvoke(inputFile, outputFile, true, delegate { syncCurrent.Send(delegate { var cryprres = cfDelegate.EndInvoke(res); if (EncryptComplitedEvent != null) EncryptComplitedEvent(cryprres, Password); }, null); }, null); }
/// <summary> /// Шифрование /// </summary> /// <param name="file">входной массив байтов</param> /// <param name="key"> ключ</param> public void Encrypt(string inputFile, string outputFile, string key) { cfDelegate.BeginInvoke(inputFile, outputFile, key, null, null); }