示例#1
0
 public TimedAction(FsObject<RelPath> descriptor, TimerCallback callback, long dueTime, long period)
 {
     _descriptor = descriptor;
     _callback = callback;
     _dueTime = dueTime;
     _period = period;
     _tickTimer = new Timer(callback, this, dueTime, period);
 }
示例#2
0
        private FsObject[] Info(string[] paths)
        {
            FsObject[] data = new FsObject[paths.Length];
            for (var i = 0; i < paths.Length; i++)
            {
                data[i] = _drive.Info(paths[i]);
            }

            return(data);
        }
示例#3
0
 private void FileMovedRenamed(FsObject<RelPath> sourceFile, FsObject<RelPath> targetFile)
 {
     if (SameGroup(sourceFile.Path, targetFile.Path))
     {
         Console.WriteLine("File Moved or Renamed from: " + sourceFile.Path + " to: " + targetFile.Path);
         FileIndex.Remove(sourceFile);
         FileIndex.Add(targetFile);
     }
     else
     {
         FileDeleted(sourceFile);
         FileCreated(targetFile);
     }
 }
示例#4
0
        private void FileCreated(FsObject<RelPath> descriptor)
        {
            // string relPath = fileModule.Network.MainPath.CreateRelative(path);
            Console.WriteLine("Object Created: {0}", descriptor.Path);

            FileIndex.Add(descriptor);
            //            try
            //            {
            //                FileOrFolder objectType = GetObjectType(path);
            //                string relativePath = fileModule.Network.MainPath.CreateRelative(path);
            //                var message = new SingleFileMessage(relativePath, objectType, SinglePathFileEvent.Created);
            //
            //                var task = new FileCreatedFirstSideTask(fileModule, message);
            //            }
            //            catch (Exception e)
            //            {
            //
            //                Console.WriteLine(e);
            //            }
        }
 public TimedFolderDeletion(FsObject<RelPath> descriptor, TimerCallback callback, IndexedObjects indexedContent)
     : base(descriptor, callback, ChangeWatcher.DeleteWaitTime, Timeout.Infinite)
 {
     _indexedContent = indexedContent;
 }
示例#6
0
        public void AddObject(FsObject<RelPath> descriptor)
        {
            DirNode parent = GetParentDir(descriptor.Path);

            if (descriptor is FsFile<RelPath>)
            {
                var file = ((FsFile<RelPath>) descriptor).NewAsName();
                parent.Files.Add(file.Path, file);

            }
            else
            {
                var dir = ((FsFolder<RelPath>)descriptor).NewAsName();
                var node = new DirNode(dir, parent);
                parent.Directories.Add(dir.Path, node);
            }
        }
示例#7
0
 public bool TryGetObject(RelPath path, out FsObject<RelPath> fsObject)
 {
     throw new NotImplementedException();
 }
 public TimedNewFileTracking(FsObject<RelPath> descriptor, TimerCallback callback, long dueTile, long period)
     : base(descriptor, callback, dueTile, period)
 {
 }
示例#9
0
 private void FileReplaced(FsObject<RelPath> sourceObj, FsObject<RelPath> targetObj)
 {
     Console.WriteLine("File Replaced from: " + sourceObj.Path + " to: " + targetObj.Path);
 }
示例#10
0
 private void FileDeleted(FsObject<RelPath> storedDescr)
 {
     Console.WriteLine("File Deleted: " + storedDescr.Path);
     FileIndex.Remove(storedDescr);
 }