Example #1
0
 public FsObject<AbsPath> GetFile(RelPath fileName)
 {
     AbsPath path = fileName.AbsoluteIn(MainPath);
     return MainFileIndex.GetObjectAbs(path);
 }
Example #2
0
        /*

        [ForeignThreadEntryPoint]
        private void Finish(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            _queue.Add(() =>
            {
                if(!_startDelayTimerFired)
                {
                    _startDelayTimerFired = true;

                    foreach (FileEvent fileEvent in _eventQueue)
                    {
                        switch (fileEvent.EventType)
                        {
                            case FileEvents.Created:
                            {
                                try
                                {
                                    _indexedObjects.AddObject(LoadFile(fileEvent.Path));
                                }
                                catch (FileNotFoundException)
                                {
                                    // it was probably already deleted
                                }

                                break;
                            }
                            case FileEvents.Changed:
                            {

                                try
                                {
                                    _indexedObjects.ChangeFile((FsFile<RelPath>) LoadFile(fileEvent.Path));
                                }
                                catch (FileNotFoundException)
                                {
                                    // it was probably already deleted
                                }
                                break;
                            }
                            case FileEvents.Deleted:
                            {
                                _indexedObjects.Remove(fileEvent.Path);
                                break;
                            }
                        }
                    }

                    _endingTimer.Start();

                }

            });

        }
        */
        private FsObject<RelPath> LoadFile(RelPath path)
        {
            AbsPath absPath = path.AbsoluteIn(_absDirPath);
            return FsObject<AbsPath>.ReadFrom(absPath).RelativeTo(_absDirPath);
        }