public Task <IFileItem> GetFileItemAsync(string path)
        {
            path = FixupPath(path);

            if (!File.Exists(path))
            {
                return(Task.FromResult <IFileItem>(null));
            }

            var fileItem = new LocalFileItem
            {
                _path     = path,
                _rootPath = this._rootPath
            };

            return(Task.FromResult <IFileItem>(fileItem));
        }
示例#2
0
        private void FileCreated(object sender, FileSystemEventArgs e)
        {
            // relative path is needed here.
            var path = e.FullPath.Replace(_rootPath, string.Empty);

            if (path.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
            {
                path = path.Remove(0, 1);
            }

            path = path.Replace("\\", "/");

            var localFileItem = new LocalFileItem
            {
                _path     = path,
                _rootPath = this._rootPath,
            };

            _callback(localFileItem, DateTime.Now);
        }