Exemple #1
0
        protected virtual uint OnFileFound(uint context, uint notification, IntPtr param1, IntPtr param2)
        {
            uint fileOperation = SetupApiWrapper.NO_ERROR;
            FILE_IN_CABINET_INFO fileInCabinetInfo = (FILE_IN_CABINET_INFO)Marshal.PtrToStructure(param1, typeof(FILE_IN_CABINET_INFO));
            TFile file = new TFile(fileInCabinetInfo);
            switch(context)
            {
                case (uint)SetupIterateCabinetAction.Iterate:
                    List.Add(file);
                    if (m_FileFound != null)
                        m_FileFound(file, System.EventArgs.Empty);
                    fileOperation = (uint)FILEOP.FILEOP_SKIP;
                    break;

                case (uint)SetupIterateCabinetAction.Extract:
                    if (this.m_ExtractAll)
                        this.m_ExtractFileIndex = this.IndexOf(file);

                    fileOperation = OnFileExtractBefore(file);
                    if (fileOperation == (uint)FILEOP.FILEOP_DOIT)
                    {
                        fileInCabinetInfo.FullTargetName = MakeExtractFileName(file);
                        Marshal.StructureToPtr(fileInCabinetInfo, param1, true);
                    }
                    break;
            }
            return fileOperation;
        }
Exemple #2
0
 private string MakeExtractFileName(TFile file)
 {
     string sFile = this.OutputDirectory;
     if (!this.IgnoreInsidePath && file.Path.Length >0)
     {
         sFile += System.IO.Path.DirectorySeparatorChar.ToString() + file.Path;
         if (!System.IO.Directory.Exists(sFile))
             System.IO.Directory.CreateDirectory(sFile);
     }
     sFile += System.IO.Path.DirectorySeparatorChar.ToString() + file.Name;
     sFile = sFile.Replace(@"\\", @"\");
     return sFile;
 }
Exemple #3
0
 public void Remove(TFile item)
 {
     throw new NotSupportedException();
     //			List.Remove(item);
 }
Exemple #4
0
        protected virtual uint OnFileExtractBefore(TFile file)
        {
            bool cancel = false;

            if (file != (TFile)this.List[m_ExtractFileIndex])
                return (uint)FILEOP.FILEOP_SKIP;

            if (m_FileExtractBefore != null)
            {
                System.ComponentModel.CancelEventArgs arg = new CancelEventArgs(false);
                m_FileExtractBefore(file, arg);
                cancel = arg.Cancel;
            }
            if (cancel)
                return (uint)FILEOP.FILEOP_SKIP;

            return (uint)FILEOP.FILEOP_DOIT;
        }
Exemple #5
0
 public void Insert(int index, TFile item)
 {
     throw new NotSupportedException();
     //			List.Insert(index, item);
 }
Exemple #6
0
 public int IndexOf(TFile item)
 {
     return( List.IndexOf( item ) );
 }
Exemple #7
0
 public void Extract(TFile file)
 {
     int intI = this.IndexOf(file);
     Extract(intI);
 }
Exemple #8
0
 public bool Contains(TFile item)
 {
     return( List.Contains( item ) );
 }
Exemple #9
0
 public int Add(TFile item)
 {
     throw new NotSupportedException();
     //	return (List.Add(item));
 }