示例#1
0
        public RemoteFileInfo[] GetFileListing(string folder, DirectoryListOptions listOptions)
        {
            //MAKE SURE THE FOLDER IS IN THE PROPER FORMAT FOR THE DATABASE
            folder = FormatFolder(folder);

            using (DistributedFileStorageDBDataContext tmpDB = new DistributedFileStorageDBDataContext(ConfigurationManager.ConnectionStrings.Cast <ConnectionStringSettings>().ToArray().Shuffle()[0].ConnectionString))
            {
                if (listOptions == DirectoryListOptions.SelectedFolderOnly)
                {
                    return(tmpDB.FileMarkers.Where(a => a.Folder == folder).Select(a => new RemoteFileInfo()
                    {
                        Folder = a.Folder, FileName = a.FileName, LastWriteTime = a.LastWriteTime, LastModTime = a.LastModTime, LastReadTime = a.LastReadTime, Length = a.Length, RemoteLocations = a.FileLocations.Select(b => b.Location).ToArray()
                    }).ToArray());
                }
                else if (listOptions == DirectoryListOptions.AllSubDirectories)
                {
                    return(tmpDB.FileMarkers.Where(a => a.Folder.StartsWith(folder)).Select(a => new RemoteFileInfo()
                    {
                        Folder = a.Folder, FileName = a.FileName, LastWriteTime = a.LastWriteTime, LastModTime = a.LastModTime, LastReadTime = a.LastReadTime, Length = a.Length, RemoteLocations = a.FileLocations.Select(b => b.Location).ToArray()
                    }).ToArray());
                }
                else
                {
                    throw new ArgumentException("Invalid parameter specified for listingOptions");
                }
            }
        }
 public RemoteFileInfo[] GetFileListing(string folder, DirectoryListOptions listOptions)
 {
     object[] results = this.Invoke("GetFileListing", new object[] {
         folder,
         listOptions
     });
     return((RemoteFileInfo[])(results[0]));
 }
 public string[] GetDirectoryListing(string folder, DirectoryListOptions listOptions)
 {
     object[] results = this.Invoke("GetDirectoryListing", new object[] {
         folder,
         listOptions
     });
     return((string[])(results[0]));
 }
 /// <remarks/>
 public void GetFileListingAsync(string folder, DirectoryListOptions listOptions, object userState)
 {
     if ((this.GetFileListingOperationCompleted == null))
     {
         this.GetFileListingOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFileListingOperationCompleted);
     }
     this.InvokeAsync("GetFileListing", new object[] {
         folder,
         listOptions
     }, this.GetFileListingOperationCompleted, userState);
 }
示例#5
0
        public string[] GetDirectoryListing(string folder, DirectoryListOptions listOptions)
        {
            //MAKE SURE THE FOLDER IS IN THE PROPER FORMAT FOR THE DATABASE
            folder = FormatFolder(folder);

            using (DistributedFileStorageDBDataContext tmpDB = new DistributedFileStorageDBDataContext(ConfigurationManager.ConnectionStrings.Cast <ConnectionStringSettings>().ToArray().Shuffle()[0].ConnectionString))
            {
                int folderDepth = folder.Split('/').Length;
                if (listOptions == DirectoryListOptions.SelectedFolderOnly)
                {
                    return(tmpDB.FileMarkers.Where(a => a.Folder.StartsWith(folder)).Select(a => a.Folder).Distinct().ToArray().Where(a => a.Split('/').Length == folderDepth + 1).ToArray());
                }
                else if (listOptions == DirectoryListOptions.AllSubDirectories)
                {
                    return(tmpDB.FileMarkers.Where(a => a.Folder.StartsWith(folder)).Select(a => a.Folder).Distinct().ToArray());
                }
                else
                {
                    throw new ArgumentException("Invalid parameter specified for listingOptions");
                }
            }
        }
 /// <remarks/>
 public void GetFileListingAsync(string folder, DirectoryListOptions listOptions)
 {
     this.GetFileListingAsync(folder, listOptions, null);
 }