示例#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;
        }
示例#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;
 }
示例#3
0
 public void Remove(TFile item)
 {
     throw new NotSupportedException();
     //			List.Remove(item);
 }
示例#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;
        }
示例#5
0
 public void Insert(int index, TFile item)
 {
     throw new NotSupportedException();
     //			List.Insert(index, item);
 }
示例#6
0
 public int IndexOf(TFile item)
 {
     return( List.IndexOf( item ) );
 }
示例#7
0
 public void Extract(TFile file)
 {
     int intI = this.IndexOf(file);
     Extract(intI);
 }
示例#8
0
 public bool Contains(TFile item)
 {
     return( List.Contains( item ) );
 }
示例#9
0
 public int Add(TFile item)
 {
     throw new NotSupportedException();
     //	return (List.Add(item));
 }