Exemple #1
0
        static void Main(string[] args)
        {
            string currentDir  = Directory.GetCurrentDirectory();
            var    directory   = new DirectoryInfo(currentDir).Parent.Parent.FullName.ToString();
            var    _mainPath   = directory + @"\NewFolder1";
            var    _mirrorPath = directory + @"\NewFolder2";


            FileEvents file = new FileEvents(_mainPath, _mirrorPath);

            CheckForNewDir(_mainPath, _mirrorPath);

            file.ActivateFileEvents();


            Console.WriteLine("Press any key");

            Console.ReadLine();
        }
 public FileEvent(RelPath path, FileEvents eventType)
 {
     _path = path;
     _eventType = eventType;
 }
        /// <summary>
        ///   Adds to the queue an event that happened inside the folder while indexing.
        ///  Warning: Should be invoked on _queue thread.
        /// </summary>
        /// <param name = "path">Path to an object, relative to indexing root.</param>
        /// <param name = "eventType"></param>
        public bool AddEvent(RelPath path, FileEvents eventType)
        {
            if (!_startDelayTimerFired)
            {

                //_eventQueue.Add(new FileEvent(path, eventType));
                // refresh timer.
                _startDelayTimer.Interval = FinishDelay;
                return true;
            }
            if (!_endingTimerFired)
            {
                _toRemove.Enqueue(path);
                return false;
            }
            return false;
        }