Exemplo n.º 1
0
        // Show detailed information about CAB structures, for debug purposes
        static void DumpCAB(string name)
        {
            FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read);

            CFHeader cfh = new CFHeader(fs);

            Console.WriteLine("Cabinet Header");
            Console.WriteLine(cfh);

            fs.Seek(cfh.uiFilesOffset, SeekOrigin.Begin);
            for (int i = 0; i < cfh.usNumFiles; i++)
            {
                Console.Write("@{0:X8}h ", fs.Position);
                CFFile cff = new CFFile(fs);
                Console.WriteLine(cff);
            }

            fs.Seek(cfh.Length, SeekOrigin.Begin);

            Console.WriteLine("Cabinet Folders");

            for (int i = 0; i < cfh.usNumFolders; i++)
            {
                Console.Write("@{0:X8}h ", fs.Position);
                CFFolder cffld = new CFFolder(fs);
                Console.WriteLine(cffld);

                fs.Seek(cffld.uiDataOffset, SeekOrigin.Begin);

                Console.WriteLine("{0} CFDATA blocks", cffld.usBlocks);
                for (int j = 0; j < cffld.usBlocks; j++)
                {
                    Console.Write("@{0:X8}h ", fs.Position);
                    CFData cfd = new CFData(fs, bLoadData:true);
                    Console.WriteLine(cfd);
                }
            }

            fs.Close();
        }
Exemplo n.º 2
0
        // Show detailed information about CAB structures, for debug purposes
        static void DumpCAB(string name)
        {
            FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read);

            CFHeader cfh = new CFHeader(fs);

            Console.WriteLine("Cabinet Header");
            Console.WriteLine(cfh);

            fs.Seek(cfh.uiFilesOffset, SeekOrigin.Begin);
            for (int i = 0; i < cfh.usNumFiles; i++)
            {
                Console.Write("@{0:X8}h ", fs.Position);
                CFFile cff = new CFFile(fs);
                Console.WriteLine(cff);
            }

            fs.Seek(cfh.Length, SeekOrigin.Begin);

            Console.WriteLine("Cabinet Folders");

            for (int i = 0; i < cfh.usNumFolders; i++)
            {
                Console.Write("@{0:X8}h ", fs.Position);
                CFFolder cffld = new CFFolder(fs);
                Console.WriteLine(cffld);

                fs.Seek(cffld.uiDataOffset, SeekOrigin.Begin);

                Console.WriteLine("{0} CFDATA blocks", cffld.usBlocks);
                for (int j = 0; j < cffld.usBlocks; j++)
                {
                    Console.Write("@{0:X8}h ", fs.Position);
                    CFData cfd = new CFData(fs, bLoadData: true);
                    Console.WriteLine(cfd);
                }
            }

            fs.Close();
        }