263
public void Test_COMPARE_DIR_ENTRY_NAME_BUG_FIX_ID_3487353()
265
var f = new CompoundFile("report_name_fix.xls", UpdateMode.Update, true, true);
266
CFStream cfs = f.RootStorage.AddStream("Poorbook");
267
cfs.AppendData(Helpers.GetBuffer(20));
271
f = new CompoundFile("report_name_fix.xls", UpdateMode.Update, true, true);
272
cfs = f.RootStorage.GetStream("Workbook");
273
Assert.IsTrue(cfs.Name == "Workbook");
274
f.RootStorage.Delete("PoorBook");
281
public void Test_GET_COMPOUND_VERSION()
283
var f = new CompoundFile("report_name_fix.xls");
284
CFSVersion ver = f.Version;
286
Assert.IsTrue(ver == CFSVersion.Ver_3);
263
292
public void Test_FUNCTIONAL_BEHAVIOUR()
265
294
const int N_FACTOR = 1;
526
556
d2 = cf.RootStorage.GetStorage("MiniStorage").GetStream("miniSt2").GetData();
527
557
Assert.IsNotNull(d2);
528
558
Assert.IsTrue(d2.Length == bA.Length);
534
564
cf = new CompoundFile("6_Streams_Shrinked.cfs", UpdateMode.ReadOnly, true, false);
536
566
var myStream = cf.RootStorage.GetStream("C");
547
577
Console.WriteLine(sw.ElapsedMilliseconds);
582
public void Test_RETRIVE_ALL_NAMED_ENTRIES()
584
var f = new CompoundFile("MultipleStorage4.cfs");
585
IList<CFItem> result = f.GetAllNamedEntries("MyStream");
587
Assert.IsTrue(result.Count == 3);
592
public void Test_CORRUPTED_CYCLIC_FAT_CHECK()
594
CompoundFile f = null;
597
f = new CompoundFile("CyclicFAT.cfs");
602
Assert.IsTrue(ex is CFCorruptedFileException);
612
public void Test_DIFAT_CHECK()
614
CompoundFile f = null;
617
f = new CompoundFile();
618
CFStream st = f.RootStorage.AddStream("LargeStream");
619
st.AppendData(Helpers.GetBuffer(20000000, 0x0A)); //Forcing creation of two DIFAT sectors
620
byte[] b1 = Helpers.GetBuffer(3, 0x0B);
621
st.AppendData(b1); //Forcing creation of two DIFAT sectors
623
f.Save("$OpenMcdf$LargeFile.cfs");
628
f = new CompoundFile("$OpenMcdf$LargeFile.cfs");
629
byte[] b2 = f.RootStorage.GetStream("LargeStream").GetData(20000000, ref cnt);
631
Assert.IsTrue(Helpers.CompareBuffer(b1, b2));
638
if (File.Exists("$OpenMcdf$LargeFile.cfs"))
639
File.Delete("$OpenMcdf$LargeFile.cfs");
644
//public void Test_CORRUPTED_CYCLIC_DIFAT_VALIDATION_CHECK()
647
// CompoundFile cf = null;
650
// cf = new CompoundFile("CiclycDFAT.cfs");
651
// CFStorage s = cf.RootStorage.GetStorage("MyStorage");
652
// CFStream st = s.GetStream("MyStream");
653
// Assert.IsTrue(st.Size > 0);
655
// catch (Exception ex)
657
// Assert.IsTrue(ex is CFCorruptedFileException);
668
//public void Test_REM()
670
// var f = new CompoundFile();
672
// byte[] bB = Helpers.GetBuffer(5 * 1024, 0x0B);
673
// f.RootStorage.AddStream("Test").AppendData(bB);
674
// f.Save("Astorage.cfs");