コード例 #1
0
ファイル: RoutedCollection.cs プロジェクト: Pater1/Hotplay
        public async Task <IReadOnlyCollection <IEntry> > GetChildrenAsync(CancellationToken ct)
        {
            IReadOnlyCollection <IEntry> wrapAndRet = await collection.GetChildrenAsync(ct);

            IEntry[]          ret        = new IEntry[wrapAndRet.Count];
            ChainedFileSystem fileSystem = chainedFileSystem;

            int i = 0;

            foreach (var r in wrapAndRet)
            {
                int j = i++;
                if (r is IDocument)
                {
                    ret[j] = new RoutedDocument(fileSystem, r as IDocument);
                }
                else
                {
                    ret[j] = new RoutedCollection(fileSystem, r as ICollection);
                }
            }

            //Parallel.ForEach(wrapAndRet, r => {
            //    int j = i++;
            //    if(r is IDocument) {
            //        ret[j] = new RoutedDocument(fileSystem, r as IDocument);
            //    } else {
            //        ret[j] = new RoutedCollection(fileSystem, r as ICollection);
            //    }
            //});
            return(ret);
        }
コード例 #2
0
ファイル: RoutedCollection.cs プロジェクト: Pater1/Hotplay
        public async Task <IEntry> GetChildAsync(string name, CancellationToken ct)
        {
            IEntry ret = await collection.GetChildAsync(name, ct);

            if (ret is IDocument)
            {
                ret = new RoutedDocument(chainedFileSystem, ret as IDocument);
            }
            else
            {
                ret = new RoutedCollection(chainedFileSystem, ret as ICollection);
            }
            return(ret);
        }