2017-07-05 06:54:50 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2017-07-05 06:55:25 +01:00
|
|
|
|
// Filename : UDF.cs
|
2017-07-05 06:54:50 +01:00
|
|
|
|
// Version : 1.0
|
|
|
|
|
|
// Author(s) : Natalia Portillo
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Component
|
|
|
|
|
|
//
|
|
|
|
|
|
// Revision : $Revision$
|
|
|
|
|
|
// Last change by : $Author$
|
|
|
|
|
|
// Date : $Date$
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Description
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
// Copyright (C) 2011-2015 Claunia.com
|
|
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
// //$Id$
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using DiscImageChef.Filesystems;
|
|
|
|
|
|
using DiscImageChef.Filters;
|
|
|
|
|
|
using DiscImageChef.ImagePlugins;
|
|
|
|
|
|
using NUnit.Framework;
|
2017-07-05 06:55:25 +01:00
|
|
|
|
using DiscImageChef.DiscImages;
|
2017-07-05 06:54:50 +01:00
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Tests.Filesystems
|
|
|
|
|
|
{
|
|
|
|
|
|
[TestFixture]
|
2017-07-05 06:55:25 +01:00
|
|
|
|
public class UDF
|
2017-07-05 06:54:50 +01:00
|
|
|
|
{
|
|
|
|
|
|
readonly string[] testfiles = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
"1.02/linux.vdi.lz", "1.02/macosx.vdi.lz", "1.50/linux.vdi.lz", "1.50/macosx.vdi.lz",
|
|
|
|
|
|
"2.00/linux.vdi.lz", "2.00/macosx.vdi.lz", "2.01/linux.vdi.lz", "2.01/macosx.vdi.lz",
|
|
|
|
|
|
"2.50/linux.vdi.lz", "2.50/macosx.vdi.lz", "2.60/macosx.vdi.lz",
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly ulong[] sectors = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
1024000, 204800, 1024000, 409600,
|
|
|
|
|
|
1024000, 614400, 1024000, 819200,
|
|
|
|
|
|
1024000, 1024000, 1228800,
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly uint[] sectorsize = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
512, 512, 512, 512,
|
|
|
|
|
|
512, 512, 512, 512,
|
|
|
|
|
|
512, 512, 512,
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly long[] clusters = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
1024000, 204800, 1024000, 409600,
|
|
|
|
|
|
1024000, 614400, 1024000, 819200,
|
|
|
|
|
|
1024000, 1024000, 1228800,
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly int[] clustersize = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
512, 512, 512, 512,
|
|
|
|
|
|
512, 512, 512, 512,
|
|
|
|
|
|
512, 512, 512,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly string[] udfversion = {
|
|
|
|
|
|
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50",
|
|
|
|
|
|
"UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
|
|
|
|
|
|
"UDF v2.50", "UDF v2.50", "UDF v2.50",
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly string[] volumename = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
"Volume label", "Volume label", "Volume label", "Volume label",
|
|
|
|
|
|
"Volume label", "Volume label", "Volume label", "Volume label",
|
|
|
|
|
|
"Volume label", "Volume label", "Volume label",
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly string[] volumeserial = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", "4DD0458B (Mac OS X newfs_udf) UDF Volume Set",
|
|
|
|
|
|
"595c5d07f4fc8e8dLinuxUDF", "5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF", "48847EB3 (Mac OS X newfs_udf) UDF Volume Set",
|
|
|
|
|
|
"595c5d0e4f338552LinuxUDF", "709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set",
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly string[] oemid = {
|
2017-07-05 06:55:25 +01:00
|
|
|
|
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS",
|
|
|
|
|
|
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS",
|
|
|
|
|
|
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS",
|
2017-07-05 06:54:50 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
public void Test()
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int i = 0; i < testfiles.Length; i++)
|
|
|
|
|
|
{
|
2017-07-05 06:55:25 +01:00
|
|
|
|
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "udf", testfiles[i]);
|
2017-07-05 06:54:50 +01:00
|
|
|
|
Filter filter = new LZip();
|
|
|
|
|
|
filter.Open(location);
|
2017-07-05 06:55:25 +01:00
|
|
|
|
ImagePlugin image = new VDI();
|
2017-07-05 06:54:50 +01:00
|
|
|
|
Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]);
|
|
|
|
|
|
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
|
|
|
|
|
|
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
|
2017-07-05 06:55:25 +01:00
|
|
|
|
Filesystem fs = new DiscImageChef.Filesystems.UDF();
|
2017-07-05 06:54:50 +01:00
|
|
|
|
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
|
|
|
|
|
|
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
|
|
|
|
|
|
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
|
|
|
|
|
|
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
|
2017-07-05 06:55:25 +01:00
|
|
|
|
Assert.AreEqual(udfversion[i], fs.XmlFSType.Type, testfiles[i]);
|
2017-07-05 06:54:50 +01:00
|
|
|
|
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
|
2017-07-05 06:55:25 +01:00
|
|
|
|
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSetIdentifier, testfiles[i]);
|
2017-07-05 06:54:50 +01:00
|
|
|
|
Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|