Пример #1
0
    public void ExtractCabinetFileTest()
    {
        string sampleCabinetName = "demo.CAB";

        using (var handle = Cabinet.FDICreate(
                   this.fdiAllocMemDelegate,
                   this.fdiFreeMemDelegate,
                   this.fdiOpenStreamDelegate,
                   this.fdiReadStreamDelegate,
                   this.fdiWriteStreamDelegate,
                   this.fdiCloseStreamDelegate,
                   this.fdiSeekStreamDelegate,
                   Cabinet.CpuType.Unknown,
                   out this.erf))
        {
            if (!Cabinet.FDICopy(
                    handle,
                    sampleCabinetName,
                    SampleCabinetPath,
                    0,
                    this.ExtractNotify,
                    IntPtr.Zero,
                    IntPtr.Zero))
            {
                throw new Exception($"Failed to extract the cabinet: {this.erf.Oper}");
            }
        }
    }