コード例 #1
0
        public void CreateExisting(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            DiscDirectoryInfo dirInfo = fs.GetDirectoryInfo("SOMEDIR");

            dirInfo.Create();
            dirInfo.Create();

            Assert.AreEqual(1, fs.Root.GetDirectories().Length);
        }
コード例 #2
0
ファイル: DiffVHD.cs プロジェクト: virmitio/TempRepo
        internal static void CreateDirectoryTree(DiscDirectoryInfo source, DiscDirectoryInfo destination)
        {
            try
            {
                if (source == null)
                    throw new ArgumentNullException("source");
                if (destination == null)
                    throw new ArgumentNullException("destination");
                if (destination.Exists) return;

                if (!destination.Parent.Exists)
                    CreateDirectoryTree(source.Parent, destination.Parent);

                destination.Create();
                destination.Attributes = source.Attributes;
                if (destination.FileSystem is NtfsFileSystem)
                {
                    var D = (NtfsFileSystem) destination.FileSystem;
                    var S = (NtfsFileSystem) source.FileSystem;
                    D.SetSecurity(destination.FullName, S.GetSecurity(source.FullName));

                    D.SetFileStandardInformation(destination.FullName, S.GetFileStandardInformation(source.FullName));
                }
                else
                {
                    destination.CreationTimeUtc = source.CreationTimeUtc;
                    destination.LastWriteTimeUtc = source.LastWriteTimeUtc;
                    destination.LastAccessTimeUtc = source.LastAccessTimeUtc;
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
コード例 #3
0
        public void CreateInvalid_Characters(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            DiscDirectoryInfo dirInfo = fs.GetDirectoryInfo("SOME\0DIR");

            dirInfo.Create();
        }
コード例 #4
0
        public void CreateInvalid_Long(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            DiscDirectoryInfo dirInfo = fs.GetDirectoryInfo(new String('X', 256));

            dirInfo.Create();
        }
コード例 #5
0
        public void CreateRecursive(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            DiscDirectoryInfo dirInfo = fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR");

            dirInfo.Create();

            Assert.AreEqual(1, fs.Root.GetDirectories().Length);
            Assert.AreEqual(1, fs.GetDirectoryInfo(@"SOMEDIR").GetDirectories().Length);
            Assert.AreEqual("CHILDDIR", fs.GetDirectoryInfo(@"SOMEDIR").GetDirectories()[0].Name);
        }
コード例 #6
0
        public void Exists(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            DiscDirectoryInfo dirInfo = fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR");

            dirInfo.Create();

            Assert.IsTrue(fs.GetDirectoryInfo(@"\").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR").Exists);
            Assert.IsTrue(fs.GetDirectoryInfo(@"SOMEDIR\CHILDDIR\").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"NONDIR").Exists);
            Assert.IsFalse(fs.GetDirectoryInfo(@"SOMEDIR\NONDIR").Exists);
        }