2 using System
.Collections
.Generic
;
6 using ShareDiscoveryService
;
10 public class AltSpider
12 public static DiscoveryTreeNode
IndexFolder( string directoryName
)
14 FileInfo dirinfo
= new FileInfo( directoryName
);
17 = new DiscoveryTreeNode
20 Name
= Path
.GetFileName( directoryName
),
21 CreatedAt
= dirinfo
.CreationTime
,
22 LastAccessedAt
= dirinfo
.LastAccessTime
,
23 LastModifiedAt
= dirinfo
.LastWriteTime
26 List
<DiscoveryTreeNode
> listing
= new List
<DiscoveryTreeNode
>();
30 string[] subdirs
= Directory
.GetDirectories( directoryName
);
31 string[] subfiles
= Directory
.GetFiles( directoryName
);
33 if ( subdirs
.Length
== 0 && subfiles
.Length
== 0 )
41 from directory
in subdirs
42 let child
= IndexFolder( directory
)
46 from fileName
in subfiles
47 let info
= new FileInfo( fileName
)
54 CreatedAt
= info
.CreationTime
,
55 LastAccessedAt
= info
.LastAccessTime
,
56 LastModifiedAt
= info
.LastWriteTime
61 catch ( UnauthorizedAccessException ex
)
63 Console
.Error
.WriteLine( "Access denied to {0}", directoryName
);
65 catch ( IOException ex
)
67 Console
.Error
.WriteLine( "Cannot read {0}: {1}", directoryName
, ex
.Message
);