예제 #1
0
 public virtual string CreateDirectoryStructure(string table, Stack <string> dirsToCreate, string pathId, SqlConnection conn)
 {
     while (dirsToCreate.Count > 0)
     {
         pathId = FileTableRepo.CreateDirectory(table, dirsToCreate.Pop(), pathId, conn);
     }
     return(pathId);
 }
예제 #2
0
 public virtual SqlHierarchyId CreateDirectoryStructure(string table, Stack <string> dirsToCreate, SqlHierarchyId pathId, SqlConnection conn, bool pipeToOutput)
 {
     while (dirsToCreate.Count > 0)
     {
         var dir = dirsToCreate.Pop();
         pathId = FileTableRepo.CreateDirectory(table, dir, pathId, conn, pipeToOutput);
     }
     return(pathId);
 }
예제 #3
0
        public void BuildGetFilesQuery_RecursiveTrue_ExcludeDataTrue_ExcludeDirectoriesTrue_Test()
        {
            // Arrange
            var repo     = new FileTableRepo();
            var expected = "SELECT [stream_id], null as [file_stream],[name],[path_locator],[parent_path_locator],[file_type],[cached_file_size],[creation_time],[last_write_time],[last_access_time],[is_directory],[is_offline],[is_hidden],[is_readonly],[is_archive],[is_system],[is_temporary] FROM Table1 WHERE path_locator.IsDescendantOf(@dirId) = 1 AND is_directory = 0";

            // Act
            var actual = repo.BuildGetFilesQuery("Table1", true, true, true);

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public string CreateFile(string table, string path, byte[] data, SqlConnection conn)
        {
            var file   = Path.GetFileName(path);
            var dir    = Path.GetDirectoryName(path);
            var pathId = DirectoryExists(table, dir, conn);

            if (string.IsNullOrWhiteSpace(pathId))
            {
                pathId = CreateDirectory(table, dir, conn);
            }
            var hierarchyId = FileTableRepo.CreateFile(table, file, HierarchyBuilder.NewChildHierarchyId(pathId), data, conn);

            return(hierarchyId);
        }
예제 #5
0
        public void IsTableRootTest()
        {
            // Arrange
            var server        = @"\\server";
            var serverFQDN    = @"\\server.domain.tld";
            var inst          = "instdir";
            var db            = "dbdir";
            var table         = "tdir";
            var tableRoot     = Path.Combine(server, inst, db, table);
            var tableRootFqdn = Path.Combine(serverFQDN, inst, db, table);
            var repo          = new FileTableRepo();

            var testDir  = TestContext.DataRow[0].ToString();
            var expected = Convert.ToBoolean(TestContext.DataRow[1]);

            // Act
            var actual = repo.IsTableRoot(testDir, tableRoot, tableRootFqdn);

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #6
0
 public virtual string FileExists(string table, string path, SqlConnection conn)
 {
     return(FileTableRepo.FindPath(table, path, false, conn));
 }
예제 #7
0
 public virtual string DirectoryExists(string table, string path, SqlConnection conn)
 {
     return(FileTableRepo.FindPath(table, path, true, conn));
 }
예제 #8
0
 public int RenameFile(string table, SqlHierarchyId hierarchyid, string filename, SqlConnection conn)
 {
     return(FileTableRepo.RenameFile(table, hierarchyid, filename, conn));
 }
예제 #9
0
 public int RenameFile(string table, Guid stream_id, string filename, SqlConnection conn)
 {
     return(FileTableRepo.RenameFile(table, stream_id, filename, conn));
 }
예제 #10
0
 public int DeleteFile(string table, SqlHierarchyId hierarchyid, SqlConnection conn)
 {
     return(FileTableRepo.DeleteFile(table, hierarchyid, conn));
 }
예제 #11
0
 public int DeleteFile(string table, Guid stream_id, SqlConnection conn)
 {
     return(FileTableRepo.DeleteFile(table, stream_id, conn));
 }
예제 #12
0
 public IEnumerable <File> ListFiles(string table, string directory, SqlConnection conn, bool recursive, bool excludeData, bool excludeDirectories)
 {
     return(FileTableRepo.ListFiles(table, directory, conn, recursive, excludeData, excludeDirectories));
 }