Beispiel #1
0
        public void ExtractAll(sio.FileStream fs, string extrPath)
        {
            sio.DirectoryInfo di;
            int i, j;

            if (primary == null)
                return;

            extrPath = misc.DICreateAndCheck(extrPath).FullName;
            for (i = 0; i < paths.Count; i++)
            {
                di = misc.DICreateAndCheck(extrPath + paths[i].fullName);
                for (j = 1; j < paths[i].files.Count; j++)
                    if (!paths[i].files[j].isDirectory)
                    {
                        Console.WriteLine(string.Format("Extracting file '{0}'", paths[i].fullName + paths[i].files[j].name));
                        fs.Extract(di.FullName + paths[i].files[j].name, (long)paths[i].files[j].hdr.locL * ISO9660.logSize + ISO9660.fsOff, (uint)paths[i].files[j].hdr.datLenL);
                    }
            }
        }
Beispiel #2
0
        private void GetArchs(string extrPath, string name, sio.MemoryStream ms, long len)
        {
            sio.BinaryReader br;
            int archType;
            long prevPos;
            long lastPos;
            int fileCount;

            gIterCount++;

            br = new sio.BinaryReader(ms);

            prevPos = ms.Position;
            lastPos = prevPos + len;
            archType = GetArchType(br, len, out fileCount);
            if (archType > 0)
                if (sw == null)
                    sw = new sio.StreamWriter(string.Format("{0}{1}$arch.type", extrPath, misc.dirSep));
            ms.Position = prevPos;

            switch (archType)
            {
                case 1:
                    sw.WriteLine("{{type={0},name={1},count={2}}}", archType, name, fileCount);
                    ExtractUnNamedBinary(extrPath, br, lastPos);
                    sw.WriteLine("{end}");
                    break;
                case 2:
                    sw.WriteLine("{{type={0},name={1}}}", archType, name);
                    ExtractNamedBinary(extrPath, br, len);
                    sw.WriteLine("{end}");
                    break;
                case 3:
                    sw.WriteLine("{{type={0},name={1},count={2}}}", archType, name, fileCount);
                    ExtractSpr0(extrPath, br, lastPos);
                    sw.WriteLine("{end}");
                    break;
                case 4:
                    sw.WriteLine("{{type={0},name={1},count={2}}}", archType, name, fileCount);
                    ExtractPmd1(extrPath, br, len);
                    sw.WriteLine("{end}");
                    break;
                case 5:
                    sw.WriteLine("{{type={0},name={1},count={2}}}", archType, name, fileCount);
                    ExtractTxp0(extrPath, br, len);
                    sw.WriteLine("{end}");
                    break;
                case 6:
                    sw.WriteLine("{{type={0},name={1}}}", archType, name);
                    ExtractPib0(extrPath, br, len);
                    sw.WriteLine("{end}");
                    break;
                case 7:
                    sw.WriteLine("{{type={0},name={1}}}", archType, name);
                    ExtractTmx0Ps2(extrPath, br, len);
                    sw.WriteLine("{end}");

                    ms.Position = prevPos;
                    if (gIterCount == 1)
                        ms.Position += len;
                    else
                        ms.Extract(extrPath + name, len);
                    break;
                case 8:
                    sw.WriteLine("{{type={0},name={1}}}", archType, name);
                    ExtractCin(extrPath, br, len);
                    sw.WriteLine("{end}");
                    break;
                default:
                    if (gIterCount == 1)
                        ms.Position += len;
                    else
                    {
                        sw.WriteLine(name);
                        ms.Extract(extrPath + name, len);
                    }
                    break;
            }

            gIterCount--;
        }