Event arguments for scanning.
Inheritance: System.EventArgs
 private void OnCompleteFile(string file)
 {
     CompletedFileHandler completedFile = this.CompletedFile;
     if (completedFile != null)
     {
         ScanEventArgs e = new ScanEventArgs(file);
         completedFile(this, e);
         this.alive_ = e.ContinueRunning;
     }
 }
Example #2
0
 public bool OnCompletedFile(string file)
 {
     bool continueRunning = true;
     CompletedFileHandler completedFile = this.CompletedFile;
     if (completedFile != null)
     {
         ScanEventArgs e = new ScanEventArgs(file);
         completedFile(this, e);
         continueRunning = e.ContinueRunning;
     }
     return continueRunning;
 }
Example #3
0
 public bool OnProcessFile(string file)
 {
     bool continueRunning = true;
     ProcessFileHandler processFile = this.ProcessFile;
     if (processFile != null)
     {
         ScanEventArgs e = new ScanEventArgs(file);
         processFile(this, e);
         continueRunning = e.ContinueRunning;
     }
     return continueRunning;
 }
Example #4
0
		/// <summary>
		/// Raises the ProcessFileEvent.
		/// </summary>
		/// <param name="file">The file for this event.</param>
		public void OnProcessFile(string file)
		{
			if ( ProcessFile != null ) {
				ScanEventArgs args = new ScanEventArgs(file);
				ProcessFile(this, args);
			}
		}
Example #5
0
        void ProcessFile(object sender, ScanEventArgs e)
        {
            if ( (events_ != null) && (events_.ProcessFile != null) ) {
                events_.ProcessFile(sender, e);
            }

            if ( e.ContinueRunning ) {
                ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);
                outputStream_.PutNextEntry(entry);
                AddFileContents(e.Name);
            }
        }
Example #6
0
 void ProcessFile(object sender, ScanEventArgs e)
 {
     Console.WriteLine(e.Name);
 }
Example #7
0
		/// <summary>
        /// Fires the <see cref="CompletedFile"/> delegate
		/// </summary>
		/// <param name="file">The file whose processing has been completed.</param>
		/// <returns>A boolean indicating if execution should continue or not.</returns>
		public bool OnCompletedFile(string file)
		{
			bool result = true;
			CompletedFileHandler handler = CompletedFile;
			if ( handler != null ) {
				ScanEventArgs args = new ScanEventArgs(file);
				handler(this, args);
				result = args.ContinueRunning;
			}
			return result;
		}
        /// <summary>
        /// Raise the complete file event
        /// </summary>
        /// <param name="file">The file name</param>
        void OnCompleteFile(string file)
        {
            CompletedFileHandler handler = CompletedFile;

            if (handler != null)
            {
                ScanEventArgs args = new ScanEventArgs(file);
                handler(this, args);
                alive_ = args.ContinueRunning;
            }
        }
		/// <summary>
		/// Raise the ProcessFile event.
		/// </summary>
		/// <param name="file">The file name.</param>
		public void OnProcessFile(string file)
		{
			if ( ProcessFile != null ) {
				ScanEventArgs args = new ScanEventArgs(file);
				ProcessFile(this, args);
				alive_ = args.ContinueRunning;
			}
		}
Example #10
0
 private void OnProcessFile(string file)
 {
     ProcessFileHandler processFile = this.ProcessFile;
     if (processFile != null)
     {
         ScanEventArgs e = new ScanEventArgs(file);
         processFile(this, e);
         this.alive_ = e.ContinueRunning;
     }
 }
        private void ProcessFileMethod(object sender, ScanEventArgs args)
        {
            _uptoFileCount++;
            int percentCompleted = _uptoFileCount * 100 / _totalFileCount;
            // do something here with a progress bar

            // file counts are easier as sizes take more work to calculate, and compression levels vary by file type
            string fileName = args.Name;
            // To terminate the process, set args.ContinueRunning = false
            if (fileName == "stop on this file")
                args.ContinueRunning = false;

        }
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     _output.Output("Processing file: " + e.Name);
 }
Example #13
0
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     if ((this.events_ != null) && (this.events_.ProcessFile != null))
     {
         this.events_.ProcessFile(sender, e);
     }
     if (e.ContinueRunning)
     {
         try
         {
             using (FileStream stream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 ZipEntry entry = this.entryFactory_.MakeFileEntry(e.Name);
                 this.outputStream_.PutNextEntry(entry);
                 this.AddFileContents(e.Name, stream);
             }
         }
         catch (Exception exception)
         {
             if (this.events_ == null)
             {
                 this.continueRunning_ = false;
                 throw;
             }
             this.continueRunning_ = this.events_.OnFileFailure(e.Name, exception);
         }
     }
 }
Example #14
0
		/// <summary>
		/// Callback for adding a new file.
		/// </summary>
		/// <param name="sender">The scanner calling this delegate.</param>
		/// <param name="args">The event arguments.</param>
		void ProcessFile(object sender, ScanEventArgs args)
		{
			if ( !silent_ )
			{
				Console.WriteLine(args.Name);
			}
			activeZipFile_.Add(args.Name);
		}
Example #15
0
 /// <summary>
 /// Callback for adding a new file.
 /// </summary>
 /// <param name="sender">The scanner calling this delegate.</param>
 /// <param name="args">The event arguments.</param>
 void ProcessFile(object sender, ScanEventArgs args)
 {
     activeZipFile_.Add(args.Name);
 }
