public void FileEntry_Reads() { var dirEntry = new DirEntry("name", this.fileBytes); Assert.NotNull(dirEntry.CatalogFileInfo); Assert.Equal(new DateTime(2016, 4, 23, 2, 51, 31, DateTimeKind.Utc), dirEntry.CreationTimeUtc); Assert.Equal((FileAttributes)0, dirEntry.FileAttributes); Assert.Equal("name", dirEntry.FileName); Assert.True(dirEntry.HasVfsFileAttributes); Assert.True(dirEntry.HasVfsTimeInfo); Assert.False(dirEntry.IsDirectory); Assert.False(dirEntry.IsSymlink); Assert.Equal(new DateTime(2016, 4, 27, 0, 50, 49, DateTimeKind.Utc), dirEntry.LastAccessTimeUtc); Assert.Equal(new DateTime(2016, 4, 26, 23, 49, 49, DateTimeKind.Utc), dirEntry.LastWriteTimeUtc); Assert.Equal(new CatalogNodeId(0x000575cb), dirEntry.NodeId); Assert.Equal("name.", dirEntry.SearchName); Assert.Equal(0x000575cb, dirEntry.UniqueCacheId); Assert.Equal("name", dirEntry.ToString()); }
void PrintDataToFile(DirEntry dir) { string content = dir.ToString(); byte[] data = GetData(dir); switch ((ABIF_Type)dir.elementtype) { case ABIF_Type.BOOL: for (int i = 0; i < dir.numelements; i++) { content += (ToBoolean(data, i)); content += (" "); } content += "\r\n"; break; case ABIF_Type.BYTE: content += (BitConverter.ToString(data)); content += "\r\n"; break; case ABIF_Type.CHAR: content += new string(Encoding.ASCII.GetChars(data, 0, dir.numelements)); content += (" "); content += "\r\n"; break; case ABIF_Type.FLOAT: for (int i = 0; i < dir.numelements; i++) { content += (BitConverter.ToSingle(data, i)); content += (" "); } content += "\r\n"; break; case ABIF_Type.SHORT: for (int i = 0; i < dir.numelements; i++) { content += (ToInt16(data, i)); content += (" "); } content += "\r\n"; break; case ABIF_Type.LONG: for (int i = 0; i < dir.numelements; i++) { content += (ToInt32(data, i)); content += (" "); } content += "\r\n"; break; case ABIF_Type.WORD: for (int i = 0; i < dir.numelements; i++) { content += (ToInt32(data, i)); content += (" "); } content += "\r\n"; break; case ABIF_Type.P_STRING: content += (BitProcessor.ToString(data, 1, data[0])); break; case ABIF_Type.C_STRING: content += (BitProcessor.ToString(data, 0, dir.datasize)); break; default: content += BitConverter.ToString(data); content += "\r\n"; break; } Directory.CreateDirectory(".\\Data\\" + FileName + "\\"); File.WriteAllText(".\\Data\\" + FileName + "\\" + dir.strName.Replace('/', '_') + dir.number + ".txt", content); }