Changeset 2669


Ignore:
Timestamp:
Feb 12, 2011, 1:13:02 AM (11 years ago)
Author:
Matthäus Wander
Message:

TEA:

  • fixed bug which has been introduced during recent ICryptoolStream merge (did not reset stop)
  • fixed another potential bug (did not wait for writer to finish before processing input length)
  • replaced string key in sample with hex (supported by TextInput for a few weeks now)

CrypPluginBase:

  • added WaitEof(): lazy readers can wait until writer has finished the stream before starting to process input data
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPluginBase/IO/CStreamReader.cs

    r2529 r2669  
    321321        }
    322322
     323        /// <summary>
     324        /// Not supported.
     325        /// </summary>
     326        /// <param name="value"></param>
    323327        public override void SetLength(long value)
    324328        {
     
    327331
    328332        /// <summary>
    329         /// Reader can't write.
     333        /// Waits until the writer has stopped generating data and has closed the stream.
     334        /// This method is for lazy readers waiting to have full length available before starting any processing.
     335        /// It's usually less effective than trying to read continously.
     336        /// </summary>
     337        public void WaitEof()
     338        {
     339            checkDisposal();
     340
     341            lock (_writer.InternalMonitor)
     342            {
     343                while (!_writer.IsClosed)
     344                {
     345                    Monitor.Wait(_writer.InternalMonitor);
     346                }
     347            }
     348        }
     349
     350        /// <summary>
     351        /// Not supported.
    330352        /// </summary>
    331353        public override void Write(byte[] buffer, int offset, int count)
  • trunk/CrypPlugins/TEA/TEA.cs

    r2529 r2669  
    8888        public void Dispose()
    8989        {
     90            Reset();
     91        }
     92
     93        private void Reset()
     94        {
    9095            try
    9196            {
     
    101106                    outputStream = null;
    102107                }
    103                 }
     108            }
    104109            catch (Exception ex)
    105110            {
    106111                GuiLogMessage(ex.Message, NotificationLevel.Error);
    107112            }
    108             this.stop = false;
    109113        }
    110114
     
    143147                using (CStreamReader reader = InputStream.CreateReader())
    144148                {
     149                    reader.WaitEof(); // lazy reading, wait until writer has finished.
     150
    145151                    outputStream = new CStreamWriter();
     152
    146153
    147154                    long inputbytes = reader.Length;
     
    539546        public void PostExecution()
    540547        {
     548            Reset();
    541549        }
    542550
    543551        public void PreExecution()
    544552        {
     553            Reset();
    545554        }
    546555
Note: See TracChangeset for help on using the changeset viewer.