Example #16
0
        /// <summary>
        /// Fires the <see cref="ProcessFile">ProcessFile delegate</see>.
        /// </summary>
        /// <param name="file">The file being processed.</param>
        /// <returns>A boolean indicating if execution should continue or not.</returns>
        public bool OnProcessFile(string file)
        {
            bool result = true;
            ProcessFileHandler handler = ProcessFile;

            if (handler != null) {
                var args = new ScanEventArgs(file);
                handler(this, args);
                result = args.ContinueRunning;
            }
            return result;
        }
		/// <summary>
		/// Raise the complete file event
		/// </summary>
		/// <param name="file">The file name</param>
		void OnCompleteFile(string file)
		{
			if (CompletedFile != null)
			{
				ScanEventArgs args = new ScanEventArgs(file);
				CompletedFile(this, args);
				alive_ = args.ContinueRunning;
			}
		}
Example #18
0
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     if (e.ContinueRunning)
     {
         using (FileStream stream = File.OpenRead(e.Name))
         {
             ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);
             outputStream_.PutNextEntry(entry);
             AddFileContents(stream);
         }
     }
 }
Example #19
0
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     Log.LogMessage(Properties.Resources.UnzipExtracted, e.Name);
 }
        /// <summary>
        /// Raise the ProcessFile event.
        /// </summary>
        /// <param name="file">The file name.</param>
        void OnProcessFile(string file)
        {
            ProcessFileHandler handler = ProcessFile;

            if ( handler!= null ) {
                ScanEventArgs args = new ScanEventArgs(file);
                handler(this, args);
                alive_ = args.ContinueRunning;
            }
        }
Example #21
0
		void ProcessFile(object sender, ScanEventArgs e)
		{
			//if ( (events_ != null) && (events_.ProcessFile != null) ) {
			//	events_.ProcessFile(sender, e);
			//}
			
			//if ( e.ContinueRunning ) {
			//	try {
			//		// The open below is equivalent to OpenRead which gaurantees that if opened the 
			//		// file will not be changed by subsequent openers, but precludes opening in some cases
			//		// were it could succeed. ie the open may fail as its already open for writing and the share mode should reflect that.
			//		using (FileStream stream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read)) {
			//			ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);
			//			outputStream_.PutNextEntry(entry);
			//			AddFileContents(e.Name, stream);
			//		}
			//	}
			//	catch(Exception ex) {
			//		if (events_ != null) {
			//			continueRunning_ = events_.OnFileFailure(e.Name, ex);
			//		}
			//		else {
			//			continueRunning_ = false;
			//			throw;
			//		}
			//	}
			//}
		}
Example #22
0
		void ProcessFile(object sender, ScanEventArgs e)
		{
			if ( (events_ != null) && (events_.ProcessFile != null) ) {
				events_.ProcessFile(sender, e);
			}
			
			if ( e.ContinueRunning ) {
                try {
                    // The open below is equivalent to OpenRead which gaurantees that if opened the 
                    // file will not be changed by subsequent openers, but precludes opening in some cases
                    // were it could succeed.
                    using (FileStream stream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);
                        outputStream_.PutNextEntry(entry);
                        AddFileContents(e.Name, stream);
                    }
                }
                catch(Exception ex) {
                    if (events_ != null) {
                        continueRunning_ = events_.OnFileFailure(e.Name, ex);
                    }
                    else {
                        continueRunning_ = false;
                        throw;
                    }
                }
			}
		}
Example #23
0
 public void ProcessFile(Object sender, ScanEventArgs e)
 {
     label2.SafeInvoke(d => d.Text = e.Name);
     changeprogressbar(progressBar2, 1);
     textBox4.SafeInvoke(d => d.Text = Convert.ToInt32(((Convert.ToDecimal(progressBar2.Value) / Convert.ToDecimal(progressBar2.Maximum)) * 100)).ToString() + "% concluĂ­do");
 }
Example #24
0
 void ListFile(object sender, ScanEventArgs e)
 {
     Console.WriteLine("{0}", e.Name);
 }
Example #25
0
		void ProcessFile(object sender, ScanEventArgs e)
		{
			if ( events != null ) {
				events.OnProcessFile(e.Name);
			}
			string cleanedName = nameTransform.TransformFile(e.Name);
			ZipEntry entry = new ZipEntry(cleanedName);
			outputStream.PutNextEntry(entry);
			AddFileContents(e.Name);
		}
Example #26
0
 /// <summary>
 /// Fires the <see cref="ProcessFile">Process File delegate</see>.
 /// </summary>
 /// <param name="file">The file being processed.</param>
 /// <returns>A boolean indicating if execution should continue or not.</returns>
 public bool OnProcessFile(string file)
 {
     bool result = true;
     if ( ProcessFile != null ) {
         ScanEventArgs args = new ScanEventArgs(file);
         ProcessFile(this, args);
         result = args.ContinueRunning;
     }
     return result;
 }
Example #27
0
 private void ProcessFileMethod(object sender, ScanEventArgs args)
 {
     string fileName = args.Name;
     // To stop all further processing, set args.ContinueRunning = false
     if (_stop)
     {
         args.ContinueRunning = false;
     }
 }