예제 #1
0
        public FsItemInfo GetItemInfo(ReadOnlySpan<char> path)
        {
            var d = PathUtils.SplitDirAndFile(path, out var ff).ToString();
            var f = ff.ToString();
            if (_content.TryGetValue(new KeyValuePair<string, string>(d, f), out var file))
            {
                if (file == null)
                    return FsItemInfo.Directory(d, false);
                return FsItemInfo.Existing(d, file._length, file._lastWriteTimeUtc);
            }

            return FsItemInfo.Missing();
        }
예제 #2
0
        public FsItemInfo GetItemInfo(string path)
        {
            var fad = PathUtils.SplitDirAndFile(path);

            if (_content.TryGetValue(new KeyValuePair <string, string>(fad.Item1, fad.Item2), out var file))
            {
                if (file == null)
                {
                    return(FsItemInfo.Directory(fad.Item2, false));
                }
                return(FsItemInfo.Existing(fad.Item2, file._length, file._lastWriteTimeUtc));
            }
            return(FsItemInfo.Missing());
        }
예제 #3
0
        public IReadOnlyList<FsItemInfo> GetDirectoryContent(string path)
        {
            var res = new List<FsItemInfo>();
            foreach (var kv in _content)
            {
                if (kv.Key.Key != path) continue;
                if (kv.Value == null)
                    res.Add(FsItemInfo.Directory(kv.Key.Value, false));
                else
                    res.Add(FsItemInfo.Existing(kv.Key.Value, kv.Value._length, kv.Value._lastWriteTimeUtc));
            }

            return res;
        }