Esempio n. 1
0
        protected virtual int OnDataAvailable(IntPtr p1, int p2)
        {
            int result = 1;

            if (this.currentFile != null)
            {
                this.currentFile.BytesExtracted += p2;
            }
            if (this.DataAvailable != null)
            {
                byte[] data = new byte[p2];
                Marshal.Copy(p1, data, 0, p2);
                DataAvailableEventArgs e = new DataAvailableEventArgs(data);
                this.DataAvailable(this, e);
                if (!e.ContinueOperation)
                {
                    result = -1;
                }
            }
            if ((this.ExtractionProgress != null) && (this.currentFile != null))
            {
                CompressionExtractionProgressEventArgs e = new CompressionExtractionProgressEventArgs();
                e.FileName        = this.currentFile.FileName;
                e.FileSize        = this.currentFile.UnpackedSize;
                e.BytesExtracted  = this.currentFile.BytesExtracted;
                e.PercentComplete = this.currentFile.PercentComplete;
                this.ExtractionProgress(this, e);
                if (!e.ContinueOperation)
                {
                    result = -1;
                }
            }
            return(result);
        }
Esempio n. 2
0
 private void unrar_DataAvailable(object sender, DataAvailableEventArgs e)
 {
     lock (this)
     {
         while (_buffer != null && !_close)
         {
             Monitor.Wait(this);
         }
         if (_close)
         {
             e.ContinueOperation = false;
             Monitor.Pulse(this);
             return;
         }
         if (_rewind)
         {
             e.ContinueOperation = false;
             Monitor.Pulse(this);
             return;
         }
         _buffer             = e.Data;
         _length             = _buffer.Length;
         _offset             = 0;
         e.ContinueOperation = true;
         Monitor.Pulse(this);
     }
 }
Esempio n. 3
0
		protected virtual int OnDataAvailable(IntPtr p1, int p2)
		{
			int result=1;
			if(this.currentFile!=null)
				this.currentFile.BytesExtracted+=p2;
			if(this.DataAvailable!=null)
			{
				byte[] data=new byte[p2];
				Marshal.Copy(p1, data, 0, p2);
				DataAvailableEventArgs e=new DataAvailableEventArgs(data);
				this.DataAvailable(this, e);
				if(!e.ContinueOperation)
					result=-1;
			}
			if((this.ExtractionProgress!=null) && (this.currentFile!=null))
			{
				CompressionExtractionProgressEventArgs e = new CompressionExtractionProgressEventArgs();
				e.FileName=this.currentFile.FileName;
				e.FileSize=this.currentFile.UnpackedSize;
				e.BytesExtracted=this.currentFile.BytesExtracted;
				e.PercentComplete=this.currentFile.PercentComplete;
				this.ExtractionProgress(this, e);
				if(!e.ContinueOperation)
					result=-1;
			}
			return result;
		}
Esempio n. 4
0
		private void unrar_DataAvailable(object sender, DataAvailableEventArgs e)
		{
			lock (this)
			{
				while (_buffer != null && !_close)
					Monitor.Wait(this);
				if (_close)
				{
					e.ContinueOperation = false;
					Monitor.Pulse(this);
					return;
				}
				if (_rewind)
				{
					e.ContinueOperation = false;
					Monitor.Pulse(this);
					return;
				}
				_buffer = e.Data;
				_length = _buffer.Length;
				_offset = 0;
				e.ContinueOperation = true;
				Monitor.Pulse(this);
			}
		}