Esempio n. 1
0
    public void TestUDIF()
    {
        var udifStream = new FileStream("Samples/UDIF.rsrc", FileMode.Open, FileAccess.Read);
        var rsrc       = new ResourceFork(udifStream);

        uint[] types = rsrc.GetTypes();
        Assert.AreEqual(2, types.Length);
        Assert.AreEqual(0x626C6B78, types[0]);
        Assert.AreEqual(0x706C7374, types[1]);

        Resource blkx = rsrc.GetResource(0x626C6B78);

        Assert.IsNotNull(blkx);
        short[] blkxIds = blkx.GetIds();
        Assert.AreEqual(0, blkxIds[0]);
        Assert.AreEqual(524, blkx.GetLength(0));
        string blkxStr = blkx.GetName(0);

        Assert.AreEqual("Whole Device (Apple_XXX : 0)", blkxStr); //"First Segment"

        Resource plst = rsrc.GetResource(0x706C7374);

        Assert.IsNotNull(plst);
        short[] plstIds = plst.GetIds();
        Assert.AreEqual(0, plstIds[0]);
        Assert.AreEqual(1544, plst.GetLength(0));
        string plstStr = plst.GetName(0);

        Assert.IsNull(plstStr);

        Resource vers = rsrc.GetResource(0x76657273);

        Assert.IsNull(vers);
    }
Esempio n. 2
0
    public void TestSMI()
    {
        var smiStream = new FileStream("Samples/SelfMountingImage.rsrc", FileMode.Open, FileAccess.Read);
        var rsrc      = new ResourceFork(smiStream);

        uint[] types = rsrc.GetTypes();
        Assert.AreEqual(29, types.Length);
        Assert.AreEqual(0x424E444C, types[0]);
        Assert.AreEqual(0x434F4445, types[1]);
        Assert.AreEqual(0x44415441, types[2]);
        Assert.AreEqual(0x4449544C, types[3]);
        Assert.AreEqual(0x444C4F47, types[4]);
        Assert.AreEqual(0x44525652, types[5]);
        Assert.AreEqual(0x46524546, types[6]);
        Assert.AreEqual(0x49434E23, types[7]);
        Assert.AreEqual(0x4D505352, types[8]);
        Assert.AreEqual(0x4D574242, types[9]);
        Assert.AreEqual(0x50415420, types[10]);

        Resource code = rsrc.GetResource(0x434F4445);

        Assert.IsNotNull(code);
        short[] codeIds = code.GetIds();
        Assert.AreEqual(0, codeIds[0]);
        Assert.AreEqual(1, codeIds[1]);
        Assert.AreEqual(35130, code.GetLength(1));
        string codeStr = code.GetName(1);

        Assert.AreEqual("First Segment", codeStr); //"First Segment"

        Resource bndl = rsrc.GetResource(0x424E444C);

        Assert.IsNotNull(bndl);
        short[] bndlIds = bndl.GetIds();
        Assert.AreEqual(128, bndlIds[0]);
        Assert.AreEqual(28, bndl.GetLength(128));
        string bndlStr = bndl.GetName(128);

        Assert.IsNull(bndlStr);

        Resource vers = rsrc.GetResource(0x76657273);

        Assert.IsNotNull(vers);
        byte[] vers1   = vers.GetResource(1);
        var    versDec = new Version(vers1);

        Assert.AreEqual(1, versDec.MajorVersion);
        Assert.AreEqual(10, versDec.MinorVersion);
        Assert.AreEqual(Version.DevelopmentStage.Beta, versDec.DevStage);
        Assert.AreEqual(6, versDec.PreReleaseVersion);
        Assert.AreEqual(0, versDec.RegionCode);
        Assert.AreEqual("1.1b6", versDec.VersionString);
        Assert.AreEqual("1.1b6, Copyright 1997-2001 Apple Computer, Inc.", versDec.VersionMessage);
    }
