public void Test_FileInfo_Loading(string aFile) { Assembly fAssembly = Assembly.GetExecutingAssembly(); using (Stream fSource = fAssembly.GetManifestResourceStream(aFile)) { //Write the File to a Temporary File and use FileInfo Arguments string fTestFileName = $"{Guid.NewGuid()}.h5"; using (FileStream fTest = new FileStream( fTestFileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite, 64, FileOptions.DeleteOnClose)) { int fLength = (int)fSource.Length; byte[] fFileBytes = new byte[fLength]; fSource.Read(fFileBytes, 0, fLength); fTest.Write(fFileBytes, 0, fLength); fTest.Flush(); using (Hdf5File fTestFile = Hdf5File.Open(new FileInfo(fTestFileName))) { Assert.That(fTestFile.SuperBlock.RootGroupAddress, Is.Not.Null); } } } }
public void Test_basic_loading(string aFile) { Assembly fAssembly = Assembly.GetExecutingAssembly(); using (Stream fTestStream = fAssembly.GetManifestResourceStream(aFile)) { using (Hdf5File fTest = Hdf5File.Open(fTestStream)) { Assert.That(fTest.SuperBlock.RootGroupAddress, Is.Not.Null); } } }
public static int Main(string[] args) { foreach (string fFile in Loading.AllExampleFiles) { Assembly fAssembly = Assembly.GetExecutingAssembly(); try { using (Stream fTestStream = fAssembly.GetManifestResourceStream(fFile)) { using (Hdf5File fTest = Hdf5File.Open(fTestStream)) { ndf5.Metadata.ISuperBlock fSuperBlock = fTest.SuperBlock; string fRootGroupAddr = fSuperBlock.RootGroupAddress.IsNull() ? "null" : $"0x{fSuperBlock.RootGroupAddress:X16}"; Console.WriteLine( $"{fFile.Replace("ndf5.tests.TestData.", "").PadRight(40)}| " + $"SBVersion:{fSuperBlock.SuperBlockVersion:X} O:{fSuperBlock.SizeOfOffsets} " + $"L:{fSuperBlock.SizeOfLengths} GiK:{fSuperBlock.GroupInternalNodeK} " + $"GlK: {fSuperBlock.GroupLeafNodeK} IsiK:{fSuperBlock.IndexedStorageInternalNodeK} " + $"Root Obj Addr: { fRootGroupAddr}"); } } } catch (Exception fException) { Console.WriteLine( $"{fFile.Replace("ndf5.tests.TestData.", "").PadRight(40)}| {fException.Message}"); } } return(0); }