public void GetDirectories() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"A.DIR"); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(2, fs.Root.GetDirectories().Length); DiscDirectoryInfo someDir = fs.Root.GetDirectories(@"SoMeDir")[0]; Assert.AreEqual(1, fs.Root.GetDirectories("SOMEDIR").Length); Assert.AreEqual("SOMEDIR", someDir.Name); Assert.AreEqual(1, someDir.GetDirectories("*.*").Length); Assert.AreEqual("CHILD", someDir.GetDirectories("*.*")[0].Name); Assert.AreEqual(2, someDir.GetDirectories("*.*", SearchOption.AllDirectories).Length); Assert.AreEqual(4, fs.Root.GetDirectories("*.*", SearchOption.AllDirectories).Length); Assert.AreEqual(2, fs.Root.GetDirectories("*.*", SearchOption.TopDirectoryOnly).Length); Assert.AreEqual(1, fs.Root.GetDirectories("*.DIR", SearchOption.AllDirectories).Length); Assert.AreEqual(@"A.DIR\", fs.Root.GetDirectories("*.DIR", SearchOption.AllDirectories)[0].FullName); Assert.AreEqual(1, fs.Root.GetDirectories("GCHILD", SearchOption.AllDirectories).Length); Assert.AreEqual(@"SOMEDIR\CHILD\GCHILD\", fs.Root.GetDirectories("GCHILD", SearchOption.AllDirectories)[0].FullName); }
public void GetFileSystemInfos() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"AAA.EXT"); builder.AddFile(@"FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD\GCHILD\BAR.TXT", new byte[10]); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(3, fs.Root.GetFileSystemInfos().Length); Assert.AreEqual(1, fs.Root.GetFileSystemInfos("*.EXT").Length); Assert.AreEqual(2, fs.Root.GetFileSystemInfos("*.?XT").Length); }
public void Parent() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR"); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(fs.Root, fs.Root.GetDirectories("SOMEDIR")[0].Parent); }
public void GetFiles() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"AAA.DIR"); builder.AddFile(@"FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD\GCHILD\BAR.TXT", new byte[10]); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(1, fs.Root.GetFiles().Length); Assert.AreEqual("FOO.TXT", fs.Root.GetFiles()[0].FullName); Assert.AreEqual(2, fs.Root.GetDirectories("SOMEDIR")[0].GetFiles("*.TXT").Length); Assert.AreEqual(4, fs.Root.GetFiles("*.TXT", SearchOption.AllDirectories).Length); Assert.AreEqual(0, fs.Root.GetFiles("*.DIR", SearchOption.AllDirectories).Length); }
public void BuildISO(Stream ISOOpen, string pathSave) { CDReader cd = new CDReader(ISOOpen, true); CDBuilder cb = new CDBuilder(); cb.UseJoliet = true; foreach (DiscFileInfo file in cd.Root.GetFiles("*.*", SearchOption.AllDirectories)) { foreach (DiscDirectoryInfo dir in cd.Root.GetDirectories("*.*", SearchOption.AllDirectories)) { cb.AddDirectory(dir.Name); cb.AddFile(file.FullName, cd.OpenFile(file.FullName, FileMode.Open)); } } cb.Build(pathSave); }
public void Attributes() { // Start time rounded down to whole seconds DateTime start = DateTime.UtcNow; start = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second); CDBuilder builder = new CDBuilder(); builder.AddDirectory("Foo"); CDReader fs = new CDReader(builder.Build(), false); DateTime end = DateTime.UtcNow; DiscDirectoryInfo di = fs.GetDirectoryInfo("Foo"); Assert.AreEqual(FileAttributes.Directory | FileAttributes.ReadOnly, di.Attributes); Assert.GreaterOrEqual(di.CreationTimeUtc, start); Assert.LessOrEqual(di.CreationTimeUtc, end); Assert.GreaterOrEqual(di.LastAccessTimeUtc, start); Assert.LessOrEqual(di.LastAccessTimeUtc, end); Assert.GreaterOrEqual(di.LastWriteTimeUtc, start); Assert.LessOrEqual(di.LastWriteTimeUtc, end); }
public void Attributes() { // Start time rounded down to whole seconds DateTime start = DateTime.UtcNow; start = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second); CDBuilder builder = new CDBuilder(); builder.AddDirectory("Foo"); CDReader fs = new CDReader(builder.Build(), false); DateTime end = DateTime.UtcNow; DiscDirectoryInfo di = fs.GetDirectoryInfo("Foo"); Assert.AreEqual(FileAttributes.Directory | FileAttributes.ReadOnly, di.Attributes); Assert.GreaterOrEqual(di.CreationTimeUtc, start); Assert.LessOrEqual(di.CreationTimeUtc, end); Assert.GreaterOrEqual(di.LastAccessTimeUtc, start); Assert.LessOrEqual(di.LastAccessTimeUtc, end); Assert.GreaterOrEqual(di.LastWriteTimeUtc, start); Assert.LessOrEqual(di.LastWriteTimeUtc, end); }
public void GetDirectories() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"A.DIR"); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(2, fs.Root.GetDirectories().Length); DiscDirectoryInfo someDir = fs.Root.GetDirectories(@"SoMeDir")[0]; Assert.AreEqual(1, fs.Root.GetDirectories("SOMEDIR").Length); Assert.AreEqual("SOMEDIR", someDir.Name); Assert.AreEqual(1, someDir.GetDirectories("*.*").Length); Assert.AreEqual("CHILD", someDir.GetDirectories("*.*")[0].Name); Assert.AreEqual(2, someDir.GetDirectories("*.*", SearchOption.AllDirectories).Length); Assert.AreEqual(4, fs.Root.GetDirectories("*.*", SearchOption.AllDirectories).Length); Assert.AreEqual(2, fs.Root.GetDirectories("*.*", SearchOption.TopDirectoryOnly).Length); Assert.AreEqual(1, fs.Root.GetDirectories("*.DIR", SearchOption.AllDirectories).Length); Assert.AreEqual(@"A.DIR\", fs.Root.GetDirectories("*.DIR", SearchOption.AllDirectories)[0].FullName); Assert.AreEqual(1, fs.Root.GetDirectories("GCHILD", SearchOption.AllDirectories).Length); Assert.AreEqual(@"SOMEDIR\CHILD\GCHILD\", fs.Root.GetDirectories("GCHILD", SearchOption.AllDirectories)[0].FullName); }
public void Parent() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR"); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(fs.Root, fs.Root.GetDirectories("SOMEDIR")[0].Parent); }
public void GetFileSystemInfos() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"AAA.EXT"); builder.AddFile(@"FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD\GCHILD\BAR.TXT", new byte[10]); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(3, fs.Root.GetFileSystemInfos().Length); Assert.AreEqual(1, fs.Root.GetFileSystemInfos("*.EXT").Length); Assert.AreEqual(2, fs.Root.GetFileSystemInfos("*.?XT").Length); }
public void GetFiles() { CDBuilder builder = new CDBuilder(); builder.AddDirectory(@"SOMEDIR\CHILD\GCHILD"); builder.AddDirectory(@"AAA.DIR"); builder.AddFile(@"FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\FOO.TXT", new byte[10]); builder.AddFile(@"SOMEDIR\CHILD\GCHILD\BAR.TXT", new byte[10]); CDReader fs = new CDReader(builder.Build(), false); Assert.AreEqual(1, fs.Root.GetFiles().Length); Assert.AreEqual("FOO.TXT", fs.Root.GetFiles()[0].FullName); Assert.AreEqual(2, fs.Root.GetDirectories("SOMEDIR")[0].GetFiles("*.TXT").Length); Assert.AreEqual(4, fs.Root.GetFiles("*.TXT", SearchOption.AllDirectories).Length); Assert.AreEqual(0, fs.Root.GetFiles("*.DIR", SearchOption.AllDirectories).Length); }