コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Crypter.cs プロジェクト: klyuchnikov/Miszki
 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);
 }
コード例 #3
0
 /// <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);
 }