public TempDirecrtoryGrabber(Options options_) { options = options_; if (options.target_directory == "[[TEMP]]") { ConProxy.write_verbose ("Special directory (Temporary) requested to be a target"); temp_directory = Path.GetTempPath(); } else { temp_directory = options.target_directory; } //fs_watcher.IncludeSubdirectories = true; ConProxy.write_verbose ("Target directory: {0}", temp_directory); fs_watcher = new FileSystemWatcher (temp_directory, options.files_filter); fs_watcher.Created += new FileSystemEventHandler (onCreated); fs_watcher.Changed += new FileSystemEventHandler (onChanged); prepare_output_dir(); }
public static void Main(string[] args) { ManualResetEvent stop_ack = new ManualResetEvent(false); var options = new Options (); ConProxy.options = options; ICommandLineParser parser = new CommandLineParser (); if (parser.ParseArguments (args, options)) { var grabber = new TempDirecrtoryGrabber (options); Console.CancelKeyPress += delegate { Console.WriteLine("dirgrabber: ctrl+c received"); grabber.stop(); stop_ack.WaitOne(stop_time_out_msec); }; ConProxy.write_verbose("Starting monitor.."); grabber.start(); ConProxy.write_verbose("Monitor stopped, saving results.."); grabber.save_results(); ConProxy.write_verbose("Exiting"); stop_ack.Set(); } else { Console.WriteLine(options.getUsage()); } }
public static bool validate(Options opts) { // TODO: Implement validations for file-filter parameter return true; }