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