Esempio n. 3
0
    public void TestDC42()
    {
        var dc42Stream = new FileStream("Samples/DiskCopy42.rsrc", FileMode.Open, FileAccess.Read);
        var rsrc       = new ResourceFork(dc42Stream);

        uint[] types = rsrc.GetTypes();
        Assert.AreEqual(0x53545220, types[0]);
        Assert.AreEqual(0x76657273, types[1]);

        Resource str_ = rsrc.GetResource(0x53545220);

        Assert.IsNotNull(str_);

        short[] str_Ids = str_.GetIds();
        Assert.AreEqual(-16396, str_Ids[0]);
        Assert.AreEqual(10, str_.GetLength(-16396));

        byte[] str1 = str_.GetResource(-16396);
        Assert.AreEqual(DC42_Str, str1);

        string strStr = str_.GetName(-16396);

        Assert.IsNull(strStr);

        Resource vers = rsrc.GetResource(0x76657273);

        Assert.IsNotNull(vers);
        short[] versIds = vers.GetIds();
        Assert.AreEqual(1, versIds[0]);
        Assert.AreEqual(45, vers.GetLength(1));

        byte[] vers1 = vers.GetResource(1);
        Assert.AreEqual(DC42_Vers, vers1);

        string versStr = vers.GetName(1);

        Assert.IsNull(versStr);

        var versDec = new Version(vers1);

        Assert.AreEqual(6, versDec.MajorVersion);
        Assert.AreEqual(40, versDec.MinorVersion);
        Assert.AreEqual(Version.DevelopmentStage.Final, versDec.DevStage);
        Assert.AreEqual(0, versDec.PreReleaseVersion);
        Assert.AreEqual(0, versDec.RegionCode);
        Assert.AreEqual("Disk Copy", versDec.VersionString);
        Assert.AreEqual("4.2, data checksum=$A5147F7E", versDec.VersionMessage);
    }
Esempio n. 4
0
    public void TestDC6()
    {
        var dc6Stream = new FileStream("Samples/DiskCopy6.rsrc", FileMode.Open, FileAccess.Read);
        var rsrc      = new ResourceFork(dc6Stream);

        uint[] types = rsrc.GetTypes();
        Assert.AreEqual(0x53545220, types[0]);
        Assert.AreEqual(0x6263656D, types[1]);
        Assert.AreEqual(0x62636D23, types[2]);
        Assert.AreEqual(0x76657273, types[3]);

        Resource str_ = rsrc.GetResource(0x53545220);

        Assert.IsNotNull(str_);

        short[] str_Ids = str_.GetIds();
        Assert.AreEqual(-16396, str_Ids[0]);
        Assert.AreEqual(10, str_.GetLength(-16396));

        byte[] str1 = str_.GetResource(-16396);
        Assert.AreEqual(DC42_Str, str1);

        string strStr = str_.GetName(-16396);

        Assert.IsNull(strStr);

        Resource vers = rsrc.GetResource(0x76657273);

        Assert.IsNotNull(vers);
        short[] versIds = vers.GetIds();
        Assert.AreEqual(1, versIds[0]);
        Assert.AreEqual(66, vers.GetLength(1));

        string versStr = vers.GetName(1);

        Assert.IsNull(versStr);

        Resource bcem = rsrc.GetResource(0x6263656D);

        Assert.IsNotNull(bcem);
        short[] bcemIds = bcem.GetIds();
        Assert.AreEqual(128, bcemIds[0]);
        Assert.AreEqual(224, bcem.GetLength(128));
        string bcemStr = bcem.GetName(128);

        Assert.IsNull(bcemStr);

        Resource bceS = rsrc.GetResource(0x6263656D);

        Assert.IsNotNull(bceS);
        short[] bceSIds = bceS.GetIds();
        Assert.AreEqual(128, bceSIds[0]);
        Assert.AreEqual(224, bcem.GetLength(128));
        string bceSStr = bceS.GetName(128);

        Assert.IsNull(bceSStr);

        byte[] vers1   = vers.GetResource(1);
        var    versDec = new Version(vers1);

        Assert.AreEqual(6, versDec.MajorVersion);
        Assert.AreEqual(40, versDec.MinorVersion);
        Assert.AreEqual(Version.DevelopmentStage.Final, versDec.DevStage);
        Assert.AreEqual(0, versDec.PreReleaseVersion);
        Assert.AreEqual(0, versDec.RegionCode);
        Assert.AreEqual("6.4 Disk Copy", versDec.VersionString);
        Assert.AreEqual("Mac? OS HFS 1680K disk image\rCRC28: $07213FB7", versDec.VersionMessage);
    }