Exemplo n.º 1
0
        //In an ideal world, this would take a stream, but Cabinet.dll seems to want to open the input several times.
        public static bool ExtractFile(byte[] inputData, string fileName, out byte[] outputData, out int length)
        {
            int i = 10;

            while (i-- != 0)
            {
                try
                {
                    using (CabExtract decomp = new CabExtract(inputData))
                        return(decomp.ExtractFile(fileName, out outputData, out length));
                } catch (Exception)
                {
                    Thread.Sleep(1000);
                }
            }

            outputData = null;
            length     = 0;
            return(false);
        }
Exemplo n.º 2
0
 public static bool IsCabinetFile(byte[] inputData, out CabinetInfo cabinfo)
 {
     using (CabExtract decomp = new CabExtract(inputData))
         return(decomp.IsCabinetFile(out cabinfo));
 }